@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.
Files changed (94) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +10 -0
  3. package/dist/hermes.js +1202 -0
  4. package/dist/hermes.umd.cjs +29 -0
  5. package/dist/images/debug/icon_camera.png +0 -0
  6. package/dist/images/debug/icon_folder.png +0 -0
  7. package/dist/images/debug/icon_interactive.png +0 -0
  8. package/dist/images/debug/icon_lights.png +0 -0
  9. package/dist/images/debug/icon_refresh.png +0 -0
  10. package/dist/images/debug/icon_ui.png +0 -0
  11. package/dist/images/debug/icon_utils.png +0 -0
  12. package/dist/images/debug/icon_world.png +0 -0
  13. package/dist/style.css +1 -0
  14. package/package.json +63 -0
  15. package/src/core/Application.ts +69 -0
  16. package/src/core/RemoteController.ts +135 -0
  17. package/src/core/remote/BaseRemote.ts +16 -0
  18. package/src/core/remote/RemoteComponents.ts +32 -0
  19. package/src/core/remote/RemoteTheatre.ts +117 -0
  20. package/src/core/remote/RemoteTweakpane.ts +176 -0
  21. package/src/core/types.ts +43 -0
  22. package/src/editor/Editor.tsx +15 -0
  23. package/src/editor/components/Draggable.tsx +40 -0
  24. package/src/editor/components/DraggableItem.tsx +22 -0
  25. package/src/editor/components/Dropdown.tsx +30 -0
  26. package/src/editor/components/DropdownItem.tsx +64 -0
  27. package/src/editor/components/NavButton.tsx +11 -0
  28. package/src/editor/components/icons/CloseIcon.tsx +7 -0
  29. package/src/editor/components/icons/DragIcon.tsx +9 -0
  30. package/src/editor/components/types.ts +41 -0
  31. package/src/editor/global.ts +13 -0
  32. package/src/editor/sceneHierarchy/ChildObject.tsx +56 -0
  33. package/src/editor/sceneHierarchy/ContainerObject.tsx +12 -0
  34. package/src/editor/sceneHierarchy/SceneHierarchy.tsx +77 -0
  35. package/src/editor/sceneHierarchy/types.ts +10 -0
  36. package/src/editor/sceneHierarchy/utils.ts +25 -0
  37. package/src/editor/scss/_debug.scss +68 -0
  38. package/src/editor/scss/_draggable.scss +43 -0
  39. package/src/editor/scss/_dropdown.scss +83 -0
  40. package/src/editor/scss/_sceneHierarchy.scss +170 -0
  41. package/src/editor/scss/_theme.scss +9 -0
  42. package/src/editor/scss/index.scss +58 -0
  43. package/src/editor/utils.ts +20 -0
  44. package/src/example/App.css +6 -0
  45. package/src/example/App.tsx +88 -0
  46. package/src/example/constants.ts +13 -0
  47. package/src/example/index.scss +37 -0
  48. package/src/example/main.tsx +75 -0
  49. package/src/library.ts +16 -0
  50. package/src/vite-env.d.ts +1 -0
  51. package/types/core/Application.d.ts +21 -0
  52. package/types/core/RemoteController.d.ts +2 -0
  53. package/types/core/remote/BaseRemote.d.ts +6 -0
  54. package/types/core/remote/RemoteComponents.d.ts +7 -0
  55. package/types/core/remote/RemoteDebug.d.ts +23 -0
  56. package/types/core/remote/RemoteTheatre.d.ts +16 -0
  57. package/types/core/remote/RemoteTweakpane.d.ts +23 -0
  58. package/types/core/types.d.ts +13 -0
  59. package/types/debug/Editor.d.ts +8 -0
  60. package/types/debug/components/Draggable.d.ts +2 -0
  61. package/types/debug/components/DraggableItem.d.ts +2 -0
  62. package/types/debug/components/Dropdown.d.ts +2 -0
  63. package/types/debug/components/DropdownItem.d.ts +2 -0
  64. package/types/debug/components/NavButton.d.ts +5 -0
  65. package/types/debug/components/icons/CloseIcon.d.ts +2 -0
  66. package/types/debug/components/icons/DragIcon.d.ts +2 -0
  67. package/types/debug/components/types.d.ts +31 -0
  68. package/types/debug/global.d.ts +9 -0
  69. package/types/debug/sceneHierarchy/ChildObject.d.ts +2 -0
  70. package/types/debug/sceneHierarchy/ContainerObject.d.ts +2 -0
  71. package/types/debug/sceneHierarchy/SceneHierarchy.d.ts +13 -0
  72. package/types/debug/sceneHierarchy/types.d.ts +8 -0
  73. package/types/debug/sceneHierarchy/utils.d.ts +2 -0
  74. package/types/debug/utils.d.ts +4 -0
  75. package/types/editor/Editor.d.ts +8 -0
  76. package/types/editor/components/Draggable.d.ts +2 -0
  77. package/types/editor/components/DraggableItem.d.ts +2 -0
  78. package/types/editor/components/Dropdown.d.ts +2 -0
  79. package/types/editor/components/DropdownItem.d.ts +2 -0
  80. package/types/editor/components/NavButton.d.ts +5 -0
  81. package/types/editor/components/icons/CloseIcon.d.ts +2 -0
  82. package/types/editor/components/icons/DragIcon.d.ts +2 -0
  83. package/types/editor/components/types.d.ts +31 -0
  84. package/types/editor/global.d.ts +9 -0
  85. package/types/editor/sceneHierarchy/ChildObject.d.ts +2 -0
  86. package/types/editor/sceneHierarchy/ContainerObject.d.ts +2 -0
  87. package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +13 -0
  88. package/types/editor/sceneHierarchy/types.d.ts +8 -0
  89. package/types/editor/sceneHierarchy/utils.d.ts +2 -0
  90. package/types/editor/utils.d.ts +4 -0
  91. package/types/example/App.d.ts +3 -0
  92. package/types/example/constants.d.ts +3 -0
  93. package/types/example/main.d.ts +1 -0
  94. 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,2 @@
