@2112-lab/central-plant 0.1.65 → 0.1.67
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 +313 -141
- package/dist/cjs/src/core/centralPlant.js +147 -107
- package/dist/cjs/src/core/centralPlantInternals.js +30 -1
- package/dist/cjs/src/managers/components/componentDataManager.js +136 -33
- package/dist/esm/src/core/centralPlant.js +147 -107
- package/dist/esm/src/core/centralPlantInternals.js +31 -2
- package/dist/esm/src/managers/components/componentDataManager.js +136 -33
- package/package.json +1 -1
package/dist/bundle/index.js
CHANGED
|
@@ -18925,7 +18925,8 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
18925
18925
|
key: "extendComponentDictionary",
|
|
18926
18926
|
value: (function () {
|
|
18927
18927
|
var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(additionalComponents) {
|
|
18928
|
-
var
|
|
18928
|
+
var _this3 = this;
|
|
18929
|
+
var _this$sceneViewer, newComponents, skippedCount, addedCount, modelPreloader, _t;
|
|
18929
18930
|
return _regenerator().w(function (_context3) {
|
|
18930
18931
|
while (1) switch (_context3.n) {
|
|
18931
18932
|
case 0:
|
|
@@ -18947,9 +18948,24 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
18947
18948
|
return _context3.a(2, false);
|
|
18948
18949
|
case 3:
|
|
18949
18950
|
_context3.p = 3;
|
|
18950
|
-
//
|
|
18951
|
-
|
|
18952
|
-
|
|
18951
|
+
// Filter out components that already exist in the dictionary (deduplication)
|
|
18952
|
+
newComponents = {};
|
|
18953
|
+
skippedCount = 0;
|
|
18954
|
+
Object.entries(additionalComponents).forEach(function (_ref3) {
|
|
18955
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
18956
|
+
key = _ref4[0],
|
|
18957
|
+
component = _ref4[1];
|
|
18958
|
+
if (!_this3.componentDictionary[key]) {
|
|
18959
|
+
newComponents[key] = component;
|
|
18960
|
+
} else {
|
|
18961
|
+
skippedCount++;
|
|
18962
|
+
console.log("\u26A0\uFE0F Skipping duplicate component: ".concat(key, " (").concat(component.name || 'unnamed', ")"));
|
|
18963
|
+
}
|
|
18964
|
+
});
|
|
18965
|
+
|
|
18966
|
+
// Merge only new components into dictionary
|
|
18967
|
+
addedCount = Object.keys(newComponents).length;
|
|
18968
|
+
Object.assign(this.componentDictionary, newComponents);
|
|
18953
18969
|
|
|
18954
18970
|
// Update ModelPreloader's dictionary reference
|
|
18955
18971
|
// This ensures drag-and-drop can find S3 components
|
|
@@ -18961,7 +18977,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
18961
18977
|
|
|
18962
18978
|
// Clear cache to force refresh
|
|
18963
18979
|
this.clearCache();
|
|
18964
|
-
console.log("\u2705 extendComponentDictionary(): Added ".concat(addedCount, " components
|
|
18980
|
+
console.log("\u2705 extendComponentDictionary(): Added ".concat(addedCount, " new components (").concat(skippedCount, " duplicates skipped)"));
|
|
18965
18981
|
return _context3.a(2, true);
|
|
18966
18982
|
case 4:
|
|
18967
18983
|
_context3.p = 4;
|
|
@@ -18985,7 +19001,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
18985
19001
|
key: "removeS3Components",
|
|
18986
19002
|
value: (function () {
|
|
18987
19003
|
var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
18988
|
-
var
|
|
19004
|
+
var _this4 = this;
|
|
18989
19005
|
var _this$sceneViewer2, keysToRemove, _i2, _Object$entries2, _Object$entries2$_i, key, component, modelPreloader, _t2;
|
|
18990
19006
|
return _regenerator().w(function (_context4) {
|
|
18991
19007
|
while (1) switch (_context4.n) {
|
|
@@ -19012,7 +19028,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19012
19028
|
|
|
19013
19029
|
// Remove the S3 components
|
|
19014
19030
|
keysToRemove.forEach(function (key) {
|
|
19015
|
-
delete
|
|
19031
|
+
delete _this4.componentDictionary[key];
|
|
19016
19032
|
});
|
|
19017
19033
|
|
|
19018
19034
|
// Update ModelPreloader's dictionary reference
|
|
@@ -19039,6 +19055,72 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19039
19055
|
}
|
|
19040
19056
|
return removeS3Components;
|
|
19041
19057
|
}()
|
|
19058
|
+
/**
|
|
19059
|
+
* Remove a specific component from the dictionary by its key
|
|
19060
|
+
* @param {string} componentKey - The dictionary key of the component to remove (typically UUID)
|
|
19061
|
+
* @returns {Promise<boolean>} True if component was removed successfully
|
|
19062
|
+
*/
|
|
19063
|
+
)
|
|
19064
|
+
}, {
|
|
19065
|
+
key: "removeComponentFromDictionary",
|
|
19066
|
+
value: (function () {
|
|
19067
|
+
var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(componentKey) {
|
|
19068
|
+
var _this$sceneViewer3, modelPreloader, _t3;
|
|
19069
|
+
return _regenerator().w(function (_context5) {
|
|
19070
|
+
while (1) switch (_context5.n) {
|
|
19071
|
+
case 0:
|
|
19072
|
+
_context5.n = 1;
|
|
19073
|
+
return this.ensureDictionaryLoaded();
|
|
19074
|
+
case 1:
|
|
19075
|
+
if (this.componentDictionary) {
|
|
19076
|
+
_context5.n = 2;
|
|
19077
|
+
break;
|
|
19078
|
+
}
|
|
19079
|
+
console.warn('⚠️ removeComponentFromDictionary(): Component dictionary not loaded yet');
|
|
19080
|
+
return _context5.a(2, false);
|
|
19081
|
+
case 2:
|
|
19082
|
+
if (componentKey) {
|
|
19083
|
+
_context5.n = 3;
|
|
19084
|
+
break;
|
|
19085
|
+
}
|
|
19086
|
+
console.warn('⚠️ removeComponentFromDictionary(): No component key provided');
|
|
19087
|
+
return _context5.a(2, false);
|
|
19088
|
+
case 3:
|
|
19089
|
+
_context5.p = 3;
|
|
19090
|
+
if (this.componentDictionary[componentKey]) {
|
|
19091
|
+
_context5.n = 4;
|
|
19092
|
+
break;
|
|
19093
|
+
}
|
|
19094
|
+
console.warn("\u26A0\uFE0F removeComponentFromDictionary(): Component ".concat(componentKey, " not found in dictionary"));
|
|
19095
|
+
return _context5.a(2, false);
|
|
19096
|
+
case 4:
|
|
19097
|
+
// Remove the component
|
|
19098
|
+
delete this.componentDictionary[componentKey];
|
|
19099
|
+
|
|
19100
|
+
// Update ModelPreloader's dictionary reference
|
|
19101
|
+
modelPreloader = (_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.centralPlant) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.utilities) === null || _this$sceneViewer3 === void 0 ? void 0 : _this$sceneViewer3.modelPreloader;
|
|
19102
|
+
if (modelPreloader) {
|
|
19103
|
+
modelPreloader.componentDictionary = this.componentDictionary;
|
|
19104
|
+
console.log("\uD83D\uDD04 Updated ModelPreloader's dictionary reference (".concat(Object.keys(this.componentDictionary).length, " total components)"));
|
|
19105
|
+
}
|
|
19106
|
+
|
|
19107
|
+
// Clear cache to force refresh
|
|
19108
|
+
this.clearCache();
|
|
19109
|
+
console.log("\u2705 removeComponentFromDictionary(): Removed component ".concat(componentKey, " from dictionary"));
|
|
19110
|
+
return _context5.a(2, true);
|
|
19111
|
+
case 5:
|
|
19112
|
+
_context5.p = 5;
|
|
19113
|
+
_t3 = _context5.v;
|
|
19114
|
+
console.error("\u274C removeComponentFromDictionary(): Error removing component ".concat(componentKey, ":"), _t3);
|
|
19115
|
+
return _context5.a(2, false);
|
|
19116
|
+
}
|
|
19117
|
+
}, _callee5, this, [[3, 5]]);
|
|
19118
|
+
}));
|
|
19119
|
+
function removeComponentFromDictionary(_x2) {
|
|
19120
|
+
return _removeComponentFromDictionary.apply(this, arguments);
|
|
19121
|
+
}
|
|
19122
|
+
return removeComponentFromDictionary;
|
|
19123
|
+
}()
|
|
19042
19124
|
/**
|
|
19043
19125
|
* Clear the component cache
|
|
19044
19126
|
*/
|
|
@@ -19051,49 +19133,70 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19051
19133
|
}
|
|
19052
19134
|
|
|
19053
19135
|
/**
|
|
19054
|
-
* Load component dictionary from static file
|
|
19136
|
+
* Load component dictionary from static file with caching
|
|
19055
19137
|
* @private
|
|
19056
19138
|
* @returns {Promise<void>} Promise that resolves when dictionary is loaded
|
|
19057
19139
|
*/
|
|
19058
19140
|
}, {
|
|
19059
19141
|
key: "_loadComponentDictionary",
|
|
19060
19142
|
value: (function () {
|
|
19061
|
-
var _loadComponentDictionary2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
19062
|
-
var response,
|
|
19063
|
-
return _regenerator().w(function (
|
|
19064
|
-
while (1) switch (
|
|
19143
|
+
var _loadComponentDictionary2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
19144
|
+
var _yield$import, getCachedLocalJson, response, _t4, _t5;
|
|
19145
|
+
return _regenerator().w(function (_context6) {
|
|
19146
|
+
while (1) switch (_context6.n) {
|
|
19065
19147
|
case 0:
|
|
19066
|
-
|
|
19067
|
-
|
|
19148
|
+
_context6.p = 0;
|
|
19149
|
+
if (!(typeof window !== 'undefined' && 'caches' in window)) {
|
|
19150
|
+
_context6.n = 5;
|
|
19151
|
+
break;
|
|
19152
|
+
}
|
|
19153
|
+
_context6.p = 1;
|
|
19154
|
+
_context6.n = 2;
|
|
19155
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('~/utils/s3Cache')); });
|
|
19156
|
+
case 2:
|
|
19157
|
+
_yield$import = _context6.v;
|
|
19158
|
+
getCachedLocalJson = _yield$import.getCachedLocalJson;
|
|
19159
|
+
_context6.n = 3;
|
|
19160
|
+
return getCachedLocalJson('/library/component-dictionary.json');
|
|
19161
|
+
case 3:
|
|
19162
|
+
this.componentDictionary = _context6.v;
|
|
19163
|
+
console.log('📚 ComponentDataManager: Component dictionary loaded from cache');
|
|
19164
|
+
return _context6.a(2);
|
|
19165
|
+
case 4:
|
|
19166
|
+
_context6.p = 4;
|
|
19167
|
+
_t4 = _context6.v;
|
|
19168
|
+
console.warn('⚠️ ComponentDataManager: Cache load failed, falling back to direct fetch:', _t4);
|
|
19169
|
+
case 5:
|
|
19170
|
+
_context6.n = 6;
|
|
19068
19171
|
return fetch('/library/component-dictionary.json');
|
|
19069
|
-
case
|
|
19070
|
-
response =
|
|
19172
|
+
case 6:
|
|
19173
|
+
response = _context6.v;
|
|
19071
19174
|
if (!response.ok) {
|
|
19072
|
-
|
|
19175
|
+
_context6.n = 8;
|
|
19073
19176
|
break;
|
|
19074
19177
|
}
|
|
19075
|
-
|
|
19178
|
+
_context6.n = 7;
|
|
19076
19179
|
return response.json();
|
|
19077
|
-
case
|
|
19078
|
-
this.componentDictionary =
|
|
19180
|
+
case 7:
|
|
19181
|
+
this.componentDictionary = _context6.v;
|
|
19079
19182
|
console.log('📚 ComponentDataManager: Component dictionary loaded successfully');
|
|
19080
|
-
|
|
19183
|
+
_context6.n = 9;
|
|
19081
19184
|
break;
|
|
19082
|
-
case
|
|
19185
|
+
case 8:
|
|
19083
19186
|
console.warn('⚠️ ComponentDataManager: Could not load component dictionary');
|
|
19084
19187
|
this.componentDictionary = null;
|
|
19085
|
-
case
|
|
19086
|
-
|
|
19188
|
+
case 9:
|
|
19189
|
+
_context6.n = 11;
|
|
19087
19190
|
break;
|
|
19088
|
-
case
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
console.warn('⚠️ ComponentDataManager: Error loading component dictionary:',
|
|
19191
|
+
case 10:
|
|
19192
|
+
_context6.p = 10;
|
|
19193
|
+
_t5 = _context6.v;
|
|
19194
|
+
console.warn('⚠️ ComponentDataManager: Error loading component dictionary:', _t5);
|
|
19092
19195
|
this.componentDictionary = null;
|
|
19093
|
-
case
|
|
19094
|
-
return
|
|
19196
|
+
case 11:
|
|
19197
|
+
return _context6.a(2);
|
|
19095
19198
|
}
|
|
19096
|
-
},
|
|
19199
|
+
}, _callee6, this, [[1, 4], [0, 10]]);
|
|
19097
19200
|
}));
|
|
19098
19201
|
function _loadComponentDictionary() {
|
|
19099
19202
|
return _loadComponentDictionary2.apply(this, arguments);
|
|
@@ -19143,7 +19246,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19143
19246
|
}, {
|
|
19144
19247
|
key: "_traverseScene",
|
|
19145
19248
|
value: function _traverseScene(object) {
|
|
19146
|
-
var
|
|
19249
|
+
var _this5 = this;
|
|
19147
19250
|
var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
19148
19251
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
19149
19252
|
if (!object) return components;
|
|
@@ -19159,7 +19262,7 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
19159
19262
|
// Recursively traverse children
|
|
19160
19263
|
if (object.children && object.children.length > 0) {
|
|
19161
19264
|
object.children.forEach(function (child) {
|
|
19162
|
-
|
|
19265
|
+
_this5._traverseScene(child, components, options);
|
|
19163
19266
|
});
|
|
19164
19267
|
}
|
|
19165
19268
|
return components;
|
|
@@ -34259,7 +34362,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
34259
34362
|
return false;
|
|
34260
34363
|
}
|
|
34261
34364
|
try {
|
|
34262
|
-
var _this$centralPlant$sc6;
|
|
34365
|
+
var _componentData$childr, _componentData$childr2, _this$centralPlant$sc6, _componentData$childr3;
|
|
34263
34366
|
// Generate a unique component ID if not provided
|
|
34264
34367
|
var componentId = options.customId || this.generateUniqueComponentId(libraryId);
|
|
34265
34368
|
|
|
@@ -34289,6 +34392,18 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
34289
34392
|
return false;
|
|
34290
34393
|
}
|
|
34291
34394
|
|
|
34395
|
+
// DEBUG: Log component data structure to diagnose connector issues
|
|
34396
|
+
console.log("\uD83D\uDD0D addComponent(): Component data for ".concat(libraryId, ":"), {
|
|
34397
|
+
modelKey: componentData.modelKey,
|
|
34398
|
+
isS3Component: componentData.isS3Component,
|
|
34399
|
+
hasChildren: !!componentData.children,
|
|
34400
|
+
childrenCount: ((_componentData$childr = componentData.children) === null || _componentData$childr === void 0 ? void 0 : _componentData$childr.length) || 0,
|
|
34401
|
+
childrenIsArray: Array.isArray(componentData.children),
|
|
34402
|
+
componentDataKeys: Object.keys(componentData),
|
|
34403
|
+
firstChild: (_componentData$childr2 = componentData.children) === null || _componentData$childr2 === void 0 ? void 0 : _componentData$childr2[0],
|
|
34404
|
+
fullComponentData: componentData // Log EVERYTHING
|
|
34405
|
+
});
|
|
34406
|
+
|
|
34292
34407
|
// Get the cached model using the modelKey
|
|
34293
34408
|
var cachedModel = modelPreloader.getCachedModelWithDimensions(componentData.modelKey, libraryId);
|
|
34294
34409
|
if (!cachedModel) {
|
|
@@ -34347,8 +34462,25 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
34347
34462
|
}
|
|
34348
34463
|
|
|
34349
34464
|
// Add children connectors from component dictionary
|
|
34465
|
+
console.log("\uD83D\uDD0D addComponent(): Checking for connectors in ".concat(libraryId, ":"), {
|
|
34466
|
+
hasChildren: !!componentData.children,
|
|
34467
|
+
childrenType: _typeof(componentData.children),
|
|
34468
|
+
isArray: Array.isArray(componentData.children),
|
|
34469
|
+
length: (_componentData$childr3 = componentData.children) === null || _componentData$childr3 === void 0 ? void 0 : _componentData$childr3.length,
|
|
34470
|
+
children: componentData.children,
|
|
34471
|
+
dictionaryKeysCount: Object.keys(modelPreloader.componentDictionary).length
|
|
34472
|
+
});
|
|
34350
34473
|
if (componentData.children && Array.isArray(componentData.children)) {
|
|
34351
34474
|
console.log("\uD83D\uDD0C addComponent(): Adding ".concat(componentData.children.length, " connectors for ").concat(libraryId));
|
|
34475
|
+
console.log("\uD83D\uDD0C Connector details:", componentData.children.map(function (c, i) {
|
|
34476
|
+
var _c$userData;
|
|
34477
|
+
return {
|
|
34478
|
+
index: i,
|
|
34479
|
+
uuid: c.uuid,
|
|
34480
|
+
position: c.position,
|
|
34481
|
+
direction: (_c$userData = c.userData) === null || _c$userData === void 0 ? void 0 : _c$userData.direction
|
|
34482
|
+
};
|
|
34483
|
+
}));
|
|
34352
34484
|
componentData.children.forEach(function (childData, index) {
|
|
34353
34485
|
try {
|
|
34354
34486
|
var _childData$userData, _childData$userData2;
|
|
@@ -34473,7 +34605,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
34473
34605
|
* Initialize the CentralPlant manager
|
|
34474
34606
|
*
|
|
34475
34607
|
* @constructor
|
|
34476
|
-
* @version 0.1.
|
|
34608
|
+
* @version 0.1.67
|
|
34477
34609
|
* @updated 2025-10-22
|
|
34478
34610
|
*
|
|
34479
34611
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -35718,6 +35850,46 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35718
35850
|
}
|
|
35719
35851
|
return removeS3Components;
|
|
35720
35852
|
}()
|
|
35853
|
+
/**
|
|
35854
|
+
* Remove a specific component from the dictionary by its key
|
|
35855
|
+
* @param {string} componentKey - The dictionary key of the component to remove (typically UUID)
|
|
35856
|
+
* @returns {Promise<boolean>} True if component was removed successfully, false otherwise
|
|
35857
|
+
* @description Removes a single component from the component dictionary by its key.
|
|
35858
|
+
* This is typically used when deleting user-uploaded S3 components.
|
|
35859
|
+
* @example
|
|
35860
|
+
* // Remove a specific component by UUID
|
|
35861
|
+
* const success = await centralPlant.removeComponentFromDictionary('my-component-uuid-123');
|
|
35862
|
+
* if (success) {
|
|
35863
|
+
* console.log('Component removed from dictionary');
|
|
35864
|
+
* }
|
|
35865
|
+
*/
|
|
35866
|
+
)
|
|
35867
|
+
}, {
|
|
35868
|
+
key: "removeComponentFromDictionary",
|
|
35869
|
+
value: (function () {
|
|
35870
|
+
var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(componentKey) {
|
|
35871
|
+
return _regenerator().w(function (_context5) {
|
|
35872
|
+
while (1) switch (_context5.n) {
|
|
35873
|
+
case 0:
|
|
35874
|
+
if (this.managers.componentDataManager) {
|
|
35875
|
+
_context5.n = 1;
|
|
35876
|
+
break;
|
|
35877
|
+
}
|
|
35878
|
+
console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
|
|
35879
|
+
return _context5.a(2, false);
|
|
35880
|
+
case 1:
|
|
35881
|
+
_context5.n = 2;
|
|
35882
|
+
return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
|
|
35883
|
+
case 2:
|
|
35884
|
+
return _context5.a(2, _context5.v);
|
|
35885
|
+
}
|
|
35886
|
+
}, _callee5, this);
|
|
35887
|
+
}));
|
|
35888
|
+
function removeComponentFromDictionary(_x3) {
|
|
35889
|
+
return _removeComponentFromDictionary.apply(this, arguments);
|
|
35890
|
+
}
|
|
35891
|
+
return removeComponentFromDictionary;
|
|
35892
|
+
}()
|
|
35721
35893
|
/**
|
|
35722
35894
|
* Select an object (component, connector, or gateway) in the scene by its ID
|
|
35723
35895
|
* @param {string} objectId - The UUID or name of the object to select
|
|
@@ -35915,51 +36087,51 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35915
36087
|
}, {
|
|
35916
36088
|
key: "initialize2DViewport",
|
|
35917
36089
|
value: function () {
|
|
35918
|
-
var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36090
|
+
var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(container) {
|
|
35919
36091
|
var viewType,
|
|
35920
36092
|
instanceKey,
|
|
35921
36093
|
success,
|
|
35922
|
-
|
|
36094
|
+
_args6 = arguments,
|
|
35923
36095
|
_t2;
|
|
35924
|
-
return _regenerator().w(function (
|
|
35925
|
-
while (1) switch (
|
|
36096
|
+
return _regenerator().w(function (_context6) {
|
|
36097
|
+
while (1) switch (_context6.n) {
|
|
35926
36098
|
case 0:
|
|
35927
|
-
viewType =
|
|
35928
|
-
instanceKey =
|
|
36099
|
+
viewType = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : 'top';
|
|
36100
|
+
instanceKey = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : null;
|
|
35929
36101
|
if (container) {
|
|
35930
|
-
|
|
36102
|
+
_context6.n = 1;
|
|
35931
36103
|
break;
|
|
35932
36104
|
}
|
|
35933
36105
|
console.warn('⚠️ initialize2DViewport(): No container provided');
|
|
35934
|
-
return
|
|
36106
|
+
return _context6.a(2, false);
|
|
35935
36107
|
case 1:
|
|
35936
36108
|
if (this.managers.viewport2DManager) {
|
|
35937
|
-
|
|
36109
|
+
_context6.n = 2;
|
|
35938
36110
|
break;
|
|
35939
36111
|
}
|
|
35940
36112
|
console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
|
|
35941
|
-
return
|
|
36113
|
+
return _context6.a(2, false);
|
|
35942
36114
|
case 2:
|
|
35943
|
-
|
|
35944
|
-
|
|
36115
|
+
_context6.p = 2;
|
|
36116
|
+
_context6.n = 3;
|
|
35945
36117
|
return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
|
|
35946
36118
|
case 3:
|
|
35947
|
-
success =
|
|
36119
|
+
success = _context6.v;
|
|
35948
36120
|
if (success) {
|
|
35949
36121
|
console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
|
|
35950
36122
|
} else {
|
|
35951
36123
|
console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
|
|
35952
36124
|
}
|
|
35953
|
-
return
|
|
36125
|
+
return _context6.a(2, success);
|
|
35954
36126
|
case 4:
|
|
35955
|
-
|
|
35956
|
-
_t2 =
|
|
36127
|
+
_context6.p = 4;
|
|
36128
|
+
_t2 = _context6.v;
|
|
35957
36129
|
console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
|
|
35958
|
-
return
|
|
36130
|
+
return _context6.a(2, false);
|
|
35959
36131
|
}
|
|
35960
|
-
},
|
|
36132
|
+
}, _callee6, this, [[2, 4]]);
|
|
35961
36133
|
}));
|
|
35962
|
-
function initialize2DViewport(
|
|
36134
|
+
function initialize2DViewport(_x4) {
|
|
35963
36135
|
return _initialize2DViewport.apply(this, arguments);
|
|
35964
36136
|
}
|
|
35965
36137
|
return initialize2DViewport;
|
|
@@ -36105,7 +36277,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36105
36277
|
}, {
|
|
36106
36278
|
key: "initializeModelPreloading",
|
|
36107
36279
|
value: (function () {
|
|
36108
|
-
var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36280
|
+
var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
36109
36281
|
var basePath,
|
|
36110
36282
|
normalizedBasePath,
|
|
36111
36283
|
dictionaryPath,
|
|
@@ -36114,13 +36286,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36114
36286
|
componentDictionary,
|
|
36115
36287
|
_modelPreloader2,
|
|
36116
36288
|
progress,
|
|
36117
|
-
|
|
36289
|
+
_args7 = arguments,
|
|
36118
36290
|
_t3;
|
|
36119
|
-
return _regenerator().w(function (
|
|
36120
|
-
while (1) switch (
|
|
36291
|
+
return _regenerator().w(function (_context7) {
|
|
36292
|
+
while (1) switch (_context7.n) {
|
|
36121
36293
|
case 0:
|
|
36122
|
-
basePath =
|
|
36123
|
-
|
|
36294
|
+
basePath = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : '/library/';
|
|
36295
|
+
_context7.p = 1;
|
|
36124
36296
|
// Ensure basePath ends with a slash
|
|
36125
36297
|
normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
|
|
36126
36298
|
dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
|
|
@@ -36131,39 +36303,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36131
36303
|
console.log("\uFFFD Models path: ".concat(modelsBasePath));
|
|
36132
36304
|
|
|
36133
36305
|
// Load the component dictionary
|
|
36134
|
-
|
|
36306
|
+
_context7.n = 2;
|
|
36135
36307
|
return fetch(dictionaryPath);
|
|
36136
36308
|
case 2:
|
|
36137
|
-
response =
|
|
36309
|
+
response = _context7.v;
|
|
36138
36310
|
if (response.ok) {
|
|
36139
|
-
|
|
36311
|
+
_context7.n = 3;
|
|
36140
36312
|
break;
|
|
36141
36313
|
}
|
|
36142
36314
|
throw new Error("Failed to load component dictionary: ".concat(response.status));
|
|
36143
36315
|
case 3:
|
|
36144
|
-
|
|
36316
|
+
_context7.n = 4;
|
|
36145
36317
|
return response.json();
|
|
36146
36318
|
case 4:
|
|
36147
|
-
componentDictionary =
|
|
36319
|
+
componentDictionary = _context7.v;
|
|
36148
36320
|
console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
|
|
36149
36321
|
|
|
36150
36322
|
// Start preloading all models with the specified base path
|
|
36151
36323
|
_modelPreloader2 = this.getUtility('modelPreloader');
|
|
36152
|
-
|
|
36324
|
+
_context7.n = 5;
|
|
36153
36325
|
return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
|
|
36154
36326
|
case 5:
|
|
36155
|
-
progress =
|
|
36327
|
+
progress = _context7.v;
|
|
36156
36328
|
console.log('🎉 Model preloading completed:', progress);
|
|
36157
|
-
return
|
|
36329
|
+
return _context7.a(2, progress);
|
|
36158
36330
|
case 6:
|
|
36159
|
-
|
|
36160
|
-
_t3 =
|
|
36331
|
+
_context7.p = 6;
|
|
36332
|
+
_t3 = _context7.v;
|
|
36161
36333
|
console.error('❌ Failed to initialize model preloading:', _t3);
|
|
36162
36334
|
throw _t3;
|
|
36163
36335
|
case 7:
|
|
36164
|
-
return
|
|
36336
|
+
return _context7.a(2);
|
|
36165
36337
|
}
|
|
36166
|
-
},
|
|
36338
|
+
}, _callee7, this, [[1, 6]]);
|
|
36167
36339
|
}));
|
|
36168
36340
|
function initializeModelPreloading() {
|
|
36169
36341
|
return _initializeModelPreloading.apply(this, arguments);
|
|
@@ -36180,57 +36352,57 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36180
36352
|
}, {
|
|
36181
36353
|
key: "importScene",
|
|
36182
36354
|
value: (function () {
|
|
36183
|
-
var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36355
|
+
var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(jsonData) {
|
|
36184
36356
|
var validation, _t4;
|
|
36185
|
-
return _regenerator().w(function (
|
|
36186
|
-
while (1) switch (
|
|
36357
|
+
return _regenerator().w(function (_context8) {
|
|
36358
|
+
while (1) switch (_context8.n) {
|
|
36187
36359
|
case 0:
|
|
36188
36360
|
if (jsonData) {
|
|
36189
|
-
|
|
36361
|
+
_context8.n = 1;
|
|
36190
36362
|
break;
|
|
36191
36363
|
}
|
|
36192
36364
|
console.error('❌ No JSON data provided for import');
|
|
36193
|
-
return
|
|
36365
|
+
return _context8.a(2, false);
|
|
36194
36366
|
case 1:
|
|
36195
|
-
|
|
36367
|
+
_context8.p = 1;
|
|
36196
36368
|
// Validate scene data structure
|
|
36197
36369
|
validation = this.internals.validateAndAnalyzeSceneData(jsonData);
|
|
36198
36370
|
if (validation.isValid) {
|
|
36199
|
-
|
|
36371
|
+
_context8.n = 2;
|
|
36200
36372
|
break;
|
|
36201
36373
|
}
|
|
36202
36374
|
console.error('❌ Invalid scene data format:', validation.message);
|
|
36203
|
-
return
|
|
36375
|
+
return _context8.a(2, false);
|
|
36204
36376
|
case 2:
|
|
36205
|
-
|
|
36377
|
+
_context8.n = 3;
|
|
36206
36378
|
return this.setImportedSceneData(jsonData);
|
|
36207
36379
|
case 3:
|
|
36208
36380
|
if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
|
|
36209
|
-
|
|
36381
|
+
_context8.n = 5;
|
|
36210
36382
|
break;
|
|
36211
36383
|
}
|
|
36212
|
-
|
|
36384
|
+
_context8.n = 4;
|
|
36213
36385
|
return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
|
|
36214
36386
|
case 4:
|
|
36215
36387
|
console.log('✅ Scene imported successfully');
|
|
36216
|
-
return
|
|
36388
|
+
return _context8.a(2, true);
|
|
36217
36389
|
case 5:
|
|
36218
36390
|
console.error('❌ SceneViewer not available for scene loading');
|
|
36219
|
-
return
|
|
36391
|
+
return _context8.a(2, false);
|
|
36220
36392
|
case 6:
|
|
36221
|
-
|
|
36393
|
+
_context8.n = 8;
|
|
36222
36394
|
break;
|
|
36223
36395
|
case 7:
|
|
36224
|
-
|
|
36225
|
-
_t4 =
|
|
36396
|
+
_context8.p = 7;
|
|
36397
|
+
_t4 = _context8.v;
|
|
36226
36398
|
console.error('❌ Error importing scene:', _t4);
|
|
36227
|
-
return
|
|
36399
|
+
return _context8.a(2, false);
|
|
36228
36400
|
case 8:
|
|
36229
|
-
return
|
|
36401
|
+
return _context8.a(2);
|
|
36230
36402
|
}
|
|
36231
|
-
},
|
|
36403
|
+
}, _callee8, this, [[1, 7]]);
|
|
36232
36404
|
}));
|
|
36233
|
-
function importScene(
|
|
36405
|
+
function importScene(_x5) {
|
|
36234
36406
|
return _importScene.apply(this, arguments);
|
|
36235
36407
|
}
|
|
36236
36408
|
return importScene;
|
|
@@ -36252,33 +36424,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36252
36424
|
}, {
|
|
36253
36425
|
key: "exportSceneJSON",
|
|
36254
36426
|
value: (function () {
|
|
36255
|
-
var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36427
|
+
var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
36256
36428
|
var filename,
|
|
36257
|
-
|
|
36429
|
+
_args9 = arguments,
|
|
36258
36430
|
_t5;
|
|
36259
|
-
return _regenerator().w(function (
|
|
36260
|
-
while (1) switch (
|
|
36431
|
+
return _regenerator().w(function (_context9) {
|
|
36432
|
+
while (1) switch (_context9.n) {
|
|
36261
36433
|
case 0:
|
|
36262
|
-
filename =
|
|
36434
|
+
filename = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : null;
|
|
36263
36435
|
if (this.managers.sceneExportManager) {
|
|
36264
|
-
|
|
36436
|
+
_context9.n = 1;
|
|
36265
36437
|
break;
|
|
36266
36438
|
}
|
|
36267
36439
|
console.error('❌ Scene export manager not available');
|
|
36268
|
-
return
|
|
36440
|
+
return _context9.a(2, false);
|
|
36269
36441
|
case 1:
|
|
36270
|
-
|
|
36271
|
-
|
|
36442
|
+
_context9.p = 1;
|
|
36443
|
+
_context9.n = 2;
|
|
36272
36444
|
return this.managers.sceneExportManager.downloadSceneJSON(filename);
|
|
36273
36445
|
case 2:
|
|
36274
|
-
return
|
|
36446
|
+
return _context9.a(2, _context9.v);
|
|
36275
36447
|
case 3:
|
|
36276
|
-
|
|
36277
|
-
_t5 =
|
|
36448
|
+
_context9.p = 3;
|
|
36449
|
+
_t5 = _context9.v;
|
|
36278
36450
|
console.error('❌ Error exporting scene as JSON:', _t5);
|
|
36279
|
-
return
|
|
36451
|
+
return _context9.a(2, false);
|
|
36280
36452
|
}
|
|
36281
|
-
},
|
|
36453
|
+
}, _callee9, this, [[1, 3]]);
|
|
36282
36454
|
}));
|
|
36283
36455
|
function exportSceneJSON() {
|
|
36284
36456
|
return _exportSceneJSON.apply(this, arguments);
|
|
@@ -36303,33 +36475,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36303
36475
|
}, {
|
|
36304
36476
|
key: "exportSceneGLTF",
|
|
36305
36477
|
value: (function () {
|
|
36306
|
-
var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36478
|
+
var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
36307
36479
|
var filename,
|
|
36308
|
-
|
|
36480
|
+
_args0 = arguments,
|
|
36309
36481
|
_t6;
|
|
36310
|
-
return _regenerator().w(function (
|
|
36311
|
-
while (1) switch (
|
|
36482
|
+
return _regenerator().w(function (_context0) {
|
|
36483
|
+
while (1) switch (_context0.n) {
|
|
36312
36484
|
case 0:
|
|
36313
|
-
filename =
|
|
36485
|
+
filename = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : null;
|
|
36314
36486
|
if (this.managers.sceneExportManager) {
|
|
36315
|
-
|
|
36487
|
+
_context0.n = 1;
|
|
36316
36488
|
break;
|
|
36317
36489
|
}
|
|
36318
36490
|
console.error('❌ Scene export manager not available');
|
|
36319
|
-
return
|
|
36491
|
+
return _context0.a(2, false);
|
|
36320
36492
|
case 1:
|
|
36321
|
-
|
|
36322
|
-
|
|
36493
|
+
_context0.p = 1;
|
|
36494
|
+
_context0.n = 2;
|
|
36323
36495
|
return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
|
|
36324
36496
|
case 2:
|
|
36325
|
-
return
|
|
36497
|
+
return _context0.a(2, _context0.v);
|
|
36326
36498
|
case 3:
|
|
36327
|
-
|
|
36328
|
-
_t6 =
|
|
36499
|
+
_context0.p = 3;
|
|
36500
|
+
_t6 = _context0.v;
|
|
36329
36501
|
console.error('❌ Error exporting scene as GLTF:', _t6);
|
|
36330
|
-
return
|
|
36502
|
+
return _context0.a(2, false);
|
|
36331
36503
|
}
|
|
36332
|
-
},
|
|
36504
|
+
}, _callee0, this, [[1, 3]]);
|
|
36333
36505
|
}));
|
|
36334
36506
|
function exportSceneGLTF() {
|
|
36335
36507
|
return _exportSceneGLTF.apply(this, arguments);
|
|
@@ -36355,33 +36527,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36355
36527
|
}, {
|
|
36356
36528
|
key: "exportSceneGLB",
|
|
36357
36529
|
value: (function () {
|
|
36358
|
-
var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36530
|
+
var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
36359
36531
|
var filename,
|
|
36360
|
-
|
|
36532
|
+
_args1 = arguments,
|
|
36361
36533
|
_t7;
|
|
36362
|
-
return _regenerator().w(function (
|
|
36363
|
-
while (1) switch (
|
|
36534
|
+
return _regenerator().w(function (_context1) {
|
|
36535
|
+
while (1) switch (_context1.n) {
|
|
36364
36536
|
case 0:
|
|
36365
|
-
filename =
|
|
36537
|
+
filename = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : null;
|
|
36366
36538
|
if (this.managers.sceneExportManager) {
|
|
36367
|
-
|
|
36539
|
+
_context1.n = 1;
|
|
36368
36540
|
break;
|
|
36369
36541
|
}
|
|
36370
36542
|
console.error('❌ Scene export manager not available');
|
|
36371
|
-
return
|
|
36543
|
+
return _context1.a(2, false);
|
|
36372
36544
|
case 1:
|
|
36373
|
-
|
|
36374
|
-
|
|
36545
|
+
_context1.p = 1;
|
|
36546
|
+
_context1.n = 2;
|
|
36375
36547
|
return this.managers.sceneExportManager.exportSceneAsGLB(filename);
|
|
36376
36548
|
case 2:
|
|
36377
|
-
return
|
|
36549
|
+
return _context1.a(2, _context1.v);
|
|
36378
36550
|
case 3:
|
|
36379
|
-
|
|
36380
|
-
_t7 =
|
|
36551
|
+
_context1.p = 3;
|
|
36552
|
+
_t7 = _context1.v;
|
|
36381
36553
|
console.error('❌ Error exporting scene as GLB:', _t7);
|
|
36382
|
-
return
|
|
36554
|
+
return _context1.a(2, false);
|
|
36383
36555
|
}
|
|
36384
|
-
},
|
|
36556
|
+
}, _callee1, this, [[1, 3]]);
|
|
36385
36557
|
}));
|
|
36386
36558
|
function exportSceneGLB() {
|
|
36387
36559
|
return _exportSceneGLB.apply(this, arguments);
|
|
@@ -36420,18 +36592,18 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
36420
36592
|
}, {
|
|
36421
36593
|
key: "loadSceneFromData",
|
|
36422
36594
|
value: (function () {
|
|
36423
|
-
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
36424
|
-
return _regenerator().w(function (
|
|
36425
|
-
while (1) switch (
|
|
36595
|
+
var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(sceneData) {
|
|
36596
|
+
return _regenerator().w(function (_context10) {
|
|
36597
|
+
while (1) switch (_context10.n) {
|
|
36426
36598
|
case 0:
|
|
36427
|
-
|
|
36599
|
+
_context10.n = 1;
|
|
36428
36600
|
return this.setImportedSceneData(sceneData);
|
|
36429
36601
|
case 1:
|
|
36430
|
-
return
|
|
36602
|
+
return _context10.a(2, true);
|
|
36431
36603
|
}
|
|
36432
|
-
},
|
|
36604
|
+
}, _callee10, this);
|
|
36433
36605
|
}));
|
|
36434
|
-
function loadSceneFromData(
|
|
36606
|
+
function loadSceneFromData(_x6) {
|
|
36435
36607
|
return _loadSceneFromData.apply(this, arguments);
|
|
36436
36608
|
}
|
|
36437
36609
|
return loadSceneFromData;
|