@2112-lab/central-plant 0.3.27 → 0.3.28
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 +43 -872
- package/dist/cjs/src/core/centralPlant.js +8 -115
- package/dist/cjs/src/core/centralPlantInternals.js +6 -17
- package/dist/cjs/src/core/sceneViewer.js +1 -1
- package/dist/cjs/src/index.js +0 -2
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +13 -20
- package/dist/cjs/src/managers/scene/sceneExportManager.js +3 -29
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +12 -289
- package/dist/esm/src/core/centralPlant.js +8 -115
- package/dist/esm/src/core/centralPlantInternals.js +6 -17
- package/dist/esm/src/core/sceneViewer.js +1 -1
- package/dist/esm/src/index.js +0 -1
- package/dist/esm/src/managers/scene/componentTooltipManager.js +13 -20
- package/dist/esm/src/managers/scene/sceneExportManager.js +4 -30
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +12 -289
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35
35
|
* Initialize the CentralPlant manager
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
|
-
* @version 0.3.
|
|
38
|
+
* @version 0.3.28
|
|
39
39
|
* @updated 2025-10-22
|
|
40
40
|
*
|
|
41
41
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -1069,107 +1069,6 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1069
1069
|
};
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
1073
|
-
// BEHAVIORS API
|
|
1074
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
1075
|
-
|
|
1076
|
-
/**
|
|
1077
|
-
* Get all behavior definitions currently stored in the BehaviorManager.
|
|
1078
|
-
* @returns {Array<Object>} Array of behavior definition objects, or empty array.
|
|
1079
|
-
* @example
|
|
1080
|
-
* const behaviors = centralPlant.getBehaviors()
|
|
1081
|
-
* behaviors.forEach(b => console.log(b.id, b.input, b.output))
|
|
1082
|
-
*/
|
|
1083
|
-
}, {
|
|
1084
|
-
key: "getBehaviors",
|
|
1085
|
-
value: function getBehaviors() {
|
|
1086
|
-
var _this$sceneViewer4;
|
|
1087
|
-
var bm = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 || (_this$sceneViewer4 = _this$sceneViewer4.managers) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.behaviorManager;
|
|
1088
|
-
if (!bm) {
|
|
1089
|
-
console.warn('⚠️ getBehaviors(): BehaviorManager not available');
|
|
1090
|
-
return [];
|
|
1091
|
-
}
|
|
1092
|
-
return bm.getBehaviors();
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
/**
|
|
1096
|
-
* Add a behavior definition at runtime.
|
|
1097
|
-
* @param {Object} behaviorDef - Full behavior definition object (must have unique `id`)
|
|
1098
|
-
* @returns {boolean} True if added successfully, false otherwise
|
|
1099
|
-
* @example
|
|
1100
|
-
* centralPlant.addBehavior({
|
|
1101
|
-
* id: 'my-behavior',
|
|
1102
|
-
* input: { attachment: 'device-01', dataPoint: 'boolean-status-01' },
|
|
1103
|
-
* output: { attachment: 'light-01', child: 'indicator-mesh-01' },
|
|
1104
|
-
* conditions: [{ when: 'dataPoint.value === true', actions: [{ set: 'material.emissiveIntensity', value: 1.0 }] }]
|
|
1105
|
-
* })
|
|
1106
|
-
*/
|
|
1107
|
-
}, {
|
|
1108
|
-
key: "addBehavior",
|
|
1109
|
-
value: function addBehavior(behaviorDef) {
|
|
1110
|
-
var _this$sceneViewer5, _this$sceneViewer6;
|
|
1111
|
-
var bm = (_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.behaviorManager;
|
|
1112
|
-
if (!bm) {
|
|
1113
|
-
console.warn('⚠️ addBehavior(): BehaviorManager not available');
|
|
1114
|
-
return false;
|
|
1115
|
-
}
|
|
1116
|
-
// Also persist into currentSceneData so export includes it
|
|
1117
|
-
if ((_this$sceneViewer6 = this.sceneViewer) !== null && _this$sceneViewer6 !== void 0 && _this$sceneViewer6.currentSceneData) {
|
|
1118
|
-
if (!Array.isArray(this.sceneViewer.currentSceneData.behaviors)) {
|
|
1119
|
-
this.sceneViewer.currentSceneData.behaviors = [];
|
|
1120
|
-
}
|
|
1121
|
-
this.sceneViewer.currentSceneData.behaviors.push(behaviorDef);
|
|
1122
|
-
}
|
|
1123
|
-
return bm.addBehavior(behaviorDef);
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
* Remove a behavior definition by id.
|
|
1128
|
-
* @param {string} behaviorId
|
|
1129
|
-
* @returns {boolean} True if removed, false if not found
|
|
1130
|
-
* @example
|
|
1131
|
-
* centralPlant.removeBehavior('my-behavior')
|
|
1132
|
-
*/
|
|
1133
|
-
}, {
|
|
1134
|
-
key: "removeBehavior",
|
|
1135
|
-
value: function removeBehavior(behaviorId) {
|
|
1136
|
-
var _this$sceneViewer7, _this$sceneViewer8;
|
|
1137
|
-
var bm = (_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 || (_this$sceneViewer7 = _this$sceneViewer7.managers) === null || _this$sceneViewer7 === void 0 ? void 0 : _this$sceneViewer7.behaviorManager;
|
|
1138
|
-
if (!bm) {
|
|
1139
|
-
console.warn('⚠️ removeBehavior(): BehaviorManager not available');
|
|
1140
|
-
return false;
|
|
1141
|
-
}
|
|
1142
|
-
// Also remove from currentSceneData
|
|
1143
|
-
if ((_this$sceneViewer8 = this.sceneViewer) !== null && _this$sceneViewer8 !== void 0 && (_this$sceneViewer8 = _this$sceneViewer8.currentSceneData) !== null && _this$sceneViewer8 !== void 0 && _this$sceneViewer8.behaviors) {
|
|
1144
|
-
var idx = this.sceneViewer.currentSceneData.behaviors.findIndex(function (b) {
|
|
1145
|
-
return b.id === behaviorId;
|
|
1146
|
-
});
|
|
1147
|
-
if (idx !== -1) this.sceneViewer.currentSceneData.behaviors.splice(idx, 1);
|
|
1148
|
-
}
|
|
1149
|
-
return bm.removeBehavior(behaviorId);
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
/**
|
|
1153
|
-
* Simulate an IO device state value arriving and trigger any matching behaviors.
|
|
1154
|
-
* Useful for live testing in the UI or for integration with real data feeds.
|
|
1155
|
-
* @param {string} attachmentId - The attachment id of the input io-device
|
|
1156
|
-
* @param {string} stateId - The state id on that device
|
|
1157
|
-
* @param {*} value - The new state value
|
|
1158
|
-
* @example
|
|
1159
|
-
* centralPlant.triggerState('pump-push-button-01', 'power', true)
|
|
1160
|
-
*/
|
|
1161
|
-
}, {
|
|
1162
|
-
key: "triggerState",
|
|
1163
|
-
value: function triggerState(attachmentId, stateId, value, parentUuid) {
|
|
1164
|
-
var _this$sceneViewer9;
|
|
1165
|
-
var bm = (_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || (_this$sceneViewer9 = _this$sceneViewer9.managers) === null || _this$sceneViewer9 === void 0 ? void 0 : _this$sceneViewer9.behaviorManager;
|
|
1166
|
-
if (!bm) {
|
|
1167
|
-
console.warn('⚠️ triggerState(): BehaviorManager not available');
|
|
1168
|
-
return;
|
|
1169
|
-
}
|
|
1170
|
-
bm.triggerState(attachmentId, stateId, value, parentUuid);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
1072
|
/**
|
|
1174
1073
|
* Set the state of an I/O device instance in the Three.js scene.
|
|
1175
1074
|
*
|
|
@@ -1202,15 +1101,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1202
1101
|
}, {
|
|
1203
1102
|
key: "setIoDeviceState",
|
|
1204
1103
|
value: function setIoDeviceState(attachmentId, stateId, value, parentUuid) {
|
|
1205
|
-
var _this$
|
|
1206
|
-
var bm = (_this$sceneViewer0 = this.sceneViewer) === null || _this$sceneViewer0 === void 0 || (_this$sceneViewer0 = _this$sceneViewer0.managers) === null || _this$sceneViewer0 === void 0 ? void 0 : _this$sceneViewer0.behaviorManager;
|
|
1207
|
-
if (!bm) {
|
|
1208
|
-
console.warn('⚠️ setIoDeviceState(): BehaviorManager not available');
|
|
1209
|
-
return false;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1104
|
+
var _this$sceneViewer4, _this$sceneViewer5, _this$sceneViewer6;
|
|
1212
1105
|
// 1. Persist via state adapter if one has been configured
|
|
1213
|
-
var stateAdapter = (_this$
|
|
1106
|
+
var stateAdapter = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 || (_this$sceneViewer4 = _this$sceneViewer4.managers) === null || _this$sceneViewer4 === void 0 || (_this$sceneViewer4 = _this$sceneViewer4.componentTooltipManager) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4._stateAdapter;
|
|
1214
1107
|
if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
|
|
1215
1108
|
var scopedKey = parentUuid ? "".concat(parentUuid, "::").concat(attachmentId) : attachmentId;
|
|
1216
1109
|
try {
|
|
@@ -1220,11 +1113,11 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1220
1113
|
}
|
|
1221
1114
|
}
|
|
1222
1115
|
|
|
1223
|
-
// 2. Apply
|
|
1224
|
-
|
|
1116
|
+
// 2. Apply io-animation changes
|
|
1117
|
+
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.ioAnimationManager) === null || _this$sceneViewer5 === void 0 || _this$sceneViewer5.triggerState(attachmentId, stateId, value, parentUuid);
|
|
1225
1118
|
|
|
1226
1119
|
// 3. Emit event for host apps that don't use the state adapter (e.g. cp3d-viewer)
|
|
1227
|
-
(_this$
|
|
1120
|
+
(_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || _this$sceneViewer6.emit('io-device-state-changed', {
|
|
1228
1121
|
attachmentId: attachmentId,
|
|
1229
1122
|
stateId: stateId,
|
|
1230
1123
|
value: value,
|
|
@@ -1246,8 +1139,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
1246
1139
|
}, {
|
|
1247
1140
|
key: "getSceneAttachments",
|
|
1248
1141
|
value: function getSceneAttachments() {
|
|
1249
|
-
var _this$
|
|
1250
|
-
var scene = (_this$
|
|
1142
|
+
var _this$sceneViewer7;
|
|
1143
|
+
var scene = (_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 ? void 0 : _this$sceneViewer7.scene;
|
|
1251
1144
|
if (!scene) return [];
|
|
1252
1145
|
var results = [];
|
|
1253
1146
|
scene.traverse(function (obj) {
|
|
@@ -19,7 +19,6 @@ var environmentManager = require('../managers/environment/environmentManager.js'
|
|
|
19
19
|
var keyboardControlsManager = require('../managers/controls/keyboardControlsManager.js');
|
|
20
20
|
var pathfindingManager = require('../managers/pathfinding/pathfindingManager.js');
|
|
21
21
|
var PathFlowManager = require('../managers/pathfinding/PathFlowManager.js');
|
|
22
|
-
var BehaviorManager = require('../managers/behaviors/BehaviorManager.js');
|
|
23
22
|
var sceneOperationsManager = require('../managers/scene/sceneOperationsManager.js');
|
|
24
23
|
var animationManager = require('../managers/scene/animationManager.js');
|
|
25
24
|
var cameraControlsManager = require('../managers/controls/cameraControlsManager.js');
|
|
@@ -169,7 +168,6 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
169
168
|
this.centralPlant.managers.keyboardControlsManager = new keyboardControlsManager.KeyboardControlsManager(this.centralPlant.sceneViewer);
|
|
170
169
|
this.centralPlant.managers.pathfindingManager = new pathfindingManager.PathfindingManager(this.centralPlant.sceneViewer);
|
|
171
170
|
this.centralPlant.managers.pathFlowManager = new PathFlowManager.PathFlowManager(this.centralPlant.sceneViewer);
|
|
172
|
-
this.centralPlant.managers.behaviorManager = new BehaviorManager.BehaviorManager(this.centralPlant.sceneViewer);
|
|
173
171
|
this.centralPlant.managers.sceneOperationsManager = new sceneOperationsManager.SceneOperationsManager(this.centralPlant.sceneViewer);
|
|
174
172
|
this.centralPlant.managers.animationManager = new animationManager.AnimationManager(this.centralPlant.sceneViewer);
|
|
175
173
|
this.centralPlant.managers.cameraControlsManager = new cameraControlsManager.CameraControlsManager(this.centralPlant.sceneViewer);
|
|
@@ -947,7 +945,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
947
945
|
return false;
|
|
948
946
|
}
|
|
949
947
|
try {
|
|
950
|
-
var _componentData$childr, _componentData$childr2, _this$centralPlant$sc7, _componentData$childr3
|
|
948
|
+
var _componentData$childr, _componentData$childr2, _this$centralPlant$sc7, _componentData$childr3;
|
|
951
949
|
// Generate a unique component ID if not provided
|
|
952
950
|
var componentId = options.customId || this.generateUniqueComponentId(libraryId);
|
|
953
951
|
|
|
@@ -1179,15 +1177,6 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1179
1177
|
}
|
|
1180
1178
|
}
|
|
1181
1179
|
|
|
1182
|
-
// Register default behaviors for smart components so the BehaviorManager
|
|
1183
|
-
// responds to tooltip-driven state changes immediately after drop.
|
|
1184
|
-
// (The scene-load path uses _processBehaviors instead, which runs on loadSceneData.)
|
|
1185
|
-
if ((_componentData$defaul = componentData.defaultBehaviors) !== null && _componentData$defaul !== void 0 && _componentData$defaul.length) {
|
|
1186
|
-
var _this$centralPlant$sc9, _som$registerBehavior;
|
|
1187
|
-
var som = (_this$centralPlant$sc9 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc9 === void 0 ? void 0 : _this$centralPlant$sc9.sceneOperationsManager;
|
|
1188
|
-
som === null || som === void 0 || (_som$registerBehavior = som.registerBehaviorsForComponentInstance) === null || _som$registerBehavior === void 0 || _som$registerBehavior.call(som, componentData, componentId);
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
1180
|
// Notify the component manager about the new component
|
|
1192
1181
|
if (componentManager.registerComponent) {
|
|
1193
1182
|
componentManager.registerComponent(componentModel);
|
|
@@ -1260,18 +1249,18 @@ var CentralPlantInternals = /*#__PURE__*/function () {
|
|
|
1260
1249
|
}, {
|
|
1261
1250
|
key: "deleteComponent",
|
|
1262
1251
|
value: function deleteComponent(componentId) {
|
|
1263
|
-
var _this$centralPlant$
|
|
1252
|
+
var _this$centralPlant$sc9;
|
|
1264
1253
|
// Check if component manager is available
|
|
1265
|
-
var componentManager = (_this$centralPlant$
|
|
1254
|
+
var componentManager = (_this$centralPlant$sc9 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc9 === void 0 ? void 0 : _this$centralPlant$sc9.componentManager;
|
|
1266
1255
|
if (!componentManager) {
|
|
1267
1256
|
console.error('❌ deleteComponent(): Component manager not available');
|
|
1268
1257
|
return false;
|
|
1269
1258
|
}
|
|
1270
1259
|
try {
|
|
1271
|
-
var _this$centralPlant$
|
|
1260
|
+
var _this$centralPlant$sc0, _this$centralPlant$sc1, _sceneData$scene2, _sceneData$scene3;
|
|
1272
1261
|
console.log("\uD83D\uDDD1\uFE0F deleteComponent(): Deleting component ".concat(componentId));
|
|
1273
|
-
var threeScene = (_this$centralPlant$
|
|
1274
|
-
var sceneData = (_this$centralPlant$
|
|
1262
|
+
var threeScene = (_this$centralPlant$sc0 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc0 === void 0 ? void 0 : _this$centralPlant$sc0.scene;
|
|
1263
|
+
var sceneData = (_this$centralPlant$sc1 = this.centralPlant.sceneViewer) === null || _this$centralPlant$sc1 === void 0 ? void 0 : _this$centralPlant$sc1.currentSceneData;
|
|
1275
1264
|
|
|
1276
1265
|
// Step 1: Resolve the actual Three.js UUID from componentId.
|
|
1277
1266
|
// The UI emits object.name (e.g. "Pump (PUMP-1)") as the selection ID, but
|
|
@@ -102,7 +102,7 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
102
102
|
this.centralPlant.attachToComponent();
|
|
103
103
|
|
|
104
104
|
// Sync our managers tracking object after attachment
|
|
105
|
-
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', '
|
|
105
|
+
managerKeys = ['threeJSResourceManager', 'performanceMonitorManager', 'settingsManager', 'sceneExportManager', 'componentManager', 'sceneInitializationManager', 'environmentManager', 'keyboardControlsManager', 'pathfindingManager', 'pathFlowManager', 'ioAnimationManager', 'ioOutlineManager', 'sceneOperationsManager', 'animationManager', 'cameraControlsManager', 'componentDragManager', 'tooltipsManager', 'componentTooltipManager']; // Populate our managers tracking object
|
|
106
106
|
managerKeys.forEach(function (key) {
|
|
107
107
|
if (_this2[key]) {
|
|
108
108
|
_this2.managers[key] = _this2[key];
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -13,7 +13,6 @@ var sceneExportManager = require('./managers/scene/sceneExportManager.js');
|
|
|
13
13
|
var sceneTooltipsManager = require('./managers/scene/sceneTooltipsManager.js');
|
|
14
14
|
var componentTooltipManager = require('./managers/scene/componentTooltipManager.js');
|
|
15
15
|
var sceneHierarchyManager = require('./managers/scene/sceneHierarchyManager.js');
|
|
16
|
-
var BehaviorManager = require('./managers/behaviors/BehaviorManager.js');
|
|
17
16
|
var IoAnimationManager = require('./managers/behaviors/IoAnimationManager.js');
|
|
18
17
|
var componentManager = require('./managers/components/componentManager.js');
|
|
19
18
|
var animationManager = require('./managers/scene/animationManager.js');
|
|
@@ -68,7 +67,6 @@ exports.SceneExportManager = sceneExportManager.SceneExportManager;
|
|
|
68
67
|
exports.SceneTooltipsManager = sceneTooltipsManager.SceneTooltipsManager;
|
|
69
68
|
exports.ComponentTooltipManager = componentTooltipManager.ComponentTooltipManager;
|
|
70
69
|
exports.SceneHierarchyManager = sceneHierarchyManager.SceneHierarchyManager;
|
|
71
|
-
exports.BehaviorManager = BehaviorManager.BehaviorManager;
|
|
72
70
|
exports.IoAnimationManager = IoAnimationManager.IoAnimationManager;
|
|
73
71
|
exports.ComponentManager = componentManager.ComponentManager;
|
|
74
72
|
exports.AnimationManager = animationManager.AnimationManager;
|
|
@@ -129,7 +129,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
129
129
|
}, {
|
|
130
130
|
key: "toggleIODeviceBinaryState",
|
|
131
131
|
value: function toggleIODeviceBinaryState(ioDeviceObject) {
|
|
132
|
-
var _ref, _this$sceneViewer
|
|
132
|
+
var _ref, _this$sceneViewer;
|
|
133
133
|
if (!ioDeviceObject || !this._stateAdapter) return;
|
|
134
134
|
var ud = ioDeviceObject.userData;
|
|
135
135
|
var attachmentId = ud === null || ud === void 0 ? void 0 : ud.attachmentId;
|
|
@@ -163,8 +163,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
163
163
|
var currentVal = (_ref = storedVal !== null && storedVal !== void 0 ? storedVal : binaryState.defaultValue) !== null && _ref !== void 0 ? _ref : false;
|
|
164
164
|
var newVal = !Boolean(currentVal);
|
|
165
165
|
this._stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
166
|
-
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.
|
|
167
|
-
(_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.ioAnimationManager) === null || _this$sceneViewer2 === void 0 || _this$sceneViewer2.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
166
|
+
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.ioAnimationManager) === null || _this$sceneViewer === void 0 || _this$sceneViewer.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
168
167
|
console.log("\uD83D\uDD04 [IODevice] Toggled ".concat(scopedAttachmentId, ".").concat(dpId, ": ").concat(currentVal, " \u2192 ").concat(newVal));
|
|
169
168
|
}
|
|
170
169
|
|
|
@@ -180,7 +179,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
180
179
|
}, {
|
|
181
180
|
key: "startIODeviceDrag",
|
|
182
181
|
value: function startIODeviceDrag(ioDeviceObject) {
|
|
183
|
-
var _this$
|
|
182
|
+
var _this$sceneViewer2,
|
|
184
183
|
_this2 = this;
|
|
185
184
|
if (!ioDeviceObject || !this._stateAdapter) return;
|
|
186
185
|
var ud = ioDeviceObject.userData;
|
|
@@ -197,7 +196,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
197
196
|
obj = obj.parent;
|
|
198
197
|
}
|
|
199
198
|
var scopedAttachmentId = this._getScopedAttachmentKey(attachmentId, parentUuid);
|
|
200
|
-
var ioAnimMgr = (_this$
|
|
199
|
+
var ioAnimMgr = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.ioAnimationManager;
|
|
201
200
|
var dataPoints = ((ioAnimMgr === null || ioAnimMgr === void 0 ? void 0 : ioAnimMgr.getAnimationDataPoints(parentUuid, attachmentId)) || []).concat((ud === null || ud === void 0 ? void 0 : ud.dataPoints) || [])
|
|
202
201
|
// deduplicate by id
|
|
203
202
|
.filter(function (dp, i, arr) {
|
|
@@ -320,15 +319,14 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
320
319
|
}, {
|
|
321
320
|
key: "_applyDpState",
|
|
322
321
|
value: function _applyDpState(_ref2, newVal) {
|
|
323
|
-
var _this$_stateAdapter, _this$
|
|
322
|
+
var _this$_stateAdapter, _this$sceneViewer3;
|
|
324
323
|
var scopedAttachmentId = _ref2.scopedAttachmentId,
|
|
325
324
|
attachmentId = _ref2.attachmentId,
|
|
326
325
|
parentUuid = _ref2.parentUuid,
|
|
327
326
|
dp = _ref2.dp;
|
|
328
327
|
var dpId = dp.id;
|
|
329
328
|
(_this$_stateAdapter = this._stateAdapter) === null || _this$_stateAdapter === void 0 || _this$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
330
|
-
(_this$
|
|
331
|
-
(_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.ioAnimationManager) === null || _this$sceneViewer5 === void 0 || _this$sceneViewer5.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
329
|
+
(_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.ioAnimationManager) === null || _this$sceneViewer3 === void 0 || _this$sceneViewer3.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
332
330
|
}
|
|
333
331
|
|
|
334
332
|
/**
|
|
@@ -611,11 +609,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
611
609
|
}, {
|
|
612
610
|
key: "_positionTooltip",
|
|
613
611
|
value: function _positionTooltip() {
|
|
614
|
-
var _this$
|
|
612
|
+
var _this$sceneViewer4, _this$sceneViewer5;
|
|
615
613
|
if (!this.tooltipEl || !this.selectedObject) return;
|
|
616
614
|
var container = this._getContainer();
|
|
617
|
-
var camera = (_this$
|
|
618
|
-
var renderer = (_this$
|
|
615
|
+
var camera = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.camera;
|
|
616
|
+
var renderer = (_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.renderer;
|
|
619
617
|
if (!container || !camera || !renderer) return;
|
|
620
618
|
|
|
621
619
|
// Compute bounding box to position above the component
|
|
@@ -652,8 +650,8 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
652
650
|
}, {
|
|
653
651
|
key: "_getContainer",
|
|
654
652
|
value: function _getContainer() {
|
|
655
|
-
var _this$
|
|
656
|
-
return ((_this$
|
|
653
|
+
var _this$sceneViewer6;
|
|
654
|
+
return ((_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.renderer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.domElement) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.parentElement) || null;
|
|
657
655
|
}
|
|
658
656
|
|
|
659
657
|
// -----------------------------------------------------------------------
|
|
@@ -693,15 +691,10 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
693
691
|
var currentVal = (_ref3 = (_this$_stateAdapter$g = (_this$_stateAdapter2 = this._stateAdapter) === null || _this$_stateAdapter2 === void 0 ? void 0 : _this$_stateAdapter2.getState(scopedAttachmentId, dpId)) !== null && _this$_stateAdapter$g !== void 0 ? _this$_stateAdapter$g : dp.defaultValue) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
694
692
|
if (isInput) {
|
|
695
693
|
var ctrl = this._buildInputControl(dp, currentVal, function (newVal) {
|
|
696
|
-
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer
|
|
694
|
+
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer;
|
|
697
695
|
(_this5$_stateAdapter = _this5._stateAdapter) === null || _this5$_stateAdapter === void 0 || _this5$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
698
|
-
// Also fire BehaviorManager so any wired behaviors react immediately.
|
|
699
|
-
// Pass the parent component UUID so behaviors scoped to a specific instance
|
|
700
|
-
// don't bleed across clones that share the same attachmentId.
|
|
701
|
-
// Use originalAttachmentId for behavior triggering as behaviors are keyed by original ID
|
|
702
696
|
var parentUuid = ((_this5$selectedObject = _this5.selectedObject) === null || _this5$selectedObject === void 0 ? void 0 : _this5$selectedObject.uuid) || null;
|
|
703
|
-
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.
|
|
704
|
-
(_this5$sceneViewer2 = _this5.sceneViewer) === null || _this5$sceneViewer2 === void 0 || (_this5$sceneViewer2 = _this5$sceneViewer2.managers) === null || _this5$sceneViewer2 === void 0 || (_this5$sceneViewer2 = _this5$sceneViewer2.ioAnimationManager) === null || _this5$sceneViewer2 === void 0 || _this5$sceneViewer2.triggerState(originalAttachmentId || scopedAttachmentId, dpId, newVal, parentUuid);
|
|
697
|
+
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.ioAnimationManager) === null || _this5$sceneViewer === void 0 || _this5$sceneViewer.triggerState(originalAttachmentId || scopedAttachmentId, dpId, newVal, parentUuid);
|
|
705
698
|
});
|
|
706
699
|
row.appendChild(ctrl);
|
|
707
700
|
this._stateElements.set(key, {
|
|
@@ -281,40 +281,14 @@ var SceneExportManager = /*#__PURE__*/function () {
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
-
// Helper function to extract behaviors from current scene data
|
|
285
|
-
var extractBehaviors = function extractBehaviors() {
|
|
286
|
-
var _this$sceneViewer, _this$sceneViewer2;
|
|
287
|
-
// Only export behaviors that are NOT re-derivable from a component's
|
|
288
|
-
// defaultBehaviors[]. All component/device default behaviors are
|
|
289
|
-
// reconstructed at load time by Step B of _processBehaviors() using the
|
|
290
|
-
// component dictionary, so writing compact behaviorRef entries for them
|
|
291
|
-
// would be redundant. The scene JSON behaviors[] array is reserved for
|
|
292
|
-
// any future scene-level overrides that cannot be derived from the asset.
|
|
293
|
-
if ((_this$sceneViewer = _this.sceneViewer) !== null && _this$sceneViewer !== void 0 && (_this$sceneViewer = _this$sceneViewer.managers) !== null && _this$sceneViewer !== void 0 && _this$sceneViewer.behaviorManager) {
|
|
294
|
-
return _this.sceneViewer.managers.behaviorManager.getBehaviors().filter(function (b) {
|
|
295
|
-
return !b._isDefaultBehavior;
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
// Fallback when BehaviorManager is not available: exclude any entry that
|
|
299
|
-
// was already a behaviorRef (it was derivable from the component asset)
|
|
300
|
-
// and exclude the legacy _isDefaultBehavior marker if present.
|
|
301
|
-
return (((_this$sceneViewer2 = _this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.currentSceneData) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.behaviors) || []).filter(function (b) {
|
|
302
|
-
return !b.behaviorRef && !b._isDefaultBehavior;
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
|
|
306
284
|
// Build the complete export data structure (matching central-plant-input.json format)
|
|
307
|
-
var
|
|
308
|
-
var exportData = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
285
|
+
var exportData = {
|
|
309
286
|
version: '2.3',
|
|
310
|
-
connections: extractConnections()
|
|
311
|
-
}, behaviors.length > 0 ? {
|
|
312
|
-
behaviors: behaviors
|
|
313
|
-
} : {}), {}, {
|
|
287
|
+
connections: extractConnections(),
|
|
314
288
|
scene: {
|
|
315
289
|
children: sceneChildren
|
|
316
290
|
}
|
|
317
|
-
}
|
|
291
|
+
};
|
|
318
292
|
console.log('✅ Scene export completed:', exportData);
|
|
319
293
|
console.log("\uD83D\uDCCA Exported ".concat(sceneChildren.length, " components and ").concat(exportData.connections.length, " connections"));
|
|
320
294
|
return exportData;
|