1
+ import Application from './Application';
2
+ export default function RemoteController(app: Application): void;
@@ -0,0 +1,6 @@
1
+ import Application from '../Application';
2
+ export default class BaseRemote {
3
+ protected app: Application;
4
+ constructor(app: Application);
5
+ dispose(): void;
6
+ }
@@ -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,2 @@
1
+ import { DraggableProps } from './types';
2
+ export default function Draggable(props: DraggableProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { DraggableItemProps } from './types';
2
+ export default function DraggableItem(props: DraggableItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { DropdownProps } from './types';
2
+ export default function Dropdown(props: DropdownProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { DropdownItemProps } from './types';
2
+ export default function DropdownItem(props: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ type NavButtonProps = {
2
+ title: string;
3
+ };
4
+ export default function NavButton(props: NavButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -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,2 @@
1
+ import { ChildObjectProps } from './types';
2
+ export default function ChildObject(props: ChildObjectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ChildObjectProps } from './types';
2
+ export default function ContainerObject(props: ChildObjectProps): import("react/jsx-runtime").JSX.Element;
@@ -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
+ import { Object3D } from 'three';
2
+ export type ChildObjectProps = {
3
+ child: Object3D;
4
+ };
5
+ export type SceneHierarchyState = {
6
+ open: boolean;
7
+ scene: Object3D | null;
8
+ };
@@ -0,0 +1,2 @@
1
+ import { Object3D } from 'three';
2
+ export declare function determineIcon(obj: Object3D): string;
@@ -0,0 +1,4 @@
1
+ export declare function clamp(min: number, max: number, value: number): number;
2
+ export declare function distance(x: number, y: number): number;
3
+ export declare function randomID(): string;
4
+ export declare function isColor(obj: any): boolean;
@@ -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,2 @@
1
+ import { DraggableProps } from './types';
2
+ export default function Draggable(props: DraggableProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { DraggableItemProps } from './types';
2
+ export default function DraggableItem(props: DraggableItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { DropdownProps } from './types';
2
+ export default function Dropdown(props: DropdownProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { DropdownItemProps } from './types';
2
+ export default function DropdownItem(props: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ type NavButtonProps = {
2
+ title: string;
3
+ };
4
+ export default function NavButton(props: NavButtonProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -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,2 @@
1
+ import { ChildObjectProps } from './types';
2
+ export default function ChildObject(props: ChildObjectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ChildObjectProps } from './types';
2
+ export default function ContainerObject(props: ChildObjectProps): import("react/jsx-runtime").JSX.Element;
@@ -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
+ import { Object3D } from 'three';
2
+ export type ChildObjectProps = {
3
+ child: Object3D;
4
+ };
5
+ export type SceneHierarchyState = {
6
+ open: boolean;
7
+ scene: Object3D | null;
8
+ };
@@ -0,0 +1,2 @@
1
+ import { Object3D } from 'three';
2
+ export declare function determineIcon(obj: Object3D): string;
@@ -0,0 +1,4 @@
1
+ export declare function clamp(min: number, max: number, value: number): number;
2
+ export declare function distance(x: number, y: number): number;
3
+ export declare function randomID(): string;
4
+ export declare function isColor(obj: any): boolean;
@@ -0,0 +1,3 @@
1
+ import './App.css';
2
+ declare function App(): import("react/jsx-runtime").JSX.Element;
3
+ export default App;
@@ -0,0 +1,3 @@
1
+ import Application from '../core/Application';
2
+ export declare const IS_DEV: boolean;
3
+ export declare const app: Application;
@@ -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';