@2112-lab/central-plant 0.3.35 → 0.3.36
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 +34 -98
- package/dist/cjs/src/core/centralPlant.js +4 -6
- package/dist/cjs/src/core/centralPlantInternals.js +1 -3
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +14 -22
- package/dist/cjs/src/managers/cache/S3CacheService.js +2 -33
- package/dist/cjs/src/managers/cache/S3MetadataCacheService.js +0 -1
- package/dist/cjs/src/managers/components/componentDataManager.js +2 -6
- package/dist/cjs/src/managers/scene/sceneExportManager.js +10 -3
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +0 -2
- package/dist/cjs/src/rendering/modelPreloader.js +1 -17
- package/dist/cjs/src/utils/ioDeviceUtils.js +0 -5
- package/dist/esm/src/core/centralPlant.js +4 -6
- package/dist/esm/src/core/centralPlantInternals.js +1 -3
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +14 -22
- package/dist/esm/src/managers/cache/S3CacheService.js +2 -33
- package/dist/esm/src/managers/cache/S3MetadataCacheService.js +0 -1
- package/dist/esm/src/managers/components/componentDataManager.js +2 -6
- package/dist/esm/src/managers/scene/sceneExportManager.js +10 -3
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +0 -2
- package/dist/esm/src/rendering/modelPreloader.js +1 -17
- package/dist/esm/src/utils/ioDeviceUtils.js +0 -5
- package/package.json +1 -1
|
@@ -137,9 +137,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
137
137
|
}
|
|
138
138
|
if (entries.length) {
|
|
139
139
|
this._entries.set(key, entries);
|
|
140
|
-
|
|
141
|
-
return e.anim.stateVariable;
|
|
142
|
-
}).join(', ')));
|
|
140
|
+
// Loaded ${entries.length} animation(s) for attachment "${attachmentId}"
|
|
143
141
|
} else {
|
|
144
142
|
console.warn("[IoBehaviorManager] No mesh entries resolved for attachment \"".concat(attachmentId, "\" \u2014 behaviorConfig had ").concat(anims.length, " entries but none matched a mesh"));
|
|
145
143
|
}
|
|
@@ -157,13 +155,8 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
157
155
|
}, {
|
|
158
156
|
key: "triggerState",
|
|
159
157
|
value: function triggerState(attachmentId, dataPointId, value, parentUuid) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
attachmentId: attachmentId,
|
|
163
|
-
dataPointId: dataPointId,
|
|
164
|
-
value: value,
|
|
165
|
-
parentUuid: parentUuid
|
|
166
|
-
});
|
|
158
|
+
// triggerState: ${attachmentId}.${dataPointId} = ${value}
|
|
159
|
+
|
|
167
160
|
if (parentUuid) {
|
|
168
161
|
var key = this._key(parentUuid, attachmentId);
|
|
169
162
|
var entries = this._entries.get(key);
|
|
@@ -218,12 +211,12 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
218
211
|
// Evaluate component-level behaviors (intra-component io-device linking)
|
|
219
212
|
if (parentUuid && this._componentBehaviors.has(parentUuid)) {
|
|
220
213
|
var componentBehaviors = this._componentBehaviors.get(parentUuid);
|
|
221
|
-
|
|
214
|
+
// Checking component-level behaviors (count: ${componentBehaviors.length})
|
|
222
215
|
this.triggerCrossComponentBehaviors(componentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
223
216
|
}
|
|
224
217
|
|
|
225
218
|
// Evaluate cross-component behaviors if any are registered
|
|
226
|
-
|
|
219
|
+
// Checking cross-component behaviors (count: ${this._crossComponentBehaviors?.length || 0})
|
|
227
220
|
if (this._crossComponentBehaviors && this._crossComponentBehaviors.length > 0) {
|
|
228
221
|
this.triggerCrossComponentBehaviors(this._crossComponentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
229
222
|
}
|
|
@@ -242,7 +235,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
242
235
|
this._crossComponentBehaviors = (behaviors || []).map(function (b) {
|
|
243
236
|
return _this2._normalizeBehavior(b);
|
|
244
237
|
});
|
|
245
|
-
|
|
238
|
+
// Loaded ${this._crossComponentBehaviors.length} cross-component behavior(s)
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
/**
|
|
@@ -261,7 +254,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
261
254
|
return _this3._normalizeBehavior(b);
|
|
262
255
|
});
|
|
263
256
|
this._componentBehaviors.set(componentUuid, normalized);
|
|
264
|
-
|
|
257
|
+
// Registered ${normalized.length} component-level behavior(s) for component ${componentUuid}
|
|
265
258
|
}
|
|
266
259
|
|
|
267
260
|
/**
|
|
@@ -372,7 +365,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
372
365
|
key: "configure",
|
|
373
366
|
value: function configure(stateAdapter) {
|
|
374
367
|
this._stateAdapter = stateAdapter || null;
|
|
375
|
-
|
|
368
|
+
// State adapter configured
|
|
376
369
|
}
|
|
377
370
|
|
|
378
371
|
/**
|
|
@@ -388,10 +381,10 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
388
381
|
key: "triggerCrossComponentBehaviors",
|
|
389
382
|
value: function triggerCrossComponentBehaviors(behaviors, triggerParentUuid, triggerAttachmentId, triggerStateId, value) {
|
|
390
383
|
if (!behaviors || !Array.isArray(behaviors)) {
|
|
391
|
-
console.log('[Behavior] No behaviors to evaluate');
|
|
392
384
|
return;
|
|
393
385
|
}
|
|
394
|
-
|
|
386
|
+
|
|
387
|
+
// Evaluating ${behaviors.length} behavior(s)
|
|
395
388
|
var _iterator5 = _rollupPluginBabelHelpers.createForOfIteratorHelper(behaviors),
|
|
396
389
|
_step5;
|
|
397
390
|
try {
|
|
@@ -426,7 +419,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
426
419
|
|
|
427
420
|
// Verify that the input matches the triggering source
|
|
428
421
|
if (inputComponent === triggerParentUuid && input.attachment === triggerAttachmentId && input.state === triggerStateId) {
|
|
429
|
-
|
|
422
|
+
// Behavior "${behavior.id}" matched
|
|
430
423
|
|
|
431
424
|
// Collect all outputs (single or multiple)
|
|
432
425
|
var outputs = _outputs || (output ? [output] : []);
|
|
@@ -444,14 +437,13 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
444
437
|
|
|
445
438
|
// Direct state mapping without conditions
|
|
446
439
|
if (this._stateAdapter) {
|
|
447
|
-
|
|
440
|
+
// Dispatching state-to-state: ${out.attachment}.${out.state} = ${value}
|
|
448
441
|
this._stateAdapter.setState(out.attachment, out.state, value);
|
|
449
|
-
console.log("[Behavior] \u2713 State-to-state triggered: ".concat(input.attachment, ".").concat(input.state, " (").concat(value, ") \u2192 ").concat(out.attachment, ".").concat(out.state));
|
|
450
442
|
|
|
451
443
|
// Trigger animations on the output component
|
|
452
444
|
// triggerState(attachmentId, dataPointId, value, parentUuid)
|
|
453
445
|
if (outputComponent) {
|
|
454
|
-
|
|
446
|
+
// Triggering animations on output component
|
|
455
447
|
this.triggerState(out.attachment, out.state, value, outputComponent);
|
|
456
448
|
} else {
|
|
457
449
|
console.warn("[Behavior] Could not find component for attachment \"".concat(out.attachment, "\""));
|
|
@@ -462,7 +454,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
462
454
|
}
|
|
463
455
|
// LEGACY: Mesh-based pattern with conditions
|
|
464
456
|
else if (conditions && out.child) {
|
|
465
|
-
|
|
457
|
+
// Using legacy mesh-based pattern with conditions
|
|
466
458
|
// Evaluate conditions
|
|
467
459
|
var _iterator7 = _rollupPluginBabelHelpers.createForOfIteratorHelper(conditions),
|
|
468
460
|
_step7;
|
|
@@ -770,7 +770,6 @@ function _findInAllCachePartitions() {
|
|
|
770
770
|
_context16.n = 7;
|
|
771
771
|
break;
|
|
772
772
|
}
|
|
773
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (exact match): ").concat(cacheKey.substring(0, 80), "..."));
|
|
774
773
|
return _context16.a(2, response);
|
|
775
774
|
case 7:
|
|
776
775
|
if (!(encodedCacheKey !== cacheKey)) {
|
|
@@ -785,7 +784,6 @@ function _findInAllCachePartitions() {
|
|
|
785
784
|
_context16.n = 9;
|
|
786
785
|
break;
|
|
787
786
|
}
|
|
788
|
-
console.log("\u2705 [findInAllCachePartitions] Found in ".concat(cacheName, " (encoded match): ").concat(encodedCacheKey.substring(0, 80), "..."));
|
|
789
787
|
return _context16.a(2, response);
|
|
790
788
|
case 9:
|
|
791
789
|
_context16.n = 4;
|
|
@@ -820,8 +818,6 @@ function _getCachedS3Object() {
|
|
|
820
818
|
cachedResponse,
|
|
821
819
|
cachedTime,
|
|
822
820
|
age,
|
|
823
|
-
_allKeys,
|
|
824
|
-
matchingKeys,
|
|
825
821
|
_args19 = arguments;
|
|
826
822
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context19) {
|
|
827
823
|
while (1) switch (_context19.n) {
|
|
@@ -829,50 +825,26 @@ function _getCachedS3Object() {
|
|
|
829
825
|
storageOptions = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
830
826
|
expiryMs = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : null;
|
|
831
827
|
cacheKey = "https://s3.cache/".concat(s3Key);
|
|
832
|
-
expiry = expiryMs || CacheManager.cacheManager.getExpiryForPath(s3Key);
|
|
833
|
-
console.log("\uD83D\uDD0D [S3Cache] Checking for cached S3 object:", {
|
|
834
|
-
s3Key: s3Key,
|
|
835
|
-
cacheKey: cacheKey
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
// First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
828
|
+
expiry = expiryMs || CacheManager.cacheManager.getExpiryForPath(s3Key); // First, check ALL app cache partitions for a hit (handles auth race condition)
|
|
839
829
|
_context19.n = 1;
|
|
840
830
|
return findInAllCachePartitions(cacheKey);
|
|
841
831
|
case 1:
|
|
842
832
|
cachedResponse = _context19.v;
|
|
843
833
|
if (!cachedResponse) {
|
|
844
|
-
_context19.n =
|
|
834
|
+
_context19.n = 3;
|
|
845
835
|
break;
|
|
846
836
|
}
|
|
847
837
|
cachedTime = cachedResponse.headers.get('x-cached-time');
|
|
848
838
|
age = Date.now() - parseInt(cachedTime || '0');
|
|
849
|
-
console.log("\u2705 [S3Cache] Found in cache partition, age: ".concat(Math.round(age / 1000), "s, expiry: ").concat(Math.round(expiry / 1000), "s"));
|
|
850
839
|
if (!(age < expiry)) {
|
|
851
840
|
_context19.n = 3;
|
|
852
841
|
break;
|
|
853
842
|
}
|
|
854
|
-
console.log("\u2705 [S3Cache] Returning cached blob for: ".concat(s3Key));
|
|
855
843
|
_context19.n = 2;
|
|
856
844
|
return cachedResponse.blob();
|
|
857
845
|
case 2:
|
|
858
846
|
return _context19.a(2, _context19.v);
|
|
859
847
|
case 3:
|
|
860
|
-
console.log("\u23F0 [S3Cache] Cache entry expired, will re-fetch");
|
|
861
|
-
_context19.n = 6;
|
|
862
|
-
break;
|
|
863
|
-
case 4:
|
|
864
|
-
console.log("\u274C [S3Cache] Not found in any cache partition");
|
|
865
|
-
_context19.n = 5;
|
|
866
|
-
return getAllCacheKeys();
|
|
867
|
-
case 5:
|
|
868
|
-
_allKeys = _context19.v;
|
|
869
|
-
matchingKeys = _rollupPluginBabelHelpers.toConsumableArray(_allKeys).filter(function (k) {
|
|
870
|
-
return k.includes('24dd6a7a') || k.includes('.glb');
|
|
871
|
-
});
|
|
872
|
-
if (matchingKeys.length > 0) {
|
|
873
|
-
console.log("\uD83D\uDD0D [S3Cache] Available GLB cache keys:", matchingKeys.slice(0, 5));
|
|
874
|
-
}
|
|
875
|
-
case 6:
|
|
876
848
|
return _context19.a(2, CacheManager.cacheManager.execute({
|
|
877
849
|
cacheKey: cacheKey,
|
|
878
850
|
sourceKey: s3Key,
|
|
@@ -1031,7 +1003,6 @@ function _preloadS3Objects() {
|
|
|
1031
1003
|
};
|
|
1032
1004
|
}()));
|
|
1033
1005
|
case 1:
|
|
1034
|
-
console.log("\u2705 Preload complete: ".concat(results.success, " success, ").concat(results.failed, " failed"));
|
|
1035
1006
|
return _context22.a(2, results);
|
|
1036
1007
|
}
|
|
1037
1008
|
}, _callee22);
|
|
@@ -1209,7 +1180,6 @@ function _preloadLocalFiles() {
|
|
|
1209
1180
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context29) {
|
|
1210
1181
|
while (1) switch (_context29.n) {
|
|
1211
1182
|
case 0:
|
|
1212
|
-
console.log("preloadLocalFiles started");
|
|
1213
1183
|
results = {
|
|
1214
1184
|
success: 0,
|
|
1215
1185
|
failed: 0,
|
|
@@ -1248,7 +1218,6 @@ function _preloadLocalFiles() {
|
|
|
1248
1218
|
};
|
|
1249
1219
|
}()));
|
|
1250
1220
|
case 1:
|
|
1251
|
-
console.log("preloadLocalFiles finished");
|
|
1252
1221
|
if (results.failed > 0) {
|
|
1253
1222
|
console.warn("\u26A0\uFE0F preloadLocalFiles Cache priming finished with errors: ".concat(results.failed, " failed"), results.errors);
|
|
1254
1223
|
}
|
|
@@ -473,7 +473,6 @@ var S3MetadataCacheService = /*#__PURE__*/function () {
|
|
|
473
473
|
// Update memory cache
|
|
474
474
|
this._memoryCache = metadata;
|
|
475
475
|
this._memoryCacheTime = Date.now();
|
|
476
|
-
console.log("\uD83D\uDCBE S3MetadataCacheService: Set ".concat(components.length, " components"));
|
|
477
476
|
return _context9.a(2, true);
|
|
478
477
|
case 4:
|
|
479
478
|
_context9.p = 4;
|
|
@@ -344,7 +344,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
344
344
|
value: (function () {
|
|
345
345
|
var _extendComponentDictionary = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3(additionalComponents) {
|
|
346
346
|
var _this3 = this;
|
|
347
|
-
var _this$sceneViewer, newComponents,
|
|
347
|
+
var _this$sceneViewer, newComponents, modelPreloader, _t;
|
|
348
348
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
|
|
349
349
|
while (1) switch (_context3.n) {
|
|
350
350
|
case 0:
|
|
@@ -368,7 +368,6 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
368
368
|
_context3.p = 3;
|
|
369
369
|
// Filter out components that already exist in the dictionary (deduplication)
|
|
370
370
|
newComponents = {};
|
|
371
|
-
skippedCount = 0;
|
|
372
371
|
Object.entries(additionalComponents).forEach(function (_ref3) {
|
|
373
372
|
var _ref4 = _rollupPluginBabelHelpers.slicedToArray(_ref3, 2),
|
|
374
373
|
key = _ref4[0],
|
|
@@ -376,13 +375,12 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
376
375
|
if (!_this3.componentDictionary[key]) {
|
|
377
376
|
newComponents[key] = component;
|
|
378
377
|
} else {
|
|
379
|
-
skippedCount++;
|
|
380
378
|
console.log("\u26A0\uFE0F Skipping duplicate component: ".concat(key, " (").concat(component.name || 'unnamed', ")"));
|
|
381
379
|
}
|
|
382
380
|
});
|
|
383
381
|
|
|
384
382
|
// Merge only new components into dictionary
|
|
385
|
-
|
|
383
|
+
Object.keys(newComponents).length;
|
|
386
384
|
Object.assign(this.componentDictionary, newComponents);
|
|
387
385
|
|
|
388
386
|
// Update ModelPreloader's dictionary reference
|
|
@@ -390,12 +388,10 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
390
388
|
modelPreloader = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.centralPlant) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.utilities) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.modelPreloader;
|
|
391
389
|
if (modelPreloader) {
|
|
392
390
|
modelPreloader.componentDictionary = this.componentDictionary;
|
|
393
|
-
console.log("\uD83D\uDD04 Updated ModelPreloader's dictionary reference (".concat(Object.keys(this.componentDictionary).length, " total components)"));
|
|
394
391
|
}
|
|
395
392
|
|
|
396
393
|
// Clear cache to force refresh
|
|
397
394
|
this.clearCache();
|
|
398
|
-
console.log("\u2705 extendComponentDictionary(): Added ".concat(addedCount, " new components (").concat(skippedCount, " duplicates skipped)"));
|
|
399
395
|
return _context3.a(2, true);
|
|
400
396
|
case 4:
|
|
401
397
|
_context3.p = 4;
|
|
@@ -77,7 +77,8 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
77
77
|
}, {
|
|
78
78
|
key: "exportSceneData",
|
|
79
79
|
value: function exportSceneData() {
|
|
80
|
-
var _this = this
|
|
80
|
+
var _this = this,
|
|
81
|
+
_this$sceneViewer$cur2;
|
|
81
82
|
console.log('📤 Starting scene export...');
|
|
82
83
|
if (!this.sceneViewer.scene) {
|
|
83
84
|
console.warn('⚠️ No scene available for export');
|
|
@@ -289,6 +290,12 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
289
290
|
children: sceneChildren
|
|
290
291
|
}
|
|
291
292
|
};
|
|
293
|
+
|
|
294
|
+
// Preserve cross-component behaviors authored in the Behavior window
|
|
295
|
+
var sceneBehaviors = (_this$sceneViewer$cur2 = this.sceneViewer.currentSceneData) === null || _this$sceneViewer$cur2 === void 0 ? void 0 : _this$sceneViewer$cur2.behaviors;
|
|
296
|
+
if (sceneBehaviors && sceneBehaviors.length > 0) {
|
|
297
|
+
exportData.behaviors = sceneBehaviors;
|
|
298
|
+
}
|
|
292
299
|
console.log('✅ Scene export completed:', exportData);
|
|
293
300
|
console.log("\uD83D\uDCCA Exported ".concat(sceneChildren.length, " components and ").concat(exportData.connections.length, " connections"));
|
|
294
301
|
return exportData;
|
|
@@ -354,7 +361,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
354
361
|
}, {
|
|
355
362
|
key: "getExportMetadata",
|
|
356
363
|
value: function getExportMetadata() {
|
|
357
|
-
var _this$sceneViewer$
|
|
364
|
+
var _this$sceneViewer$cur3;
|
|
358
365
|
if (!this.sceneViewer.scene) {
|
|
359
366
|
return null;
|
|
360
367
|
}
|
|
@@ -365,7 +372,7 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
365
372
|
return {
|
|
366
373
|
totalObjects: objectCount,
|
|
367
374
|
hasCurrentSceneData: !!this.sceneViewer.currentSceneData,
|
|
368
|
-
connectionsCount: ((_this$sceneViewer$
|
|
375
|
+
connectionsCount: ((_this$sceneViewer$cur3 = this.sceneViewer.currentSceneData) === null || _this$sceneViewer$cur3 === void 0 || (_this$sceneViewer$cur3 = _this$sceneViewer$cur3.connections) === null || _this$sceneViewer$cur3 === void 0 ? void 0 : _this$sceneViewer$cur3.length) || 0,
|
|
369
376
|
exportTimestamp: new Date().toISOString()
|
|
370
377
|
};
|
|
371
378
|
}
|
|
@@ -897,7 +897,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
897
897
|
|
|
898
898
|
// Check if dictionary has connector children and component doesn't already have them
|
|
899
899
|
if (dictEntry !== null && dictEntry !== void 0 && dictEntry.children && Array.isArray(dictEntry.children) && dictEntry.children.length > 0) {
|
|
900
|
-
// Only inject if the component doesn't already have children
|
|
901
900
|
if (!child.children || child.children.length === 0) {
|
|
902
901
|
// Get component rotation (in degrees from JSON)
|
|
903
902
|
var rotation = child.rotation || {
|
|
@@ -927,7 +926,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
|
|
|
927
926
|
connectorsInjected++;
|
|
928
927
|
return clonedConnector;
|
|
929
928
|
});
|
|
930
|
-
console.log("\uD83D\uDD0C Injected ".concat(child.children.length, " connectors for ").concat(child.uuid, " (").concat(libraryId, ") with rotation [").concat(rotation.x, "\xB0, ").concat(rotation.y, "\xB0, ").concat(rotation.z, "\xB0]"));
|
|
931
929
|
componentsProcessed++;
|
|
932
930
|
}
|
|
933
931
|
}
|
|
@@ -204,17 +204,14 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
204
204
|
_context3.n = 1;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
|
-
console.log("\uD83C\uDFAF Model ".concat(modelKey, " already cached, skipping"));
|
|
208
207
|
return _context3.a(2, this.modelCache.get(modelKey));
|
|
209
208
|
case 1:
|
|
210
209
|
if (!this.loadingPromises.has(modelKey)) {
|
|
211
210
|
_context3.n = 2;
|
|
212
211
|
break;
|
|
213
212
|
}
|
|
214
|
-
console.log("\u23F3 Model ".concat(modelKey, " already loading, waiting for completion"));
|
|
215
213
|
return _context3.a(2, this.loadingPromises.get(modelKey));
|
|
216
214
|
case 2:
|
|
217
|
-
console.log("\uD83D\uDD04 Starting preload of GLB model: ".concat(modelKey));
|
|
218
215
|
loadPromise = new Promise(/*#__PURE__*/function () {
|
|
219
216
|
var _ref = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(resolve, reject) {
|
|
220
217
|
var modelPath, _t;
|
|
@@ -230,7 +227,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
230
227
|
return _this2.urlResolver(modelKey);
|
|
231
228
|
case 2:
|
|
232
229
|
modelPath = _context2.v;
|
|
233
|
-
console.log("\uD83D\uDD17 Resolved URL for ".concat(modelKey, ":"), modelPath.substring(0, 100) + '...');
|
|
234
230
|
_context2.n = 4;
|
|
235
231
|
break;
|
|
236
232
|
case 3:
|
|
@@ -244,11 +240,9 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
244
240
|
break;
|
|
245
241
|
case 5:
|
|
246
242
|
modelPath = "".concat(_this2.modelsBasePath).concat(modelKey);
|
|
247
|
-
console.log("\uD83D\uDCC2 Loading from: ".concat(modelPath));
|
|
248
243
|
case 6:
|
|
249
244
|
// Load GLB model
|
|
250
245
|
_this2.gltfLoader.load(modelPath, function (gltf) {
|
|
251
|
-
console.log("\u2705 Successfully preloaded GLB model: ".concat(modelKey));
|
|
252
246
|
// Cache the scene for future use
|
|
253
247
|
_this2.modelCache.set(modelKey, gltf.scene);
|
|
254
248
|
|
|
@@ -267,13 +261,6 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
267
261
|
resolve(gltf.scene);
|
|
268
262
|
}, function (progress) {
|
|
269
263
|
// Optional: track loading progress
|
|
270
|
-
if (progress.lengthComputable) {
|
|
271
|
-
var percentage = progress.loaded / progress.total * 100;
|
|
272
|
-
if (percentage % 25 === 0) {
|
|
273
|
-
// Log every 25%
|
|
274
|
-
console.log("\uD83D\uDCCA Loading GLB ".concat(modelKey, ": ").concat(percentage.toFixed(0), "%"));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
264
|
}, function (error) {
|
|
278
265
|
console.error("\u274C Failed to preload GLB model ".concat(modelKey, ":"), error);
|
|
279
266
|
// Remove from loading promises
|
|
@@ -311,13 +298,10 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
311
298
|
value: function getCachedModel(modelKey) {
|
|
312
299
|
var useIndexedGeometry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
313
300
|
if (this.modelCache.has(modelKey)) {
|
|
314
|
-
console.log("\uD83C\uDFAF Returning cached model: ".concat(modelKey));
|
|
315
301
|
var cachedData = this.modelCache.get(modelKey);
|
|
316
302
|
|
|
317
303
|
// Handle OBJ models with processed geometry
|
|
318
304
|
if (cachedData && cachedData.isObjModel && useIndexedGeometry && cachedData.processedGeometry) {
|
|
319
|
-
console.log("\uD83D\uDD27 Using indexed BufferGeometry for OBJ: ".concat(modelKey));
|
|
320
|
-
|
|
321
305
|
// Create a mesh from the processed indexed geometry
|
|
322
306
|
var mesh = new THREE__namespace.Mesh(cachedData.processedGeometry.clone(), cachedData.materials.clone());
|
|
323
307
|
|
|
@@ -553,7 +537,7 @@ var ModelPreloader = /*#__PURE__*/function () {
|
|
|
553
537
|
}
|
|
554
538
|
|
|
555
539
|
// Model not cached, need to load it
|
|
556
|
-
|
|
540
|
+
// Loading model for library ID
|
|
557
541
|
this.preloadSingleModel(modelKey).then(function (model) {
|
|
558
542
|
if (model) {
|
|
559
543
|
var _clonedModel = model.clone();
|
|
@@ -61,7 +61,6 @@ function _attachIODevicesToComponent() {
|
|
|
61
61
|
_context.n = 10;
|
|
62
62
|
break;
|
|
63
63
|
}
|
|
64
|
-
console.log("\uD83D\uDD04 IO device model not in cache, preloading: ".concat(deviceData.modelKey));
|
|
65
64
|
_context.p = 5;
|
|
66
65
|
if (!((_modelPreloader$loadi = modelPreloader.loadingPromises) !== null && _modelPreloader$loadi !== void 0 && _modelPreloader$loadi.has(deviceData.modelKey))) {
|
|
67
66
|
_context.n = 7;
|
|
@@ -143,10 +142,6 @@ function _attachIODevicesToComponent() {
|
|
|
143
142
|
|
|
144
143
|
// Add as child of the component
|
|
145
144
|
componentModel.add(deviceModel);
|
|
146
|
-
console.log("\u2705 Attached IO device: ".concat(attachment.attachmentLabel || attachment.deviceId, " at"), {
|
|
147
|
-
position: deviceModel.position,
|
|
148
|
-
scale: deviceModel.scale
|
|
149
|
-
});
|
|
150
145
|
_context.n = 13;
|
|
151
146
|
break;
|
|
152
147
|
case 12:
|
|
@@ -31,7 +31,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31
31
|
* Initialize the CentralPlant manager
|
|
32
32
|
*
|
|
33
33
|
* @constructor
|
|
34
|
-
* @version 0.3.
|
|
34
|
+
* @version 0.3.36
|
|
35
35
|
* @updated 2025-10-22
|
|
36
36
|
*
|
|
37
37
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -220,12 +220,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
220
220
|
behaviors: ((_this$importedSceneDa3 = this.importedSceneData.behaviors) === null || _this$importedSceneDa3 === void 0 ? void 0 : _this$importedSceneDa3.length) || 0,
|
|
221
221
|
timestamp: new Date().toISOString()
|
|
222
222
|
});
|
|
223
|
-
|
|
223
|
+
|
|
224
|
+
// Scene behaviors loaded
|
|
224
225
|
|
|
225
226
|
// Register behaviors with IoBehaviorManager
|
|
226
227
|
ioBehavMgr = (_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 ? void 0 : _this$sceneViewer.ioBehaviorManager;
|
|
227
228
|
if (ioBehavMgr) {
|
|
228
|
-
|
|
229
|
+
// Setting cross-component behaviors
|
|
229
230
|
ioBehavMgr.setCrossComponentBehaviors(this.importedSceneData.behaviors || []);
|
|
230
231
|
} else {
|
|
231
232
|
console.warn('[Behavior] ioBehaviorManager not available!');
|
|
@@ -724,7 +725,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
724
725
|
|
|
725
726
|
// Enable drag functionality for the specific element
|
|
726
727
|
this.sceneViewer.managers.componentDragManager.enableElementDrag(element, componentId);
|
|
727
|
-
console.log("\u2705 enableDragDrop(): Enabled drag and drop for ".concat(componentId));
|
|
728
728
|
return true;
|
|
729
729
|
} catch (error) {
|
|
730
730
|
console.error('❌ enableDragDrop(): Error enabling drag and drop:', error);
|
|
@@ -760,7 +760,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
760
760
|
}
|
|
761
761
|
try {
|
|
762
762
|
this.sceneViewer.managers.componentDragManager.disableElementDrag(element);
|
|
763
|
-
console.log('✅ disableDragDrop(): Disabled drag and drop for element');
|
|
764
763
|
return true;
|
|
765
764
|
} catch (error) {
|
|
766
765
|
console.error('❌ disableDragDrop(): Error disabling drag and drop:', error);
|
|
@@ -794,7 +793,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
794
793
|
if (this.sceneViewer.managers.componentDragManager) {
|
|
795
794
|
this.sceneViewer.managers.componentDragManager.setEnabled(enabled);
|
|
796
795
|
}
|
|
797
|
-
console.log("\u2705 setDragDropEnabled(): Drag and drop ".concat(enabled ? 'enabled' : 'disabled'));
|
|
798
796
|
return true;
|
|
799
797
|
} catch (error) {
|
|
800
798
|
console.error('❌ setDragDropEnabled(): Error setting drag and drop state:', error);
|
|
@@ -212,12 +212,10 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
212
212
|
if (this.centralPlant.sceneViewer.$refs.container && this.centralPlant.sceneViewer.camera && this.centralPlant.sceneViewer.scene) {
|
|
213
213
|
this.centralPlant.managers.tooltipsManager = new SceneTooltipsManager(this.centralPlant.sceneViewer.$refs.container, this.centralPlant.sceneViewer.camera, this.centralPlant.sceneViewer.scene);
|
|
214
214
|
this.centralPlant.sceneViewer.tooltipsManager = this.centralPlant.managers.tooltipsManager;
|
|
215
|
-
console.log('🔍 Tooltip manager initialized:', this.centralPlant.managers.tooltipsManager);
|
|
216
215
|
|
|
217
216
|
// Initialize the component tooltip manager (screen-space tooltip on selection)
|
|
218
217
|
this.centralPlant.managers.componentTooltipManager = new ComponentTooltipManager(this.centralPlant.sceneViewer);
|
|
219
218
|
this.centralPlant.sceneViewer.componentTooltipManager = this.centralPlant.managers.componentTooltipManager;
|
|
220
|
-
console.log('🔍 Component tooltip manager initialized');
|
|
221
219
|
}
|
|
222
220
|
}
|
|
223
221
|
|
|
@@ -1153,7 +1151,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1153
1151
|
|
|
1154
1152
|
// Register component-level behaviors (intra-component io-device linking)
|
|
1155
1153
|
if (componentData.behaviors && componentData.behaviors.length > 0) {
|
|
1156
|
-
|
|
1154
|
+
// Registering ${componentData.behaviors.length} component-level behavior(s)
|
|
1157
1155
|
ioBehavMgr.registerComponentBehaviors(componentId, componentData.behaviors);
|
|
1158
1156
|
}
|
|
1159
1157
|
}
|
|
@@ -113,9 +113,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
113
113
|
}
|
|
114
114
|
if (entries.length) {
|
|
115
115
|
this._entries.set(key, entries);
|
|
116
|
-
|
|
117
|
-
return e.anim.stateVariable;
|
|
118
|
-
}).join(', ')));
|
|
116
|
+
// Loaded ${entries.length} animation(s) for attachment "${attachmentId}"
|
|
119
117
|
} else {
|
|
120
118
|
console.warn("[IoBehaviorManager] No mesh entries resolved for attachment \"".concat(attachmentId, "\" \u2014 behaviorConfig had ").concat(anims.length, " entries but none matched a mesh"));
|
|
121
119
|
}
|
|
@@ -133,13 +131,8 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
133
131
|
}, {
|
|
134
132
|
key: "triggerState",
|
|
135
133
|
value: function triggerState(attachmentId, dataPointId, value, parentUuid) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
attachmentId: attachmentId,
|
|
139
|
-
dataPointId: dataPointId,
|
|
140
|
-
value: value,
|
|
141
|
-
parentUuid: parentUuid
|
|
142
|
-
});
|
|
134
|
+
// triggerState: ${attachmentId}.${dataPointId} = ${value}
|
|
135
|
+
|
|
143
136
|
if (parentUuid) {
|
|
144
137
|
var key = this._key(parentUuid, attachmentId);
|
|
145
138
|
var entries = this._entries.get(key);
|
|
@@ -194,12 +187,12 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
194
187
|
// Evaluate component-level behaviors (intra-component io-device linking)
|
|
195
188
|
if (parentUuid && this._componentBehaviors.has(parentUuid)) {
|
|
196
189
|
var componentBehaviors = this._componentBehaviors.get(parentUuid);
|
|
197
|
-
|
|
190
|
+
// Checking component-level behaviors (count: ${componentBehaviors.length})
|
|
198
191
|
this.triggerCrossComponentBehaviors(componentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
199
192
|
}
|
|
200
193
|
|
|
201
194
|
// Evaluate cross-component behaviors if any are registered
|
|
202
|
-
|
|
195
|
+
// Checking cross-component behaviors (count: ${this._crossComponentBehaviors?.length || 0})
|
|
203
196
|
if (this._crossComponentBehaviors && this._crossComponentBehaviors.length > 0) {
|
|
204
197
|
this.triggerCrossComponentBehaviors(this._crossComponentBehaviors, parentUuid, attachmentId, dataPointId, value);
|
|
205
198
|
}
|
|
@@ -218,7 +211,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
218
211
|
this._crossComponentBehaviors = (behaviors || []).map(function (b) {
|
|
219
212
|
return _this2._normalizeBehavior(b);
|
|
220
213
|
});
|
|
221
|
-
|
|
214
|
+
// Loaded ${this._crossComponentBehaviors.length} cross-component behavior(s)
|
|
222
215
|
}
|
|
223
216
|
|
|
224
217
|
/**
|
|
@@ -237,7 +230,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
237
230
|
return _this3._normalizeBehavior(b);
|
|
238
231
|
});
|
|
239
232
|
this._componentBehaviors.set(componentUuid, normalized);
|
|
240
|
-
|
|
233
|
+
// Registered ${normalized.length} component-level behavior(s) for component ${componentUuid}
|
|
241
234
|
}
|
|
242
235
|
|
|
243
236
|
/**
|
|
@@ -348,7 +341,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
348
341
|
key: "configure",
|
|
349
342
|
value: function configure(stateAdapter) {
|
|
350
343
|
this._stateAdapter = stateAdapter || null;
|
|
351
|
-
|
|
344
|
+
// State adapter configured
|
|
352
345
|
}
|
|
353
346
|
|
|
354
347
|
/**
|
|
@@ -364,10 +357,10 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
364
357
|
key: "triggerCrossComponentBehaviors",
|
|
365
358
|
value: function triggerCrossComponentBehaviors(behaviors, triggerParentUuid, triggerAttachmentId, triggerStateId, value) {
|
|
366
359
|
if (!behaviors || !Array.isArray(behaviors)) {
|
|
367
|
-
console.log('[Behavior] No behaviors to evaluate');
|
|
368
360
|
return;
|
|
369
361
|
}
|
|
370
|
-
|
|
362
|
+
|
|
363
|
+
// Evaluating ${behaviors.length} behavior(s)
|
|
371
364
|
var _iterator5 = _createForOfIteratorHelper(behaviors),
|
|
372
365
|
_step5;
|
|
373
366
|
try {
|
|
@@ -402,7 +395,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
402
395
|
|
|
403
396
|
// Verify that the input matches the triggering source
|
|
404
397
|
if (inputComponent === triggerParentUuid && input.attachment === triggerAttachmentId && input.state === triggerStateId) {
|
|
405
|
-
|
|
398
|
+
// Behavior "${behavior.id}" matched
|
|
406
399
|
|
|
407
400
|
// Collect all outputs (single or multiple)
|
|
408
401
|
var outputs = _outputs || (output ? [output] : []);
|
|
@@ -420,14 +413,13 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
420
413
|
|
|
421
414
|
// Direct state mapping without conditions
|
|
422
415
|
if (this._stateAdapter) {
|
|
423
|
-
|
|
416
|
+
// Dispatching state-to-state: ${out.attachment}.${out.state} = ${value}
|
|
424
417
|
this._stateAdapter.setState(out.attachment, out.state, value);
|
|
425
|
-
console.log("[Behavior] \u2713 State-to-state triggered: ".concat(input.attachment, ".").concat(input.state, " (").concat(value, ") \u2192 ").concat(out.attachment, ".").concat(out.state));
|
|
426
418
|
|
|
427
419
|
// Trigger animations on the output component
|
|
428
420
|
// triggerState(attachmentId, dataPointId, value, parentUuid)
|
|
429
421
|
if (outputComponent) {
|
|
430
|
-
|
|
422
|
+
// Triggering animations on output component
|
|
431
423
|
this.triggerState(out.attachment, out.state, value, outputComponent);
|
|
432
424
|
} else {
|
|
433
425
|
console.warn("[Behavior] Could not find component for attachment \"".concat(out.attachment, "\""));
|
|
@@ -438,7 +430,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
438
430
|
}
|
|
439
431
|
// LEGACY: Mesh-based pattern with conditions
|
|
440
432
|
else if (conditions && out.child) {
|
|
441
|
-
|
|
433
|
+
// Using legacy mesh-based pattern with conditions
|
|
442
434
|
// Evaluate conditions
|
|
443
435
|
var _iterator7 = _createForOfIteratorHelper(conditions),
|
|
444
436
|
_step7;
|