@tomorrowevening/hermes 0.0.114 → 0.0.116

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.114",
10
+ "version": "0.0.116",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -60,6 +60,7 @@
60
60
  "@typescript-eslint/parser": "^6.4.0",
61
61
  "@vitejs/plugin-react": "^4.0.3",
62
62
  "camera-controls": "^2.9.0",
63
+ "detect-gpu": "^5.0.57",
63
64
  "eslint": "^8.45.0",
64
65
  "eslint-plugin-react": "^7.33.2",
65
66
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -3,6 +3,8 @@ import Application from '../Application';
3
3
  import BaseRemote from './BaseRemote';
4
4
  import { BroadcastData, GroupData } from '../types';
5
5
  export default class RemoteThree extends BaseRemote {
6
+ canvas: HTMLCanvasElement | null;
7
+ inputElement: any;
6
8
  scene?: Scene;
7
9
  scenes: Map<string, Scene>;
8
10
  renderer?: WebGLRenderer;
@@ -19,7 +21,7 @@ export default class RemoteThree extends BaseRemote {
19
21
  updateGroup(group: string, prop: string, value: any): void;
20
22
  removeAllGroups(): void;
21
23
  addSpline(spline: Curve<any>): void;
22
- addRenderer(value: WebGLRenderer): void;
24
+ setRenderer(value: WebGLRenderer, inputElement?: any): void;
23
25
  updateRenderer(data: any): void;
24
26
  addScene(value: Scene): void;
25
27
  refreshScene(value: string): void;
@@ -37,5 +39,4 @@ export default class RemoteThree extends BaseRemote {
37
39
  get dpr(): number;
38
40
  get width(): number;
39
41
  get height(): number;
40
- get canvas(): HTMLCanvasElement | null;
41
42
  }
@@ -1,35 +1,35 @@
1
- import { InspectorFieldType } from '@/editor/sidePanel/inspector/InspectorField';
2
- export interface BroadcastData {
3
- target: ApplicationMode;
4
- event: EditorEvent;
5
- data?: any;
6
- }
7
- export interface GroupItemData {
8
- type: InspectorFieldType;
9
- prop: string;
10
- title?: string;
11
- value?: any;
12
- min?: number;
13
- max?: number;
14
- step?: number;
15
- disabled?: boolean;
16
- options?: any[];
17
- }
18
- export interface GroupData {
19
- title: string;
20
- items: GroupItemData[];
21
- onUpdate: (prop: string, value: any) => void;
22
- }
23
- export interface GroupCallback {
24
- title: string;
25
- onUpdate: (prop: string, value: any) => void;
26
- }
27
- export type ApplicationMode = 'app' | 'editor';
28
- export type VoidCallback = () => void;
29
- export type DataUpdateCallback = (data: any) => void;
30
- export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'playSheet' | 'pauseSheet' | 'getObject' | 'setObject' | 'updateObject' | 'addScene' | 'refreshScene' | 'removeScene' | 'setScene' | 'createTexture' | 'requestMethod' | 'addCamera' | 'removeCamera' | 'addSpline' | 'addRenderer' | 'updateRenderer' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate' | 'addGroup' | 'removeGroup' | 'updateGroup';
31
- export type VoidFunc = () => void;
32
- export type BroadcastCallback = (data: BroadcastData) => void;
33
- export type TheatreUpdateCallback = (data: any) => void;
34
- export declare const noop: () => void;
35
- export declare const defaultTheatreCallback: TheatreUpdateCallback;
1
+ import { InspectorFieldType } from '@/editor/sidePanel/inspector/InspectorField';
2
+ export interface BroadcastData {
3
+ target: ApplicationMode;
4
+ event: EditorEvent;
5
+ data?: any;
6
+ }
7
+ export interface GroupItemData {
8
+ type: InspectorFieldType;
9
+ prop: string;
10
+ title?: string;
11
+ value?: any;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ disabled?: boolean;
16
+ options?: any[];
17
+ }
18
+ export interface GroupData {
19
+ title: string;
20
+ items: GroupItemData[];
21
+ onUpdate: (prop: string, value: any) => void;
22
+ }
23
+ export interface GroupCallback {
24
+ title: string;
25
+ onUpdate: (prop: string, value: any) => void;
26
+ }
27
+ export type ApplicationMode = 'app' | 'editor';
28
+ export type VoidCallback = () => void;
29
+ export type DataUpdateCallback = (data: any) => void;
30
+ export type EditorEvent = 'custom' | 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'playSheet' | 'pauseSheet' | 'getObject' | 'setObject' | 'updateObject' | 'addScene' | 'refreshScene' | 'removeScene' | 'setScene' | 'createTexture' | 'requestMethod' | 'addCamera' | 'removeCamera' | 'addSpline' | 'addRenderer' | 'updateRenderer' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate' | 'addGroup' | 'removeGroup' | 'updateGroup';
31
+ export type VoidFunc = () => void;
32
+ export type BroadcastCallback = (data: BroadcastData) => void;
33
+ export type TheatreUpdateCallback = (data: any) => void;
34
+ export declare const noop: () => void;
35
+ export declare const defaultTheatreCallback: TheatreUpdateCallback;
@@ -1,28 +1,28 @@
1
- import { EventDispatcher } from 'three';
2
- export declare enum ToolEvents {
3
- CUSTOM = "ToolEvents::custom",
4
- SELECT_DROPDOWN = "ToolEvents::selectDropdown",
5
- DRAG_UPDATE = "ToolEvents::dragUpdate",
6
- ADD_SCENE = "ToolEvents::addScene",
7
- REFRESH_SCENE = "ToolEvents::refreshScene",
8
- REMOVE_SCENE = "ToolEvents::removeScene",
9
- SET_SCENE = "ToolEvents::setScene",
10
- GET_OBJECT = "ToolEvents::getObject",
11
- SET_OBJECT = "ToolEvents::setObject",
12
- UPDATE_OBJECT = "ToolEvents::updateObject",
13
- CREATE_TEXTURE = "ToolEvents::createTexture",
14
- REQUEST_METHOD = "ToolEvents::requestMethod",
15
- ADD_CAMERA = "ToolEvents::addCamera",
16
- REMOVE_CAMERA = "ToolEvents::removeCamera",
17
- ADD_GROUP = "ToolEvents::addGroup",
18
- REMOVE_GROUP = "ToolEvents::removeGroup",
19
- ADD_SPLINE = "ToolEvents::addSpline",
20
- ADD_RENDERER = "ToolEvents::addRenderer",
21
- UPDATE_RENDERER = "ToolEvents::updateRenderer"
22
- }
23
- export type ToolEvent = {
24
- [key in ToolEvents]: {
25
- value?: unknown;
26
- };
27
- };
28
- export declare const debugDispatcher: EventDispatcher<ToolEvent>;
1
+ import { EventDispatcher } from 'three';
2
+ export declare enum ToolEvents {
3
+ CUSTOM = "ToolEvents::custom",
4
+ SELECT_DROPDOWN = "ToolEvents::selectDropdown",
5
+ DRAG_UPDATE = "ToolEvents::dragUpdate",
6
+ ADD_SCENE = "ToolEvents::addScene",
7
+ REFRESH_SCENE = "ToolEvents::refreshScene",
8
+ REMOVE_SCENE = "ToolEvents::removeScene",
9
+ SET_SCENE = "ToolEvents::setScene",
10
+ GET_OBJECT = "ToolEvents::getObject",
11
+ SET_OBJECT = "ToolEvents::setObject",
12
+ UPDATE_OBJECT = "ToolEvents::updateObject",
13
+ CREATE_TEXTURE = "ToolEvents::createTexture",
14
+ REQUEST_METHOD = "ToolEvents::requestMethod",
15
+ ADD_CAMERA = "ToolEvents::addCamera",
16
+ REMOVE_CAMERA = "ToolEvents::removeCamera",
17
+ ADD_GROUP = "ToolEvents::addGroup",
18
+ REMOVE_GROUP = "ToolEvents::removeGroup",
19
+ ADD_SPLINE = "ToolEvents::addSpline",
20
+ ADD_RENDERER = "ToolEvents::addRenderer",
21
+ UPDATE_RENDERER = "ToolEvents::updateRenderer"
22
+ }
23
+ export type ToolEvent = {
24
+ [key in ToolEvents]: {
25
+ value?: unknown;
26
+ };
27
+ };
28
+ export declare const debugDispatcher: EventDispatcher<ToolEvent>;
@@ -1,28 +1,28 @@
1
- import { Component, ReactNode } from 'react';
2
- import RemoteThree from '@/core/remote/RemoteThree';
3
- type InspectRendererProps = {
4
- three: RemoteThree;
5
- };
6
- type InspectRendererState = {
7
- expanded: boolean;
8
- lastUpdated: number;
9
- };
10
- export default class InspectRenderer extends Component<InspectRendererProps, InspectRendererState> {
11
- private autoClear;
12
- private autoClearColor;
13
- private autoClearDepth;
14
- private autoClearStencil;
15
- private outputColorSpace;
16
- private localClippingEnabled;
17
- private clearColor;
18
- private clearAlpha;
19
- private toneMapping;
20
- private toneMappingExposure;
21
- constructor(props: InspectRendererProps);
22
- componentwillunmount(): void;
23
- private onAddRenderer;
24
- render(): ReactNode;
25
- private saveExpanded;
26
- get expandedName(): string;
27
- }
28
- export {};
1
+ import { Component, ReactNode } from 'react';
2
+ import RemoteThree from '@/core/remote/RemoteThree';
3
+ type InspectRendererProps = {
4
+ three: RemoteThree;
5
+ };
6
+ type InspectRendererState = {
7
+ expanded: boolean;
8
+ lastUpdated: number;
9
+ };
10
+ export default class InspectRenderer extends Component<InspectRendererProps, InspectRendererState> {
11
+ private autoClear;
12
+ private autoClearColor;
13
+ private autoClearDepth;
14
+ private autoClearStencil;
15
+ private outputColorSpace;
16
+ private localClippingEnabled;
17
+ private clearColor;
18
+ private clearAlpha;
19
+ private toneMapping;
20
+ private toneMappingExposure;
21
+ constructor(props: InspectRendererProps);
22
+ componentwillunmount(): void;
23
+ private onAddRenderer;
24
+ render(): ReactNode;
25
+ private saveExpanded;
26
+ get expandedName(): string;
27
+ }
28
+ export {};
@@ -1,31 +1,5 @@
1
- import { Material, Object3D, Texture, WebGLRenderer } from 'three';
2
- export declare function capitalize(value: string): string;
3
- export declare function copyToClipboard(data: any): string;
4
- export declare function clamp(min: number, max: number, value: number): number;
5
- export declare function normalize(min: number, max: number, value: number): number;
6
- export declare function mix(min: number, max: number, value: number): number;
7
- export declare function distance(x: number, y: number): number;
8
- export declare function randomID(): string;
9
- export declare function isColor(obj: any): boolean;
10
- export declare function colorToHex(obj: any): string;
11
- export declare function round(value: number, precision?: number): number;
12
- export declare let totalThreeObjects: number;
13
- export declare const resetThreeObjects: () => void;
14
- export declare const hierarchyUUID: (object: Object3D) => void;
15
- export declare const disposeTexture: (texture?: Texture) => void;
16
- export declare const disposeMaterial: (material?: Material | Material[]) => void;
17
- export declare const dispose: (object: Object3D) => void;
18
- export declare class ExportTexture {
19
- static renderer: WebGLRenderer;
20
- private static canvas;
21
- private static context;
22
- private static scene;
23
- private static camera;
24
- private static material;
25
- private static inited;
26
- private static width;
27
- private static height;
28
- private static init;
29
- static renderToBlob(texture: Texture): string;
30
- private static renderToCanvas;
31
- }
1
+ export declare function capitalize(value: string): string;
2
+ export declare function copyToClipboard(data: any): string;
3
+ export declare function randomID(): string;
4
+ export declare function isColor(obj: any): boolean;
5
+ export declare function colorToHex(obj: any): string;
package/types/index.d.ts CHANGED
@@ -1,27 +1,29 @@
1
- export * from './core/types';
2
- export * from './editor/utils';
3
- export { default as Application } from './core/Application';
4
- export { debugDispatcher, ToolEvents } from './editor/global';
5
- export { default as BaseRemote } from './core/remote/BaseRemote';
6
- export { default as RemoteComponents } from './core/remote/RemoteComponents';
7
- export * from './editor/theatreUtils';
8
- export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
9
- export { default as RemoteThree } from './core/remote/RemoteThree';
10
- export { default as NavButton } from './editor/components/NavButton';
11
- export { default as DraggableItem } from './editor/components/DraggableItem';
12
- export { default as Draggable } from './editor/components/Draggable';
13
- export { default as DropdownItem } from './editor/components/DropdownItem';
14
- export { default as Dropdown } from './editor/components/Dropdown';
15
- export { default as RemoteController } from './core/RemoteController';
16
- export { default as SidePanel } from './editor/sidePanel/SidePanel';
17
- export { default as Accordion } from './editor/sidePanel/Accordion';
18
- export { default as ChildObject } from './editor/sidePanel/ChildObject';
19
- export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
20
- export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
21
- export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
22
- export { default as MultiView } from './editor/multiView/MultiView';
23
- export { default as Editor } from './editor/Editor';
24
- export { default as ThreeEditor } from './editor/ThreeEditor';
25
- export { default as Transform } from './editor/tools/Transform';
26
- export { default as Spline } from './editor/tools/splineEditor/Spline';
27
- export { default as SplineEditor } from './editor/tools/splineEditor/index';
1
+ export * from './core/types';
2
+ export * from './editor/utils';
3
+ export * from './utils/three';
4
+ export * from './utils/detectSettings';
5
+ export { default as Application } from './core/Application';
6
+ export { debugDispatcher, ToolEvents } from './editor/global';
7
+ export { default as BaseRemote } from './core/remote/BaseRemote';
8
+ export { default as RemoteComponents } from './core/remote/RemoteComponents';
9
+ export * from './editor/theatreUtils';
10
+ export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
11
+ export { default as RemoteThree } from './core/remote/RemoteThree';
12
+ export { default as NavButton } from './editor/components/NavButton';
13
+ export { default as DraggableItem } from './editor/components/DraggableItem';
14
+ export { default as Draggable } from './editor/components/Draggable';
15
+ export { default as DropdownItem } from './editor/components/DropdownItem';
16
+ export { default as Dropdown } from './editor/components/Dropdown';
17
+ export { default as RemoteController } from './core/RemoteController';
18
+ export { default as SidePanel } from './editor/sidePanel/SidePanel';
19
+ export { default as Accordion } from './editor/sidePanel/Accordion';
20
+ export { default as ChildObject } from './editor/sidePanel/ChildObject';
21
+ export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
22
+ export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
23
+ export { default as SceneInspector } from './editor/sidePanel/inspector/SceneInspector';
24
+ export { default as MultiView } from './editor/multiView/MultiView';
25
+ export { default as Editor } from './editor/Editor';
26
+ export { default as ThreeEditor } from './editor/ThreeEditor';
27
+ export { default as Transform } from './editor/tools/Transform';
28
+ export { default as Spline } from './editor/tools/splineEditor/Spline';
29
+ export { default as SplineEditor } from './editor/tools/splineEditor/index';
@@ -0,0 +1,15 @@
1
+ export declare enum QualityType {
2
+ 'High' = 0,
3
+ 'Medium' = 1,
4
+ 'Low' = 2
5
+ }
6
+ export type AppSettings = {
7
+ dpr: number;
8
+ fps: number;
9
+ width: number;
10
+ height: number;
11
+ mobile: boolean;
12
+ supportOffScreenCanvas: boolean;
13
+ quality: QualityType;
14
+ };
15
+ export declare function detectSettings(canvas: HTMLCanvasElement): Promise<AppSettings>;
@@ -0,0 +1,5 @@
1
+ export declare function clamp(min: number, max: number, value: number): number;
2
+ export declare function normalize(min: number, max: number, value: number): number;
3
+ export declare function mix(min: number, max: number, value: number): number;
4
+ export declare function distance(x: number, y: number): number;
5
+ export declare function round(value: number, precision?: number): number;
@@ -0,0 +1,21 @@
1
+ import { Material, Object3D, Texture, WebGLRenderer } from 'three';
2
+ export declare const disposeTexture: (texture?: Texture) => void;
3
+ export declare const disposeMaterial: (material?: Material | Material[]) => void;
4
+ export declare const dispose: (object: Object3D) => void;
5
+ export declare let totalThreeObjects: number;
6
+ export declare const resetThreeObjects: () => void;
7
+ export declare const hierarchyUUID: (object: Object3D) => void;
8
+ export declare class ExportTexture {
9
+ static renderer: WebGLRenderer;
10
+ private static canvas;
11
+ private static context;
12
+ private static scene;
13
+ private static camera;
14
+ private static material;
15
+ private static inited;
16
+ private static width;
17
+ private static height;
18
+ private static init;
19
+ static renderToBlob(texture: Texture): string;
20
+ private static renderToCanvas;
21
+ }