@vulfram/engine 0.5.6-alpha
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/package.json +17 -0
- package/src/engine/api.ts +282 -0
- package/src/engine/bridge/dispatch.ts +115 -0
- package/src/engine/bridge/guards.ts +28 -0
- package/src/engine/bridge/protocol.ts +130 -0
- package/src/engine/ecs/index.ts +516 -0
- package/src/engine/errors.ts +10 -0
- package/src/engine/state.ts +135 -0
- package/src/engine/systems/command-intent.ts +74 -0
- package/src/engine/systems/core-command-builder.ts +265 -0
- package/src/engine/systems/diagnostics.ts +42 -0
- package/src/engine/systems/index.ts +7 -0
- package/src/engine/systems/input-mirror.ts +152 -0
- package/src/engine/systems/resource-upload.ts +143 -0
- package/src/engine/systems/response-decode.ts +28 -0
- package/src/engine/systems/utils.ts +147 -0
- package/src/engine/systems/world-lifecycle.ts +164 -0
- package/src/engine/world/entities.ts +516 -0
- package/src/index.ts +9 -0
- package/src/types/cmds/camera.ts +76 -0
- package/src/types/cmds/environment.ts +45 -0
- package/src/types/cmds/geometry.ts +144 -0
- package/src/types/cmds/gizmo.ts +18 -0
- package/src/types/cmds/index.ts +231 -0
- package/src/types/cmds/light.ts +69 -0
- package/src/types/cmds/material.ts +98 -0
- package/src/types/cmds/model.ts +59 -0
- package/src/types/cmds/shadow.ts +22 -0
- package/src/types/cmds/system.ts +15 -0
- package/src/types/cmds/texture.ts +63 -0
- package/src/types/cmds/window.ts +263 -0
- package/src/types/events/gamepad.ts +34 -0
- package/src/types/events/index.ts +19 -0
- package/src/types/events/keyboard.ts +225 -0
- package/src/types/events/pointer.ts +105 -0
- package/src/types/events/system.ts +13 -0
- package/src/types/events/window.ts +96 -0
- package/src/types/index.ts +3 -0
- package/src/types/kinds.ts +111 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Payload for notification system events. */
|
|
2
|
+
export interface SystemEventOnNotificationData {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Discriminated union of system-level events. */
|
|
7
|
+
export type SystemEvent =
|
|
8
|
+
| { event: 'on-resume' }
|
|
9
|
+
| { event: 'on-suspend' }
|
|
10
|
+
| { event: 'on-memory-warning' }
|
|
11
|
+
| { event: 'on-exit' }
|
|
12
|
+
| { event: 'on-notification-clicked'; data: SystemEventOnNotificationData }
|
|
13
|
+
| { event: 'on-notification-dismissed'; data: SystemEventOnNotificationData };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Payload for window create event. */
|
|
2
|
+
export interface WindowEventOnCreateData {
|
|
3
|
+
windowId: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Payload for window resize event. */
|
|
7
|
+
export interface WindowEventOnResizeData {
|
|
8
|
+
windowId: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Payload for window move event. */
|
|
14
|
+
export interface WindowEventOnMoveData {
|
|
15
|
+
windowId: number;
|
|
16
|
+
position: [number, number];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Payload for window close request event. */
|
|
20
|
+
export interface WindowEventOnCloseRequestData {
|
|
21
|
+
windowId: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Payload for window destroy event. */
|
|
25
|
+
export interface WindowEventOnDestroyData {
|
|
26
|
+
windowId: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Payload for window focus event. */
|
|
30
|
+
export interface WindowEventOnFocusData {
|
|
31
|
+
windowId: number;
|
|
32
|
+
focused: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Payload for window scale factor change event. */
|
|
36
|
+
export interface WindowEventOnScaleFactorChangeData {
|
|
37
|
+
windowId: number;
|
|
38
|
+
scaleFactor: number;
|
|
39
|
+
newWidth: number;
|
|
40
|
+
newHeight: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Payload for window occlusion event. */
|
|
44
|
+
export interface WindowEventOnOccludeData {
|
|
45
|
+
windowId: number;
|
|
46
|
+
occluded: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Payload for window redraw request event. */
|
|
50
|
+
export interface WindowEventOnRedrawRequestData {
|
|
51
|
+
windowId: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Payload for file drop event. */
|
|
55
|
+
export interface WindowEventOnFileDropData {
|
|
56
|
+
windowId: number;
|
|
57
|
+
path: string;
|
|
58
|
+
position: [number, number];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Payload for file hover event. */
|
|
62
|
+
export interface WindowEventOnFileHoverData {
|
|
63
|
+
windowId: number;
|
|
64
|
+
path: string;
|
|
65
|
+
position: [number, number];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Payload for file hover cancel event. */
|
|
69
|
+
export interface WindowEventOnFileHoverCancelData {
|
|
70
|
+
windowId: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Payload for theme change event. */
|
|
74
|
+
export interface WindowEventOnThemeChangeData {
|
|
75
|
+
windowId: number;
|
|
76
|
+
darkMode: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Discriminated union of window events. */
|
|
80
|
+
export type WindowEvent =
|
|
81
|
+
| { event: 'on-create'; data: WindowEventOnCreateData }
|
|
82
|
+
| { event: 'on-resize'; data: WindowEventOnResizeData }
|
|
83
|
+
| { event: 'on-move'; data: WindowEventOnMoveData }
|
|
84
|
+
| { event: 'on-close-request'; data: WindowEventOnCloseRequestData }
|
|
85
|
+
| { event: 'on-destroy'; data: WindowEventOnDestroyData }
|
|
86
|
+
| { event: 'on-focus'; data: WindowEventOnFocusData }
|
|
87
|
+
| {
|
|
88
|
+
event: 'on-scale-factor-change';
|
|
89
|
+
data: WindowEventOnScaleFactorChangeData;
|
|
90
|
+
}
|
|
91
|
+
| { event: 'on-occlude'; data: WindowEventOnOccludeData }
|
|
92
|
+
| { event: 'on-redraw-request'; data: WindowEventOnRedrawRequestData }
|
|
93
|
+
| { event: 'on-file-drop'; data: WindowEventOnFileDropData }
|
|
94
|
+
| { event: 'on-file-hover'; data: WindowEventOnFileHoverData }
|
|
95
|
+
| { event: 'on-file-hover-cancel'; data: WindowEventOnFileHoverCancelData }
|
|
96
|
+
| { event: 'on-theme-change'; data: WindowEventOnThemeChangeData };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** Camera projection mode. */
|
|
2
|
+
export type CameraKind = 'perspective' | 'orthographic';
|
|
3
|
+
|
|
4
|
+
/** Standard cursor icons. */
|
|
5
|
+
export type CursorIcon =
|
|
6
|
+
| 'default'
|
|
7
|
+
| 'context-menu'
|
|
8
|
+
| 'help'
|
|
9
|
+
| 'pointer'
|
|
10
|
+
| 'progress'
|
|
11
|
+
| 'wait'
|
|
12
|
+
| 'cell'
|
|
13
|
+
| 'crosshair'
|
|
14
|
+
| 'text'
|
|
15
|
+
| 'vertical-text'
|
|
16
|
+
| 'alias'
|
|
17
|
+
| 'copy'
|
|
18
|
+
| 'move'
|
|
19
|
+
| 'no-drop'
|
|
20
|
+
| 'not-allowed'
|
|
21
|
+
| 'grab'
|
|
22
|
+
| 'grabbing'
|
|
23
|
+
| 'e-resize'
|
|
24
|
+
| 'n-resize'
|
|
25
|
+
| 'ne-resize'
|
|
26
|
+
| 'nw-resize'
|
|
27
|
+
| 's-resize'
|
|
28
|
+
| 'se-resize'
|
|
29
|
+
| 'sw-resize'
|
|
30
|
+
| 'w-resize'
|
|
31
|
+
| 'ew-resize'
|
|
32
|
+
| 'ns-resize'
|
|
33
|
+
| 'nesw-resize'
|
|
34
|
+
| 'nwse-resize'
|
|
35
|
+
| 'col-resize'
|
|
36
|
+
| 'row-resize'
|
|
37
|
+
| 'all-scroll'
|
|
38
|
+
| 'zoom-in'
|
|
39
|
+
| 'zoom-out';
|
|
40
|
+
|
|
41
|
+
/** Press state for input events. */
|
|
42
|
+
export type ElementState = 'released' | 'pressed';
|
|
43
|
+
|
|
44
|
+
/** Light source type. */
|
|
45
|
+
export type LightKind =
|
|
46
|
+
| 'directional'
|
|
47
|
+
| 'point'
|
|
48
|
+
| 'spot'
|
|
49
|
+
| 'ambient'
|
|
50
|
+
| 'hemisphere';
|
|
51
|
+
|
|
52
|
+
/** Material shading model. */
|
|
53
|
+
export type MaterialKind = 'standard' | 'pbr';
|
|
54
|
+
|
|
55
|
+
/** Notification severity level. */
|
|
56
|
+
export type NotificationLevel = 'info' | 'warning' | 'error' | 'success';
|
|
57
|
+
|
|
58
|
+
/** Built-in primitive geometry shapes. */
|
|
59
|
+
export type PrimitiveShape =
|
|
60
|
+
| 'cube'
|
|
61
|
+
| 'plane'
|
|
62
|
+
| 'sphere'
|
|
63
|
+
| 'cylinder'
|
|
64
|
+
| 'torus'
|
|
65
|
+
| 'pyramid';
|
|
66
|
+
|
|
67
|
+
/** Texture sampler presets. */
|
|
68
|
+
export type SamplerMode =
|
|
69
|
+
| 'point-clamp'
|
|
70
|
+
| 'linear-clamp'
|
|
71
|
+
| 'point-repeat'
|
|
72
|
+
| 'linear-repeat';
|
|
73
|
+
|
|
74
|
+
/** Mesh shading model identifier. */
|
|
75
|
+
export type ShadeModel = 'standard' | 'pbr';
|
|
76
|
+
|
|
77
|
+
/** Texture allocation strategy. */
|
|
78
|
+
export type TextureCreateMode = 'standalone' | 'forward-atlas';
|
|
79
|
+
|
|
80
|
+
/** Touch interaction phase. */
|
|
81
|
+
export type TouchPhase = 'started' | 'moved' | 'ended' | 'cancelled';
|
|
82
|
+
|
|
83
|
+
/** Material transparency mode. */
|
|
84
|
+
export type TransparencyMode = 'opaque' | 'masked' | 'transparent';
|
|
85
|
+
|
|
86
|
+
/** Upload payload types for buffer transfers. */
|
|
87
|
+
export type UploadType =
|
|
88
|
+
| 'raw'
|
|
89
|
+
| 'shader-source'
|
|
90
|
+
| 'geometry-data'
|
|
91
|
+
| 'vertex-data'
|
|
92
|
+
| 'index-data'
|
|
93
|
+
| 'image-data'
|
|
94
|
+
| 'binary-asset';
|
|
95
|
+
|
|
96
|
+
/** Skybox rendering mode. */
|
|
97
|
+
export type SkyboxMode = 'none' | 'procedural' | 'cubemap';
|
|
98
|
+
|
|
99
|
+
/** Window state transitions. */
|
|
100
|
+
export type WindowState =
|
|
101
|
+
| 'minimized'
|
|
102
|
+
| 'maximized'
|
|
103
|
+
| 'windowed'
|
|
104
|
+
| 'fullscreen'
|
|
105
|
+
| 'windowed-fullscreen';
|
|
106
|
+
|
|
107
|
+
/** Cursor grab behavior. */
|
|
108
|
+
export type CursorGrabMode = 'none' | 'confined' | 'locked';
|
|
109
|
+
|
|
110
|
+
/** User attention request type. */
|
|
111
|
+
export type UserAttentionType = 'critical' | 'informational';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "Preserve",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noImplicitOverride": true,
|
|
23
|
+
|
|
24
|
+
// Some stricter flags (disabled by default)
|
|
25
|
+
"noUnusedLocals": false,
|
|
26
|
+
"noUnusedParameters": false,
|
|
27
|
+
"noPropertyAccessFromIndexSignature": false
|
|
28
|
+
}
|
|
29
|
+
}
|