@umituz/web-virtual 0.0.0-stage → 1.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 umituz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,64 @@
1
- # Temporary Holding Version
1
+ # @umituz/web-virtual
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Universal 3D Virtual Environment Engine for Web and React.
4
+
5
+ Build realistic, high-performance, interactive 3D virtual offices, farms, industrial factories, schools, and hospitals with locked 60fps rendering, raycasting, and contextual inspectors.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - **Universal Engine**: Agnostic to domain (Corporate Offices, Agriculture, Automation Factories, Campus, Healthcare).
12
+ - **Locked 60 FPS Performance**: Direct GPU CSS `translate3d` projection for floating labels and pins without React state re-rendering overhead during orbit/zoom.
13
+ - **Interactive Entities & Raycasting**: Click and hover directly on 3D desks, monitors, robots, or avatars.
14
+ - **Architectural Presets**:
15
+ - `officePreset`: 17-desk architectural floorplan with executive suite, meeting room, and glass partitions.
16
+ - `farmPreset`: Greenhouses, crops, barns, tractors.
17
+ - `factoryPreset`: Conveyor belts, robotic arms, storage racks.
18
+ - `schoolPreset`: Lecture halls, interactive smartboards, science labs.
19
+ - `hospitalPreset`: Triage rooms, consultation suites, patient monitoring.
20
+ - **Contextual Inspector**: Slide-out drawer displaying role, status, metadata, and custom application actions.
21
+ - **Day & Night Simulation**: One-click smooth lighting transitions.
22
+ - **Pin & Label Modes**: Minimal 28px circular pins (`#1`..`#17`) with status indicators, expandable chips, or hidden mode.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm install @umituz/web-virtual three lucide-react
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```tsx
35
+ import {
36
+ VirtualWorld,
37
+ createEnvironment,
38
+ officePreset,
39
+ } from '@umituz/web-virtual'
40
+ import '@umituz/web-virtual/styles.css'
41
+
42
+ export function MyOfficePage() {
43
+ const world = createEnvironment({
44
+ preset: officePreset,
45
+ name: 'Acme Corp HQ',
46
+ })
47
+
48
+ return (
49
+ <div style={{ width: '100vw', height: '100vh' }}>
50
+ <VirtualWorld
51
+ world={world}
52
+ preset={officePreset}
53
+ onSelectEntity={(entity) => console.log('Selected:', entity)}
54
+ />
55
+ </div>
56
+ )
57
+ }
58
+ ```
59
+
60
+ ---
61
+
62
+ ## License
63
+
64
+ MIT © umituz
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@umituz/web-virtual",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Universal 3D Virtual Environment Engine for Web & React — Offices, Farms, Factories, Schools, Hospitals with 60fps performance, raycasting and interactive entities.",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts",
8
+ "sideEffects": [
9
+ "*.css"
10
+ ],
11
+ "exports": {
12
+ ".": "./src/index.ts",
13
+ "./core": "./src/core/index.ts",
14
+ "./engine": "./src/engine/index.ts",
15
+ "./entities": "./src/entities/index.ts",
16
+ "./presets": "./src/presets/index.ts",
17
+ "./components": "./src/components/index.ts",
18
+ "./styles.css": "./src/styles/virtual.css",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "src",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "scripts": {
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "version:patch": "npm version patch -m 'chore: release v%s'",
32
+ "version:minor": "npm version minor -m 'chore: release v%s'",
33
+ "version:major": "npm version major -m 'chore: release v%s'"
34
+ },
35
+ "peerDependencies": {
36
+ "react": ">=18.0.0 || ^19.0.0",
37
+ "react-dom": ">=18.0.0 || ^19.0.0"
38
+ },
39
+ "dependencies": {
40
+ "lucide-react": "^0.577.0",
41
+ "three": "^0.187.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^22.13.0",
45
+ "@types/react": "^19.0.0",
46
+ "@types/react-dom": "^19.0.0",
47
+ "@types/three": "^0.187.0",
48
+ "react": "^19.0.0",
49
+ "react-dom": "^19.0.0",
50
+ "typescript": "^5.7.3",
51
+ "vitest": "^3.0.5"
52
+ },
53
+ "keywords": [
54
+ "3d",
55
+ "threejs",
56
+ "virtual-environment",
57
+ "virtual-office",
58
+ "digital-hq",
59
+ "interactive-world",
60
+ "digital-twin",
61
+ "react",
62
+ "typescript",
63
+ "simulation",
64
+ "isometric",
65
+ "metaverse"
66
+ ],
67
+ "author": "umituz",
68
+ "license": "MIT",
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "git+https://github.com/umituz/web-virtual.git"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/umituz/web-virtual/issues"
78
+ },
79
+ "homepage": "https://github.com/umituz/web-virtual#readme"
80
+ }
@@ -0,0 +1,224 @@
1
+ import { type ReactNode, useEffect } from 'react'
2
+ import { X, Focus, Play, CheckCircle2, AlertCircle, Clock, ChevronRight } from 'lucide-react'
3
+ import type { WorldEntity } from '../core/types'
4
+
5
+ export interface EntityInspectorProps {
6
+ entity: WorldEntity | null
7
+ onClose: () => void
8
+ onFocusEntity?: (entity: WorldEntity) => void
9
+ renderCustomActions?: (entity: WorldEntity) => ReactNode
10
+ renderCustomContent?: (entity: WorldEntity) => ReactNode
11
+ }
12
+
13
+ export function EntityInspector({
14
+ entity,
15
+ onClose,
16
+ onFocusEntity,
17
+ renderCustomActions,
18
+ renderCustomContent,
19
+ }: EntityInspectorProps): ReactNode {
20
+ useEffect(() => {
21
+ const handleKeyDown = (e: KeyboardEvent) => {
22
+ if (e.key === 'Escape') onClose()
23
+ }
24
+ window.addEventListener('keydown', handleKeyDown)
25
+ return () => window.removeEventListener('keydown', handleKeyDown)
26
+ }, [onClose])
27
+
28
+ if (!entity) return null
29
+
30
+ const isPerson = entity.type === 'person' || entity.type === 'actor'
31
+ const isRunning = entity.status === 'running' || entity.status === 'working'
32
+
33
+ return (
34
+ <div
35
+ style={{
36
+ position: 'absolute',
37
+ top: 14,
38
+ left: 14,
39
+ width: 320,
40
+ maxHeight: 'calc(100% - 28px)',
41
+ backgroundColor: 'rgba(15, 23, 42, 0.92)',
42
+ backdropFilter: 'blur(16px)',
43
+ border: '1px solid rgba(255, 255, 255, 0.14)',
44
+ borderRadius: 12,
45
+ boxShadow: '0 16px 36px rgba(0, 0, 0, 0.45)',
46
+ zIndex: 50,
47
+ display: 'flex',
48
+ flexDirection: 'column',
49
+ overflow: 'hidden',
50
+ color: '#f8fafc',
51
+ fontFamily: 'inherit',
52
+ }}
53
+ >
54
+ {/* Header */}
55
+ <div
56
+ style={{
57
+ display: 'flex',
58
+ alignItems: 'center',
59
+ justifyContent: 'space-between',
60
+ padding: '12px 14px',
61
+ borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
62
+ }}
63
+ >
64
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
65
+ <span
66
+ style={{
67
+ fontSize: 11,
68
+ fontWeight: 700,
69
+ padding: '2px 8px',
70
+ borderRadius: 999,
71
+ backgroundColor: 'rgba(59, 130, 246, 0.2)',
72
+ color: '#60a5fa',
73
+ border: '1px solid rgba(59, 130, 246, 0.3)',
74
+ }}
75
+ >
76
+ {entity.pinNumber ? `#${entity.pinNumber}` : entity.type.toUpperCase()}
77
+ </span>
78
+ <span style={{ fontSize: 13, fontWeight: 600 }}>{entity.name}</span>
79
+ </div>
80
+
81
+ <button
82
+ type="button"
83
+ onClick={onClose}
84
+ style={{
85
+ background: 'none',
86
+ border: 'none',
87
+ color: '#94a3b8',
88
+ cursor: 'pointer',
89
+ padding: 4,
90
+ display: 'flex',
91
+ alignItems: 'center',
92
+ justifyContent: 'center',
93
+ borderRadius: 6,
94
+ }}
95
+ title="Kapat (Esc)"
96
+ >
97
+ <X size={16} />
98
+ </button>
99
+ </div>
100
+
101
+ {/* Body */}
102
+ <div style={{ padding: 14, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 12 }}>
103
+ {/* Role & Department */}
104
+ <div>
105
+ <div style={{ fontSize: 13, fontWeight: 500, color: '#e2e8f0' }}>{entity.role || 'Varlık'}</div>
106
+ {entity.department && (
107
+ <div style={{ fontSize: 11, color: '#94a3b8', marginTop: 2 }}>
108
+ Departman: {entity.department}
109
+ </div>
110
+ )}
111
+ </div>
112
+
113
+ {/* Status Badge */}
114
+ <div
115
+ style={{
116
+ display: 'inline-flex',
117
+ alignItems: 'center',
118
+ gap: 6,
119
+ padding: '4px 10px',
120
+ borderRadius: 8,
121
+ backgroundColor: isRunning ? 'rgba(59, 130, 246, 0.15)' : 'rgba(34, 197, 94, 0.15)',
122
+ border: `1px solid ${isRunning ? 'rgba(59, 130, 246, 0.3)' : 'rgba(34, 197, 94, 0.3)'}`,
123
+ alignSelf: 'flex-start',
124
+ }}
125
+ >
126
+ <span className={`wv-status-pip ${entity.status || 'idle'}`} />
127
+ <span
128
+ style={{
129
+ fontSize: 11,
130
+ fontWeight: 600,
131
+ color: isRunning ? '#60a5fa' : '#4ade80',
132
+ textTransform: 'capitalize',
133
+ }}
134
+ >
135
+ {entity.status === 'running' || entity.status === 'working'
136
+ ? 'Görev Yürütülüyor'
137
+ : entity.status === 'awaiting_approval'
138
+ ? 'Onay Bekliyor'
139
+ : 'Hazır / Boşta'}
140
+ </span>
141
+ </div>
142
+
143
+ {/* Description */}
144
+ {entity.description && (
145
+ <p style={{ fontSize: 12, color: '#cbd5e1', lineHeight: 1.45, margin: 0 }}>
146
+ {entity.description}
147
+ </p>
148
+ )}
149
+
150
+ {/* Custom Application Content */}
151
+ {renderCustomContent && renderCustomContent(entity)}
152
+
153
+ {/* Metadata items if present */}
154
+ {entity.metadata && Object.keys(entity.metadata).length > 0 && (
155
+ <div
156
+ style={{
157
+ padding: 10,
158
+ borderRadius: 8,
159
+ backgroundColor: 'rgba(255, 255, 255, 0.04)',
160
+ border: '1px solid rgba(255, 255, 255, 0.08)',
161
+ fontSize: 11,
162
+ }}
163
+ >
164
+ <div style={{ fontWeight: 600, color: '#94a3b8', marginBottom: 6 }}>ÖZELLİKLER</div>
165
+ {Object.entries(entity.metadata).map(([k, v]) => (
166
+ <div
167
+ key={k}
168
+ style={{
169
+ display: 'flex',
170
+ justifyContent: 'space-between',
171
+ padding: '3px 0',
172
+ borderBottom: '1px solid rgba(255, 255, 255, 0.04)',
173
+ }}
174
+ >
175
+ <span style={{ color: '#94a3b8' }}>{k}:</span>
176
+ <span style={{ color: '#f1f5f9', fontWeight: 500 }}>
177
+ {typeof v === 'object' ? JSON.stringify(v) : String(v)}
178
+ </span>
179
+ </div>
180
+ ))}
181
+ </div>
182
+ )}
183
+ </div>
184
+
185
+ {/* Footer / Actions */}
186
+ <div
187
+ style={{
188
+ padding: 12,
189
+ borderTop: '1px solid rgba(255, 255, 255, 0.08)',
190
+ display: 'flex',
191
+ flexDirection: 'column',
192
+ gap: 6,
193
+ }}
194
+ >
195
+ {onFocusEntity && (
196
+ <button
197
+ type="button"
198
+ onClick={() => onFocusEntity(entity)}
199
+ style={{
200
+ display: 'flex',
201
+ alignItems: 'center',
202
+ justifyContent: 'center',
203
+ gap: 6,
204
+ width: '100%',
205
+ height: 32,
206
+ borderRadius: 8,
207
+ backgroundColor: 'rgba(255, 255, 255, 0.08)',
208
+ border: '1px solid rgba(255, 255, 255, 0.15)',
209
+ color: '#f8fafc',
210
+ fontSize: 12,
211
+ fontWeight: 500,
212
+ cursor: 'pointer',
213
+ }}
214
+ >
215
+ <Focus size={14} />
216
+ 3D Kamerayı Odakla
217
+ </button>
218
+ )}
219
+
220
+ {renderCustomActions && renderCustomActions(entity)}
221
+ </div>
222
+ </div>
223
+ )
224
+ }
@@ -0,0 +1,67 @@
1
+ import { type ReactNode, useEffect, useRef } from 'react'
2
+ import type { WorldEntity, PinDisplayMode } from '../core/types'
3
+
4
+ export interface EntityPinsProps {
5
+ entities: WorldEntity[]
6
+ mode: PinDisplayMode
7
+ selectedEntityId?: string | null
8
+ onSelectEntity: (entity: WorldEntity) => void
9
+ onRegisterElement: (entityId: string, el: HTMLElement | null) => void
10
+ }
11
+
12
+ export function EntityPins({
13
+ entities,
14
+ mode,
15
+ selectedEntityId,
16
+ onSelectEntity,
17
+ onRegisterElement,
18
+ }: EntityPinsProps): ReactNode {
19
+ if (mode === 'off') return null
20
+
21
+ return (
22
+ <div className="wv-pins-overlay" aria-hidden="true">
23
+ {entities.map((entity) => {
24
+ const isSelected = selectedEntityId === entity.id
25
+ const isRunning = entity.status === 'running' || entity.status === 'working'
26
+ const pinText = entity.pinNumber ? `#${entity.pinNumber}` : entity.name.slice(0, 3)
27
+
28
+ return (
29
+ <div
30
+ key={entity.id}
31
+ ref={(el) => onRegisterElement(entity.id, el)}
32
+ className="wv-pin-anchor"
33
+ style={{ display: 'none' }} // initially hidden until projector places it
34
+ >
35
+ {mode === 'pins' && !isSelected && !isRunning ? (
36
+ <button
37
+ type="button"
38
+ className={`wv-pin-circle ${isSelected ? 'is-selected' : ''}`}
39
+ onClick={(e) => {
40
+ e.stopPropagation()
41
+ onSelectEntity(entity)
42
+ }}
43
+ title={`${entity.name} (${entity.role || entity.type})`}
44
+ >
45
+ <span className={`wv-status-pip ${entity.status || 'idle'}`} />
46
+ <span>{pinText}</span>
47
+ </button>
48
+ ) : (
49
+ <button
50
+ type="button"
51
+ className={`wv-pin-chip ${isSelected ? 'is-selected' : ''}`}
52
+ onClick={(e) => {
53
+ e.stopPropagation()
54
+ onSelectEntity(entity)
55
+ }}
56
+ >
57
+ <span className={`wv-status-pip ${entity.status || 'idle'}`} />
58
+ <span style={{ fontWeight: 700 }}>{pinText}</span>
59
+ <span>{entity.pinLabel || entity.name}</span>
60
+ </button>
61
+ )}
62
+ </div>
63
+ )
64
+ })}
65
+ </div>
66
+ )
67
+ }
@@ -0,0 +1,229 @@
1
+ import {
2
+ type ReactNode,
3
+ useEffect,
4
+ useRef,
5
+ useState,
6
+ useCallback,
7
+ } from 'react'
8
+ import * as THREE from 'three'
9
+ import type {
10
+ WorldDefinition,
11
+ WorldEntity,
12
+ WorldPreset,
13
+ PinDisplayMode,
14
+ EntitySelectedEvent,
15
+ } from '../core/types'
16
+ import { WorldEngine } from '../engine/renderer'
17
+ import { createStylizedAvatar } from '../entities/people/AvatarBuilder'
18
+ import { EntityPins } from './EntityPins'
19
+ import { WorldControls } from './WorldControls'
20
+ import { EntityInspector } from './EntityInspector'
21
+ import type { CameraPresetName } from '../engine/camera'
22
+
23
+ export interface VirtualWorldProps {
24
+ world: WorldDefinition
25
+ preset?: WorldPreset
26
+ selectedEntityId?: string | null
27
+ onSelectEntity?: (entity: WorldEntity | null) => void
28
+ onHoverEntity?: (entity: WorldEntity | null) => void
29
+ defaultPinMode?: PinDisplayMode
30
+ showControls?: boolean
31
+ showInspector?: boolean
32
+ className?: string
33
+ style?: React.CSSProperties
34
+ children?: ReactNode
35
+ renderCustomInspectorContent?: (entity: WorldEntity) => ReactNode
36
+ renderCustomInspectorActions?: (entity: WorldEntity) => ReactNode
37
+ }
38
+
39
+ export function VirtualWorld({
40
+ world,
41
+ preset,
42
+ selectedEntityId,
43
+ onSelectEntity,
44
+ onHoverEntity,
45
+ defaultPinMode = 'pins',
46
+ showControls = true,
47
+ showInspector = true,
48
+ className = '',
49
+ style,
50
+ children,
51
+ renderCustomInspectorContent,
52
+ renderCustomInspectorActions,
53
+ }: VirtualWorldProps): ReactNode {
54
+ const containerRef = useRef<HTMLDivElement>(null)
55
+ const canvasRef = useRef<HTMLCanvasElement>(null)
56
+ const engineRef = useRef<WorldEngine | null>(null)
57
+ const pinElementsRef = useRef<Map<string, HTMLElement>>(new Map())
58
+
59
+ const [nightMode, setNightMode] = useState(false)
60
+ const [pinMode, setPinMode] = useState<PinDisplayMode>(defaultPinMode)
61
+ const [fps, setFps] = useState<number>(60)
62
+ const [internalSelectedEntity, setInternalSelectedEntity] = useState<WorldEntity | null>(null)
63
+
64
+ // Determine active selected entity (controlled or uncontrolled)
65
+ const activeEntity =
66
+ selectedEntityId !== undefined
67
+ ? world.entities.find((e) => e.id === selectedEntityId) || null
68
+ : internalSelectedEntity
69
+
70
+ const handleSelectEntity = useCallback(
71
+ (entity: WorldEntity | null) => {
72
+ setInternalSelectedEntity(entity)
73
+ if (onSelectEntity) {
74
+ onSelectEntity(entity)
75
+ }
76
+ },
77
+ [onSelectEntity],
78
+ )
79
+
80
+ const handleRegisterPinElement = useCallback((entityId: string, el: HTMLElement | null) => {
81
+ if (el) {
82
+ pinElementsRef.current.set(entityId, el)
83
+ } else {
84
+ pinElementsRef.current.delete(entityId)
85
+ }
86
+ }, [])
87
+
88
+ // Initialize Three.js Engine
89
+ useEffect(() => {
90
+ const canvas = canvasRef.current
91
+ const container = containerRef.current
92
+ if (!canvas || !container) return
93
+
94
+ const engine = new WorldEngine({
95
+ canvas,
96
+ world,
97
+ pinElements: pinElementsRef.current,
98
+ onSelectEntity: (evt) => {
99
+ handleSelectEntity(evt.entity)
100
+ },
101
+ onHoverEntity: (entity) => {
102
+ if (onHoverEntity) onHoverEntity(entity)
103
+ },
104
+ onFpsUpdate: (currentFps) => {
105
+ setFps(currentFps)
106
+ },
107
+ })
108
+ engineRef.current = engine
109
+
110
+ // 1. Build environment from preset or custom scene builder
111
+ const activePreset = preset
112
+ if (activePreset && activePreset.buildScene) {
113
+ activePreset.buildScene(engine.scene, {
114
+ nightMode,
115
+ theme: world.theme,
116
+ })
117
+ }
118
+
119
+ // 2. Build 3D Avatars for people/actor entities
120
+ const avatarGroup = new THREE.Group()
121
+ avatarGroup.name = 'world-avatars'
122
+
123
+ for (const entity of world.entities) {
124
+ if (entity.type === 'person' || entity.type === 'actor') {
125
+ const { group, animate } = createStylizedAvatar(entity, engine.materials)
126
+ avatarGroup.add(group)
127
+ engine.animators.push(animate)
128
+ engine.interactiveObjects.push(group)
129
+ }
130
+ }
131
+ engine.scene.add(avatarGroup)
132
+
133
+ // Resize Observer
134
+ const resizeObserver = new ResizeObserver((entries) => {
135
+ for (const entry of entries) {
136
+ const { width, height } = entry.contentRect
137
+ if (width > 0 && height > 0) {
138
+ engine.resize(width, height)
139
+ }
140
+ }
141
+ })
142
+ resizeObserver.observe(container)
143
+
144
+ return () => {
145
+ resizeObserver.disconnect()
146
+ engine.dispose()
147
+ engineRef.current = null
148
+ pinElementsRef.current.clear()
149
+ }
150
+ }, [world, preset, handleSelectEntity, onHoverEntity])
151
+
152
+ // Handle Night Mode Toggle
153
+ const handleToggleNightMode = useCallback(() => {
154
+ setNightMode((prev) => {
155
+ const next = !prev
156
+ if (engineRef.current) {
157
+ engineRef.current.setNightMode(next)
158
+ }
159
+ return next
160
+ })
161
+ }, [])
162
+
163
+ // Handle Camera Presets
164
+ const handleCameraPreset = useCallback((presetName: CameraPresetName) => {
165
+ if (engineRef.current) {
166
+ engineRef.current.setCameraPreset(presetName)
167
+ }
168
+ }, [])
169
+
170
+ const handleResetCamera = useCallback(() => {
171
+ if (engineRef.current) {
172
+ engineRef.current.resetCamera()
173
+ }
174
+ }, [])
175
+
176
+ const handleFocusEntity = useCallback((entity: WorldEntity) => {
177
+ if (engineRef.current) {
178
+ engineRef.current.focusOnEntity(entity.id)
179
+ }
180
+ }, [])
181
+
182
+ return (
183
+ <div
184
+ ref={containerRef}
185
+ className={`wv-container ${className}`}
186
+ style={style}
187
+ role="region"
188
+ aria-label={`${world.name} 3D Sanal Ortamı`}
189
+ >
190
+ <canvas ref={canvasRef} className="wv-canvas" />
191
+
192
+ {/* Floating 60fps GPU Projected Pins */}
193
+ <EntityPins
194
+ entities={world.entities}
195
+ mode={pinMode}
196
+ selectedEntityId={activeEntity?.id}
197
+ onSelectEntity={handleSelectEntity}
198
+ onRegisterElement={handleRegisterPinElement}
199
+ />
200
+
201
+ {/* Floating View Controls */}
202
+ {showControls && (
203
+ <WorldControls
204
+ nightMode={nightMode}
205
+ onToggleNightMode={handleToggleNightMode}
206
+ pinMode={pinMode}
207
+ onChangePinMode={setPinMode}
208
+ onSelectCameraPreset={handleCameraPreset}
209
+ onResetCamera={handleResetCamera}
210
+ fps={fps}
211
+ />
212
+ )}
213
+
214
+ {/* Slide-out Entity Contextual Inspector */}
215
+ {showInspector && activeEntity && (
216
+ <EntityInspector
217
+ entity={activeEntity}
218
+ onClose={() => handleSelectEntity(null)}
219
+ onFocusEntity={handleFocusEntity}
220
+ renderCustomContent={renderCustomInspectorContent}
221
+ renderCustomActions={renderCustomInspectorActions}
222
+ />
223
+ )}
224
+
225
+ {/* Consumer UI Overlays (e.g., bottom dispatch bar, top mode switcher) */}
226
+ {children}
227
+ </div>
228
+ )
229
+ }