@2112-lab/central-plant 0.1.1 → 0.1.3
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/dist/bundle/index.js +1 -15140
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -353
- package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1292
- package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1543
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4374
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -465
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -117
- package/dist/cjs/src/animationManager.js +1 -121
- package/dist/cjs/src/componentManager.js +1 -151
- package/dist/cjs/src/debugLogger.js +1 -176
- package/dist/cjs/src/disposalManager.js +1 -185
- package/dist/cjs/src/environmentManager.js +1 -1308
- package/dist/cjs/src/hotReloadManager.js +1 -252
- package/dist/cjs/src/index.js +1 -128
- package/dist/cjs/src/keyboardControlsManager.js +1 -206
- package/dist/cjs/src/nameUtils.js +1 -106
- package/dist/cjs/src/pathfindingManager.js +1 -321
- package/dist/cjs/src/performanceMonitor.js +1 -718
- package/dist/cjs/src/sceneExportManager.js +1 -292
- package/dist/cjs/src/sceneInitializationManager.js +1 -540
- package/dist/cjs/src/textureConfig.js +1 -624
- package/dist/cjs/src/transformControlsManager.js +1 -851
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -328
- package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1287
- package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1537
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4370
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -461
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -113
- package/dist/esm/src/animationManager.js +1 -112
- package/dist/esm/src/componentManager.js +1 -123
- package/dist/esm/src/debugLogger.js +1 -167
- package/dist/esm/src/disposalManager.js +1 -155
- package/dist/esm/src/environmentManager.js +1 -1282
- package/dist/esm/src/hotReloadManager.js +1 -244
- package/dist/esm/src/index.js +1 -118
- package/dist/esm/src/keyboardControlsManager.js +1 -196
- package/dist/esm/src/nameUtils.js +1 -99
- package/dist/esm/src/pathfindingManager.js +1 -295
- package/dist/esm/src/performanceMonitor.js +1 -712
- package/dist/esm/src/sceneExportManager.js +1 -286
- package/dist/esm/src/sceneInitializationManager.js +1 -513
- package/dist/esm/src/textureConfig.js +1 -595
- package/dist/esm/src/transformControlsManager.js +1 -827
- package/dist/index.d.ts +0 -4
- package/package.json +1 -1
- package/dist/cjs/src/ConnectionManager.js +0 -114
- package/dist/cjs/src/Pathfinder.js +0 -88
- package/dist/cjs/src/modelPreloader.js +0 -488
- package/dist/cjs/src/sceneOperationsManager.js +0 -596
- package/dist/esm/src/ConnectionManager.js +0 -110
- package/dist/esm/src/Pathfinder.js +0 -84
- package/dist/esm/src/modelPreloader.js +0 -464
- package/dist/esm/src/sceneOperationsManager.js +0 -572
|
@@ -1,244 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hot-Reload Manager Module
|
|
5
|
-
* Handles development environment hot-reload detection and cleanup
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Check if we're in a browser environment
|
|
9
|
-
var isBrowser = typeof window !== 'undefined';
|
|
10
|
-
var isDev = isBrowser && process.env.NODE_ENV === 'development';
|
|
11
|
-
var HotReloadManager = /*#__PURE__*/function () {
|
|
12
|
-
function HotReloadManager(componentInstance) {
|
|
13
|
-
_classCallCheck(this, HotReloadManager);
|
|
14
|
-
this.component = componentInstance;
|
|
15
|
-
this.isDev = isDev;
|
|
16
|
-
this.instanceId = Date.now() + Math.random();
|
|
17
|
-
|
|
18
|
-
// Event handlers
|
|
19
|
-
this.hotReloadCleanupHandler = null;
|
|
20
|
-
this.visibilityChangeHandler = null;
|
|
21
|
-
this.nuxtHotReloadHandler = null;
|
|
22
|
-
this.memoryCheckInterval = null;
|
|
23
|
-
|
|
24
|
-
// Async operation tracking
|
|
25
|
-
this.timeoutIds = new Set();
|
|
26
|
-
this.intervalIds = new Set();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Setup hot-reload handling for development environment
|
|
31
|
-
*/
|
|
32
|
-
return _createClass(HotReloadManager, [{
|
|
33
|
-
key: "setupHotReloadHandling",
|
|
34
|
-
value: function setupHotReloadHandling() {
|
|
35
|
-
var _this = this;
|
|
36
|
-
if (!isBrowser || !this.isDev) {
|
|
37
|
-
console.log('Not in browser or development mode, skipping hot-reload setup');
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
console.log('Setting up hot-reload handling...');
|
|
41
|
-
|
|
42
|
-
// Initialize global instance tracking
|
|
43
|
-
if (!window._sceneViewerInstances) {
|
|
44
|
-
window._sceneViewerInstances = new Set();
|
|
45
|
-
console.log('🔧 [Hot-Reload] Initialized global instance tracking');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Add this instance to global tracking
|
|
49
|
-
window._sceneViewerInstances.add(this.component);
|
|
50
|
-
console.log('📍 [Hot-Reload] Instance registered:', {
|
|
51
|
-
instanceId: this.instanceId,
|
|
52
|
-
totalInstances: window._sceneViewerInstances.size
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// Enhanced beforeunload handler for development
|
|
56
|
-
this.hotReloadCleanupHandler = function () {
|
|
57
|
-
console.log('🔄 [Hot-Reload] Page unload detected, performing enhanced cleanup');
|
|
58
|
-
if (_this.component && typeof _this.component.enhancedDisposal === 'function') {
|
|
59
|
-
_this.component.enhancedDisposal();
|
|
60
|
-
}
|
|
61
|
-
if (window._sceneViewerInstances) {
|
|
62
|
-
window._sceneViewerInstances.delete(_this.component);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Add event listeners
|
|
67
|
-
window.addEventListener('beforeunload', this.hotReloadCleanupHandler);
|
|
68
|
-
window.addEventListener('pagehide', this.hotReloadCleanupHandler);
|
|
69
|
-
console.log('✅ [Hot-Reload] Hot-reload handling setup completed');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Cleanup hot-reload handlers (development only)
|
|
74
|
-
*/
|
|
75
|
-
}, {
|
|
76
|
-
key: "cleanupHotReloadHandlers",
|
|
77
|
-
value: function cleanupHotReloadHandlers() {
|
|
78
|
-
if (!isBrowser || !this.isDev) return;
|
|
79
|
-
|
|
80
|
-
// Remove event listeners
|
|
81
|
-
if (this.hotReloadCleanupHandler) {
|
|
82
|
-
window.removeEventListener('beforeunload', this.hotReloadCleanupHandler);
|
|
83
|
-
window.removeEventListener('pagehide', this.hotReloadCleanupHandler);
|
|
84
|
-
this.hotReloadCleanupHandler = null;
|
|
85
|
-
}
|
|
86
|
-
if (this.visibilityChangeHandler) {
|
|
87
|
-
document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
88
|
-
this.visibilityChangeHandler = null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Remove Nuxt hot-reload handlers
|
|
92
|
-
if (this.nuxtHotReloadHandler && window.$nuxt && window.$nuxt.$off) {
|
|
93
|
-
window.$nuxt.$off('routeChanged', this.nuxtHotReloadHandler);
|
|
94
|
-
window.$nuxt.$off('$nuxtReady', this.nuxtHotReloadHandler);
|
|
95
|
-
this.nuxtHotReloadHandler = null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Clear memory monitoring interval
|
|
99
|
-
if (this.memoryCheckInterval) {
|
|
100
|
-
clearInterval(this.memoryCheckInterval);
|
|
101
|
-
this.memoryCheckInterval = null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Remove from global instance tracking
|
|
105
|
-
if (window._sceneViewerInstances) {
|
|
106
|
-
window._sceneViewerInstances.delete(this.component);
|
|
107
|
-
console.log('📍 [Hot-Reload] Instance removed from tracking:', {
|
|
108
|
-
instanceId: this.instanceId,
|
|
109
|
-
remainingInstances: window._sceneViewerInstances.size
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Track a timeout ID for cleanup on component destruction
|
|
116
|
-
*/
|
|
117
|
-
}, {
|
|
118
|
-
key: "trackTimeout",
|
|
119
|
-
value: function trackTimeout(timeoutId) {
|
|
120
|
-
if (timeoutId) {
|
|
121
|
-
this.timeoutIds.add(timeoutId);
|
|
122
|
-
}
|
|
123
|
-
return timeoutId;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Track an interval ID for cleanup on component destruction
|
|
128
|
-
*/
|
|
129
|
-
}, {
|
|
130
|
-
key: "trackInterval",
|
|
131
|
-
value: function trackInterval(intervalId) {
|
|
132
|
-
if (intervalId) {
|
|
133
|
-
this.intervalIds.add(intervalId);
|
|
134
|
-
}
|
|
135
|
-
return intervalId;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Clear a tracked timeout and remove from tracking
|
|
140
|
-
*/
|
|
141
|
-
}, {
|
|
142
|
-
key: "clearTrackedTimeout",
|
|
143
|
-
value: function clearTrackedTimeout(timeoutId) {
|
|
144
|
-
if (this.timeoutIds.has(timeoutId)) {
|
|
145
|
-
clearTimeout(timeoutId);
|
|
146
|
-
this.timeoutIds.delete(timeoutId);
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Clear a tracked interval and remove from tracking
|
|
154
|
-
*/
|
|
155
|
-
}, {
|
|
156
|
-
key: "clearTrackedInterval",
|
|
157
|
-
value: function clearTrackedInterval(intervalId) {
|
|
158
|
-
if (this.intervalIds.has(intervalId)) {
|
|
159
|
-
clearInterval(intervalId);
|
|
160
|
-
this.intervalIds.delete(intervalId);
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Clear all tracked timeouts and intervals
|
|
168
|
-
*/
|
|
169
|
-
}, {
|
|
170
|
-
key: "clearAllTrackedTimers",
|
|
171
|
-
value: function clearAllTrackedTimers() {
|
|
172
|
-
// Clear all timeouts
|
|
173
|
-
this.timeoutIds.forEach(function (id) {
|
|
174
|
-
clearTimeout(id);
|
|
175
|
-
});
|
|
176
|
-
this.timeoutIds.clear();
|
|
177
|
-
|
|
178
|
-
// Clear all intervals
|
|
179
|
-
this.intervalIds.forEach(function (id) {
|
|
180
|
-
clearInterval(id);
|
|
181
|
-
});
|
|
182
|
-
this.intervalIds.clear();
|
|
183
|
-
console.log('🧹 [Hot-Reload] Cleared all tracked timers');
|
|
184
|
-
}
|
|
185
|
-
}]);
|
|
186
|
-
}();
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Simple utility to handle hot-reload for componentId
|
|
190
|
-
* @param {string} instanceId - Unique instance identifier for the component
|
|
191
|
-
* @param {Function} cleanupMethod - Method to call to clean up resources
|
|
192
|
-
*/
|
|
193
|
-
function handleHotReload(instanceId, cleanupMethod) {
|
|
194
|
-
if (!isBrowser || !isDev) return;
|
|
195
|
-
|
|
196
|
-
// Initialize registry if needed
|
|
197
|
-
if (!window._hotReloadRegistry) {
|
|
198
|
-
window._hotReloadRegistry = new Map();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// If we're reloading and have a previous instance with the same ID, clean it up
|
|
202
|
-
var existingInstance = window._hotReloadRegistry.get(instanceId);
|
|
203
|
-
if (existingInstance) {
|
|
204
|
-
console.log("\uD83D\uDD25 [Hot-Reload] Detected hot reload for instance: ".concat(instanceId));
|
|
205
|
-
if (typeof existingInstance.cleanup === 'function') {
|
|
206
|
-
existingInstance.cleanup();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Register new instance
|
|
211
|
-
window._hotReloadRegistry.set(instanceId, {
|
|
212
|
-
timestamp: Date.now(),
|
|
213
|
-
cleanup: cleanupMethod
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Check if we're currently hot-reloading
|
|
219
|
-
*/
|
|
220
|
-
function isHotReloading() {
|
|
221
|
-
return isDev && isBrowser && window._hotReloadRegistry && window._hotReloadRegistry.size > 0;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Clean up resources for a component before hot-reload
|
|
226
|
-
* @param {string} instanceId - ID of the component instance to clean up
|
|
227
|
-
*/
|
|
228
|
-
function cleanupForHotReload(instanceId) {
|
|
229
|
-
if (!isBrowser || !isDev || !window._hotReloadRegistry) return;
|
|
230
|
-
var instance = window._hotReloadRegistry.get(instanceId);
|
|
231
|
-
if (instance && typeof instance.cleanup === 'function') {
|
|
232
|
-
instance.cleanup();
|
|
233
|
-
window._hotReloadRegistry.delete(instanceId);
|
|
234
|
-
console.log("\uD83E\uDDF9 [Hot-Reload] Cleaned up instance: ".concat(instanceId));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
var hotReloadManager = {
|
|
238
|
-
HotReloadManager: HotReloadManager,
|
|
239
|
-
handleHotReload: handleHotReload,
|
|
240
|
-
isHotReloading: isHotReloading,
|
|
241
|
-
cleanupForHotReload: cleanupForHotReload
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
export { HotReloadManager, cleanupForHotReload, hotReloadManager as default, handleHotReload, isHotReloading };
|
|
1
|
+
import{createClass as i,classCallCheck as t}from"../_virtual/_rollupPluginBabelHelpers.js";var n="undefined"!=typeof window,e=n&&"development"===process.env.NODE_ENV,o=function(){return i(function i(n){t(this,i),this.component=n,this.isDev=e,this.instanceId=Date.now()+Math.random(),this.hotReloadCleanupHandler=null,this.visibilityChangeHandler=null,this.nuxtHotReloadHandler=null,this.memoryCheckInterval=null,this.timeoutIds=new Set,this.intervalIds=new Set},[{key:"setupHotReloadHandling",value:function(){var i=this;n&&this.isDev&&(window._sceneViewerInstances||(window._sceneViewerInstances=new Set),window._sceneViewerInstances.add(this.component),this.hotReloadCleanupHandler=function(){i.component&&"function"==typeof i.component.enhancedDisposal&&i.component.enhancedDisposal(),window._sceneViewerInstances&&window._sceneViewerInstances.delete(i.component)},window.addEventListener("beforeunload",this.hotReloadCleanupHandler),window.addEventListener("pagehide",this.hotReloadCleanupHandler))}},{key:"cleanupHotReloadHandlers",value:function(){n&&this.isDev&&(this.hotReloadCleanupHandler&&(window.removeEventListener("beforeunload",this.hotReloadCleanupHandler),window.removeEventListener("pagehide",this.hotReloadCleanupHandler),this.hotReloadCleanupHandler=null),this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null),this.nuxtHotReloadHandler&&window.$nuxt&&window.$nuxt.$off&&(window.$nuxt.$off("routeChanged",this.nuxtHotReloadHandler),window.$nuxt.$off("$nuxtReady",this.nuxtHotReloadHandler),this.nuxtHotReloadHandler=null),this.memoryCheckInterval&&(clearInterval(this.memoryCheckInterval),this.memoryCheckInterval=null),window._sceneViewerInstances&&window._sceneViewerInstances.delete(this.component))}},{key:"trackTimeout",value:function(i){return i&&this.timeoutIds.add(i),i}},{key:"trackInterval",value:function(i){return i&&this.intervalIds.add(i),i}},{key:"clearTrackedTimeout",value:function(i){return!!this.timeoutIds.has(i)&&(clearTimeout(i),this.timeoutIds.delete(i),!0)}},{key:"clearTrackedInterval",value:function(i){return!!this.intervalIds.has(i)&&(clearInterval(i),this.intervalIds.delete(i),!0)}},{key:"clearAllTrackedTimers",value:function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds.clear(),this.intervalIds.forEach(function(i){clearInterval(i)}),this.intervalIds.clear()}}])}();function a(i,t){if(n&&e){window._hotReloadRegistry||(window._hotReloadRegistry=new Map);var o=window._hotReloadRegistry.get(i);o&&"function"==typeof o.cleanup&&o.cleanup(),window._hotReloadRegistry.set(i,{timestamp:Date.now(),cleanup:t})}}function l(){return e&&n&&window._hotReloadRegistry&&window._hotReloadRegistry.size>0}function s(i){if(n&&e&&window._hotReloadRegistry){var t=window._hotReloadRegistry.get(i);t&&"function"==typeof t.cleanup&&(t.cleanup(),window._hotReloadRegistry.delete(i))}}var u={HotReloadManager:o,handleHotReload:a,isHotReloading:l,cleanupForHotReload:s};export{o as HotReloadManager,s as cleanupForHotReload,u as default,a as handleHotReload,l as isHotReloading};
|
package/dist/esm/src/index.js
CHANGED
|
@@ -1,118 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { animationManager };
|
|
3
|
-
import * as componentManager from './componentManager.js';
|
|
4
|
-
export { componentManager };
|
|
5
|
-
import * as debugLogger from './debugLogger.js';
|
|
6
|
-
export { debugLogger };
|
|
7
|
-
export { logger, modelLogger, pathfinderLogger, transformLogger } from './debugLogger.js';
|
|
8
|
-
import * as disposalManager from './disposalManager.js';
|
|
9
|
-
export { disposalManager };
|
|
10
|
-
import * as environmentManager from './environmentManager.js';
|
|
11
|
-
export { environmentManager };
|
|
12
|
-
import * as hotReloadManager from './hotReloadManager.js';
|
|
13
|
-
export { hotReloadManager };
|
|
14
|
-
import * as keyboardControlsManager from './keyboardControlsManager.js';
|
|
15
|
-
export { keyboardControlsManager };
|
|
16
|
-
import { modelPreloader as explicitModelPreloader } from './modelPreloader.js';
|
|
17
|
-
import * as nameUtils from './nameUtils.js';
|
|
18
|
-
export { nameUtils };
|
|
19
|
-
export { findObjectByHardcodedUuid, generateUuidFromName, getHardcodedUuid } from './nameUtils.js';
|
|
20
|
-
import * as pathfindingManager from './pathfindingManager.js';
|
|
21
|
-
export { pathfindingManager };
|
|
22
|
-
import * as performanceMonitor from './performanceMonitor.js';
|
|
23
|
-
export { performanceMonitor };
|
|
24
|
-
import * as sceneExportManager from './sceneExportManager.js';
|
|
25
|
-
export { sceneExportManager };
|
|
26
|
-
export { getSceneExportManager } from './sceneExportManager.js';
|
|
27
|
-
import * as sceneInitializationManager from './sceneInitializationManager.js';
|
|
28
|
-
export { sceneInitializationManager };
|
|
29
|
-
import * as sceneOperationsManager from './sceneOperationsManager.js';
|
|
30
|
-
export { sceneOperationsManager };
|
|
31
|
-
export { getSceneOperationsManager } from './sceneOperationsManager.js';
|
|
32
|
-
import * as textureConfig from './textureConfig.js';
|
|
33
|
-
export { textureConfig };
|
|
34
|
-
import * as transformControlsManager from './transformControlsManager.js';
|
|
35
|
-
export { transformControlsManager };
|
|
36
|
-
export { getTransformControlsManager } from './transformControlsManager.js';
|
|
37
|
-
import * as Pathfinder from './Pathfinder.js';
|
|
38
|
-
export { Pathfinder };
|
|
39
|
-
import * as ConnectionManager from './ConnectionManager.js';
|
|
40
|
-
export { ConnectionManager };
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @module CentralPlant/Utils
|
|
44
|
-
* @description Central Plant Utilities Module
|
|
45
|
-
*
|
|
46
|
-
* This is the main entry point for all utility functions and classes
|
|
47
|
-
* used in the Central Plant application. Import this module to access
|
|
48
|
-
* all utility functions through a single interface.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* // Import the entire utilities module
|
|
52
|
-
* import CentralPlant from 'central-plant';
|
|
53
|
-
*
|
|
54
|
-
* // Use a specific utility
|
|
55
|
-
* CentralPlant.modelPreloader.preloadAllModels(...);
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* // Import specific modules
|
|
59
|
-
* import { modelPreloader, nameUtils } from 'CentralPlant';
|
|
60
|
-
*
|
|
61
|
-
* // Use them directly
|
|
62
|
-
* modelPreloader.preloadAllModels(...);
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* // Import common functions directly
|
|
66
|
-
* import { getHardcodedUuid, logger } from 'CentralPlant';
|
|
67
|
-
*
|
|
68
|
-
* // Use functions directly
|
|
69
|
-
* const uuid = getHardcodedUuid(object);
|
|
70
|
-
* logger.info('Operation completed');
|
|
71
|
-
*/
|
|
72
|
-
// Use the explicit modelPreloader object as the named export
|
|
73
|
-
var modelPreloader = explicitModelPreloader;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Central API object that provides access to all utility modules
|
|
77
|
-
* @type {Object}
|
|
78
|
-
* @property {Object} animation - Animation management utilities
|
|
79
|
-
* @property {Object} component - Component management utilities
|
|
80
|
-
* @property {Object} debug - Debugging and logging utilities
|
|
81
|
-
* @property {Object} disposal - Resource disposal utilities
|
|
82
|
-
* @property {Object} environment - 3D environment management utilities
|
|
83
|
-
* @property {Object} hotReload - Hot reload handling utilities
|
|
84
|
-
* @property {Object} keyboardControls - Keyboard controls management
|
|
85
|
-
* @property {Object} modelPreloader - Model preloading utilities
|
|
86
|
-
* @property {Object} name - Name and UUID management utilities
|
|
87
|
-
* @property {Object} pathfinding - Pathfinding utilities
|
|
88
|
-
* @property {Object} performance - Performance monitoring utilities
|
|
89
|
-
* @property {Object} sceneExport - Scene export utilities
|
|
90
|
-
* @property {Object} sceneInitialization - Scene initialization utilities
|
|
91
|
-
* @property {Object} sceneOperations - Scene operations utilities
|
|
92
|
-
* @property {Object} texture - Texture management utilities
|
|
93
|
-
* @property {Object} transformControls - Transform controls utilities
|
|
94
|
-
* @property {Object} pathfinder - Pathfinder utilities
|
|
95
|
-
* @property {Object} connectionManager - Connection management utilities
|
|
96
|
-
*/
|
|
97
|
-
var CentralPlantUtils = {
|
|
98
|
-
animation: animationManager,
|
|
99
|
-
component: componentManager,
|
|
100
|
-
debug: debugLogger,
|
|
101
|
-
disposal: disposalManager,
|
|
102
|
-
environment: environmentManager,
|
|
103
|
-
hotReload: hotReloadManager,
|
|
104
|
-
keyboardControls: keyboardControlsManager,
|
|
105
|
-
modelPreloader: modelPreloader,
|
|
106
|
-
name: nameUtils,
|
|
107
|
-
pathfinding: pathfindingManager,
|
|
108
|
-
performance: performanceMonitor,
|
|
109
|
-
sceneExport: sceneExportManager,
|
|
110
|
-
sceneInitialization: sceneInitializationManager,
|
|
111
|
-
sceneOperations: sceneOperationsManager,
|
|
112
|
-
texture: textureConfig,
|
|
113
|
-
transformControls: transformControlsManager,
|
|
114
|
-
pathfinder: Pathfinder,
|
|
115
|
-
connectionManager: ConnectionManager
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export { CentralPlantUtils as default, modelPreloader };
|
|
1
|
+
import*as r from"./animationManager.js";export{r as animationManager};import*as o from"./componentManager.js";export{o as componentManager};import*as e from"./debugLogger.js";export{e as debugLogger};export{logger,modelLogger,pathfinderLogger,transformLogger}from"./debugLogger.js";import*as a from"./disposalManager.js";export{a as disposalManager};import*as t from"./environmentManager.js";export{t as environmentManager};import*as n from"./hotReloadManager.js";export{n as hotReloadManager};import*as s from"./keyboardControlsManager.js";export{s as keyboardControlsManager};import*as m from"./nameUtils.js";export{m as nameUtils};export{findObjectByHardcodedUuid,generateUuidFromName,getHardcodedUuid}from"./nameUtils.js";import*as p from"./pathfindingManager.js";export{p as pathfindingManager};import*as i from"./performanceMonitor.js";import*as g from"./sceneExportManager.js";export{g as sceneExportManager};export{getSceneExportManager}from"./sceneExportManager.js";import*as f from"./sceneInitializationManager.js";export{f as sceneInitializationManager};import*as d from"./textureConfig.js";export{d as textureConfig};import*as x from"./transformControlsManager.js";export{x as transformControlsManager};export{getTransformControlsManager}from"./transformControlsManager.js";var j={animation:r,component:o,debug:e,disposal:a,environment:t,hotReload:n,keyboardControls:s,name:m,pathfinding:p,performance:i,sceneExport:g,sceneInitialization:f,texture:d,transformControls:x};export{j as default};
|
|
@@ -1,196 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Keyboard Controls Manager
|
|
5
|
-
* Manages keyboard shortcuts and controls
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Store registered key handlers
|
|
9
|
-
var keyHandlers = new Map();
|
|
10
|
-
var isListening = false;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Initialize keyboard controls
|
|
14
|
-
*/
|
|
15
|
-
function initKeyboardControls() {
|
|
16
|
-
if (typeof window === 'undefined') {
|
|
17
|
-
logger.warn('Cannot initialize keyboard controls: window is not defined');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Only add event listener once
|
|
22
|
-
if (isListening) return;
|
|
23
|
-
|
|
24
|
-
// Handle keydown events
|
|
25
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
26
|
-
window.addEventListener('keyup', handleKeyUp);
|
|
27
|
-
isListening = true;
|
|
28
|
-
logger.info('Keyboard controls initialized');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Clean up keyboard controls
|
|
33
|
-
*/
|
|
34
|
-
function cleanupKeyboardControls() {
|
|
35
|
-
if (typeof window === 'undefined' || !isListening) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
39
|
-
window.removeEventListener('keyup', handleKeyUp);
|
|
40
|
-
keyHandlers.clear();
|
|
41
|
-
isListening = false;
|
|
42
|
-
logger.info('Keyboard controls cleaned up');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Handler for keydown events
|
|
47
|
-
*/
|
|
48
|
-
function handleKeyDown(event) {
|
|
49
|
-
// Get key or combination
|
|
50
|
-
var keyCombo = getKeyCombo(event);
|
|
51
|
-
|
|
52
|
-
// Get handler for this key
|
|
53
|
-
var handler = keyHandlers.get(keyCombo);
|
|
54
|
-
if (handler) {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
handler.callback(event);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Handler for keyup events
|
|
62
|
-
*/
|
|
63
|
-
function handleKeyUp(event) {
|
|
64
|
-
var keyCombo = getKeyCombo(event);
|
|
65
|
-
|
|
66
|
-
// Get handler for this key
|
|
67
|
-
var handler = keyHandlers.get(keyCombo);
|
|
68
|
-
if (handler && handler.onKeyUp) {
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
handler.onKeyUp(event);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Register a key handler
|
|
76
|
-
*/
|
|
77
|
-
function registerKeyHandler(key, callback) {
|
|
78
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
79
|
-
// Normalize key format
|
|
80
|
-
var normalizedKey = normalizeKey(key);
|
|
81
|
-
|
|
82
|
-
// Register handler
|
|
83
|
-
keyHandlers.set(normalizedKey, {
|
|
84
|
-
callback: callback,
|
|
85
|
-
onKeyUp: options.onKeyUp || null,
|
|
86
|
-
description: options.description || ''
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// Initialize controls if not already done
|
|
90
|
-
if (!isListening) {
|
|
91
|
-
initKeyboardControls();
|
|
92
|
-
}
|
|
93
|
-
return normalizedKey;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Unregister a key handler
|
|
98
|
-
*/
|
|
99
|
-
function unregisterKeyHandler(key) {
|
|
100
|
-
var normalizedKey = normalizeKey(key);
|
|
101
|
-
return keyHandlers.delete(normalizedKey);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Get all registered key handlers
|
|
106
|
-
*/
|
|
107
|
-
function getRegisteredKeyHandlers() {
|
|
108
|
-
var handlers = [];
|
|
109
|
-
keyHandlers.forEach(function (handler, key) {
|
|
110
|
-
handlers.push({
|
|
111
|
-
key: key,
|
|
112
|
-
description: handler.description
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
return handlers;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Helper function to normalize key format
|
|
120
|
-
*/
|
|
121
|
-
function normalizeKey(key) {
|
|
122
|
-
return key.toLowerCase();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Helper function to get key combo string from event
|
|
127
|
-
*/
|
|
128
|
-
function getKeyCombo(event) {
|
|
129
|
-
var combo = '';
|
|
130
|
-
if (event.ctrlKey) combo += 'ctrl+';
|
|
131
|
-
if (event.altKey) combo += 'alt+';
|
|
132
|
-
if (event.shiftKey) combo += 'shift+';
|
|
133
|
-
if (event.metaKey) combo += 'meta+';
|
|
134
|
-
combo += event.key.toLowerCase();
|
|
135
|
-
return combo;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Setup common keyboard controls for a Three.js scene
|
|
140
|
-
*/
|
|
141
|
-
function setupCommonControls(component) {
|
|
142
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
143
|
-
// Reset view
|
|
144
|
-
registerKeyHandler('r', function () {
|
|
145
|
-
if (component.camera && component.controls) {
|
|
146
|
-
component.camera.position.set(-10, 10, 10);
|
|
147
|
-
component.controls.target.set(0, 0, 0);
|
|
148
|
-
component.controls.update();
|
|
149
|
-
logger.info('Camera reset');
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
description: 'Reset camera view'
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// Toggle wireframe mode
|
|
156
|
-
registerKeyHandler('w', function () {
|
|
157
|
-
if (component.scene) {
|
|
158
|
-
var wireframeEnabled = !options.wireframeEnabled;
|
|
159
|
-
options.wireframeEnabled = wireframeEnabled;
|
|
160
|
-
component.scene.traverse(function (object) {
|
|
161
|
-
if (object.isMesh && object.material) {
|
|
162
|
-
if (Array.isArray(object.material)) {
|
|
163
|
-
object.material.forEach(function (mat) {
|
|
164
|
-
mat.wireframe = wireframeEnabled;
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
object.material.wireframe = wireframeEnabled;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
logger.info("Wireframe mode: ".concat(wireframeEnabled ? 'enabled' : 'disabled'));
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
|
-
description: 'Toggle wireframe mode'
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
// Toggle performance monitor
|
|
178
|
-
registerKeyHandler('p', function () {
|
|
179
|
-
if (component.performanceUI) {
|
|
180
|
-
component.performanceUI.toggle();
|
|
181
|
-
}
|
|
182
|
-
}, {
|
|
183
|
-
description: 'Toggle performance monitor'
|
|
184
|
-
});
|
|
185
|
-
logger.info('Common keyboard controls setup');
|
|
186
|
-
}
|
|
187
|
-
var keyboardControlsManager = {
|
|
188
|
-
initKeyboardControls: initKeyboardControls,
|
|
189
|
-
cleanupKeyboardControls: cleanupKeyboardControls,
|
|
190
|
-
registerKeyHandler: registerKeyHandler,
|
|
191
|
-
unregisterKeyHandler: unregisterKeyHandler,
|
|
192
|
-
getRegisteredKeyHandlers: getRegisteredKeyHandlers,
|
|
193
|
-
setupCommonControls: setupCommonControls
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export { cleanupKeyboardControls, keyboardControlsManager as default, getRegisteredKeyHandlers, initKeyboardControls, registerKeyHandler, setupCommonControls, unregisterKeyHandler };
|
|
1
|
+
import{logger as n}from"./debugLogger.js";var e=new Map,o=!1;function r(){"undefined"!=typeof window?o||(window.addEventListener("keydown",t),window.addEventListener("keyup",a),o=!0,n.info("Keyboard controls initialized")):n.warn("Cannot initialize keyboard controls: window is not defined")}function i(){"undefined"!=typeof window&&o&&(window.removeEventListener("keydown",t),window.removeEventListener("keyup",a),e.clear(),o=!1,n.info("Keyboard controls cleaned up"))}function t(n){var o=l(n),r=e.get(o);r&&(n.preventDefault(),r.callback(n))}function a(n){var o=l(n),r=e.get(o);r&&r.onKeyUp&&(n.preventDefault(),r.onKeyUp(n))}function d(n,i){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=f(n);return e.set(a,{callback:i,onKeyUp:t.onKeyUp||null,description:t.description||""}),o||r(),a}function u(n){var o=f(n);return e.delete(o)}function c(){var n=[];return e.forEach(function(e,o){n.push({key:o,description:e.description})}),n}function f(n){return n.toLowerCase()}function l(n){var e="";return n.ctrlKey&&(e+="ctrl+"),n.altKey&&(e+="alt+"),n.shiftKey&&(e+="shift+"),n.metaKey&&(e+="meta+"),e+=n.key.toLowerCase()}function s(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};d("r",function(){e.camera&&e.controls&&(e.camera.position.set(-10,10,10),e.controls.target.set(0,0,0),e.controls.update(),n.info("Camera reset"))},{description:"Reset camera view"}),d("w",function(){if(e.scene){var r=!o.wireframeEnabled;o.wireframeEnabled=r,e.scene.traverse(function(n){n.isMesh&&n.material&&(Array.isArray(n.material)?n.material.forEach(function(n){n.wireframe=r}):n.material.wireframe=r)}),n.info("Wireframe mode: ".concat(r?"enabled":"disabled"))}},{description:"Toggle wireframe mode"}),d("p",function(){e.performanceUI&&e.performanceUI.toggle()},{description:"Toggle performance monitor"}),n.info("Common keyboard controls setup")}var w={initKeyboardControls:r,cleanupKeyboardControls:i,registerKeyHandler:d,unregisterKeyHandler:u,getRegisteredKeyHandlers:c,setupCommonControls:s};export{i as cleanupKeyboardControls,w as default,c as getRegisteredKeyHandlers,r as initKeyboardControls,d as registerKeyHandler,s as setupCommonControls,u as unregisterKeyHandler};
|
|
@@ -1,99 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Name Utilities
|
|
3
|
-
* Common helper functions for name and UUID generation
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Generate UUID from name using consistent transformation rules
|
|
8
|
-
* @param {string} name - The name to convert to UUID
|
|
9
|
-
* @returns {string} The generated UUID
|
|
10
|
-
*/
|
|
11
|
-
function generateUuidFromName(name) {
|
|
12
|
-
if (!name) return null;
|
|
13
|
-
|
|
14
|
-
// Convert name to uppercase and replace spaces with hyphens
|
|
15
|
-
var uuid = name.toUpperCase().replace(/\s+COMPONENT$/i, '') // Remove "Component" suffix
|
|
16
|
-
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
|
17
|
-
.replace(/[^A-Z0-9\-]/g, ''); // Remove special characters except hyphens
|
|
18
|
-
|
|
19
|
-
// Clean up any duplicate "COMPONENT" text that might have been left behind
|
|
20
|
-
uuid = uuid.replace(/-COMPONENT$/, '');
|
|
21
|
-
return uuid;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Check if two names would generate the same UUID
|
|
26
|
-
* @param {string} name1 - First name
|
|
27
|
-
* @param {string} name2 - Second name
|
|
28
|
-
* @returns {boolean} Whether the names generate the same UUID
|
|
29
|
-
*/
|
|
30
|
-
function namesGenerateSameUuid(name1, name2) {
|
|
31
|
-
var uuid1 = generateUuidFromName(name1);
|
|
32
|
-
var uuid2 = generateUuidFromName(name2);
|
|
33
|
-
return uuid1 && uuid2 && uuid1 === uuid2;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Find an object in a Three.js scene by hardcoded UUID with fallback strategies
|
|
38
|
-
* @param {THREE.Scene} scene - The Three.js scene to search
|
|
39
|
-
* @param {string} targetUuid - The UUID to search for
|
|
40
|
-
* @returns {THREE.Object3D|null} The found object or null
|
|
41
|
-
*/
|
|
42
|
-
function findObjectByHardcodedUuid(scene, targetUuid) {
|
|
43
|
-
if (!scene || !targetUuid) return null;
|
|
44
|
-
var foundObject = null;
|
|
45
|
-
scene.traverse(function (child) {
|
|
46
|
-
var _child$userData;
|
|
47
|
-
if (foundObject) return; // Stop if already found
|
|
48
|
-
|
|
49
|
-
// Strategy 1: Direct UUID match (HIGHEST PRIORITY)
|
|
50
|
-
if (child.uuid === targetUuid) {
|
|
51
|
-
foundObject = child;
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Strategy 2: Original hardcoded UUID match
|
|
56
|
-
if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid) === targetUuid) {
|
|
57
|
-
foundObject = child;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Strategy 3: Name-based UUID match (FALLBACK)
|
|
62
|
-
if (child.name) {
|
|
63
|
-
var generatedUuid = generateUuidFromName(child.name);
|
|
64
|
-
if (generatedUuid === targetUuid) {
|
|
65
|
-
foundObject = child;
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return foundObject;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get the hardcoded UUID for an object, prioritizing original over current
|
|
75
|
-
* @param {THREE.Object3D} object - The Three.js object
|
|
76
|
-
* @returns {string|null} The hardcoded UUID or null
|
|
77
|
-
*/
|
|
78
|
-
function getHardcodedUuid(object) {
|
|
79
|
-
var _object$userData;
|
|
80
|
-
if (!object) return null;
|
|
81
|
-
|
|
82
|
-
// Priority 1: Original hardcoded UUID stored in userData
|
|
83
|
-
if ((_object$userData = object.userData) !== null && _object$userData !== void 0 && _object$userData.originalUuid) {
|
|
84
|
-
return object.userData.originalUuid;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Priority 2: Current UUID (if it looks like a hardcoded one)
|
|
88
|
-
if (object.uuid && !object.uuid.includes('-') && object.uuid.length > 10) {
|
|
89
|
-
return object.uuid;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Priority 3: Generate from name if available
|
|
93
|
-
if (object.name) {
|
|
94
|
-
return generateUuidFromName(object.name);
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { findObjectByHardcodedUuid, generateUuidFromName, getHardcodedUuid, namesGenerateSameUuid };
|
|
1
|
+
function n(n){if(!n)return null;var r=n.toUpperCase().replace(/\s+COMPONENT$/i,"").replace(/\s+/g,"-").replace(/[^A-Z0-9\-]/g,"");return r=r.replace(/-COMPONENT$/,"")}function r(r,u){var i=n(r),l=n(u);return i&&l&&i===l}function u(r,u){if(!r||!u)return null;var i=null;return r.traverse(function(r){var l;if(!i)if(r.uuid!==u)if((null===(l=r.userData)||void 0===l?void 0:l.originalUuid)!==u){if(r.name&&n(r.name)===u)return void(i=r)}else i=r;else i=r}),i}function i(r){var u;return r?null!==(u=r.userData)&&void 0!==u&&u.originalUuid?r.userData.originalUuid:r.uuid&&!r.uuid.includes("-")&&r.uuid.length>10?r.uuid:r.name?n(r.name):null:null}export{u as findObjectByHardcodedUuid,n as generateUuidFromName,i as getHardcodedUuid,r as namesGenerateSameUuid};
|