@2112-lab/central-plant 0.3.28 → 0.3.29
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 +47 -47
- package/dist/cjs/src/core/centralPlant.js +3 -3
- package/dist/cjs/src/core/centralPlantInternals.js +7 -7
- package/dist/cjs/src/core/sceneViewer.js +4 -4
- package/dist/cjs/src/index.js +2 -2
- package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +571 -0
- package/dist/cjs/src/managers/scene/componentTooltipManager.js +8 -8
- package/dist/cjs/src/managers/scene/modelManager.js +8 -8
- package/dist/esm/src/core/centralPlant.js +3 -3
- package/dist/esm/src/core/centralPlantInternals.js +7 -7
- package/dist/esm/src/core/sceneViewer.js +4 -4
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +547 -0
- package/dist/esm/src/managers/scene/componentTooltipManager.js +8 -8
- package/dist/esm/src/managers/scene/modelManager.js +8 -8
- package/package.json +1 -1
|
@@ -139,7 +139,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
139
139
|
var currentVal = (_ref = storedVal !== null && storedVal !== void 0 ? storedVal : binaryState.defaultValue) !== null && _ref !== void 0 ? _ref : false;
|
|
140
140
|
var newVal = !Boolean(currentVal);
|
|
141
141
|
this._stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
142
|
-
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.
|
|
142
|
+
(_this$sceneViewer = this.sceneViewer) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.managers) === null || _this$sceneViewer === void 0 || (_this$sceneViewer = _this$sceneViewer.ioBehaviorManager) === null || _this$sceneViewer === void 0 || _this$sceneViewer.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
143
143
|
console.log("\uD83D\uDD04 [IODevice] Toggled ".concat(scopedAttachmentId, ".").concat(dpId, ": ").concat(currentVal, " \u2192 ").concat(newVal));
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -172,8 +172,8 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
172
172
|
obj = obj.parent;
|
|
173
173
|
}
|
|
174
174
|
var scopedAttachmentId = this._getScopedAttachmentKey(attachmentId, parentUuid);
|
|
175
|
-
var
|
|
176
|
-
var dataPoints = ((
|
|
175
|
+
var ioBehavMgr = (_this$sceneViewer2 = this.sceneViewer) === null || _this$sceneViewer2 === void 0 || (_this$sceneViewer2 = _this$sceneViewer2.managers) === null || _this$sceneViewer2 === void 0 ? void 0 : _this$sceneViewer2.ioBehaviorManager;
|
|
176
|
+
var dataPoints = ((ioBehavMgr === null || ioBehavMgr === void 0 ? void 0 : ioBehavMgr.getAnimationDataPoints(parentUuid, attachmentId)) || []).concat((ud === null || ud === void 0 ? void 0 : ud.dataPoints) || [])
|
|
177
177
|
// deduplicate by id
|
|
178
178
|
.filter(function (dp, i, arr) {
|
|
179
179
|
return arr.findIndex(function (d) {
|
|
@@ -302,7 +302,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
302
302
|
dp = _ref2.dp;
|
|
303
303
|
var dpId = dp.id;
|
|
304
304
|
(_this$_stateAdapter = this._stateAdapter) === null || _this$_stateAdapter === void 0 || _this$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
305
|
-
(_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.
|
|
305
|
+
(_this$sceneViewer3 = this.sceneViewer) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.managers) === null || _this$sceneViewer3 === void 0 || (_this$sceneViewer3 = _this$sceneViewer3.ioBehaviorManager) === null || _this$sceneViewer3 === void 0 || _this$sceneViewer3.triggerState(attachmentId, dpId, newVal, parentUuid);
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
/**
|
|
@@ -427,11 +427,11 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
427
427
|
var _this3$sceneViewer$ma, _this3$sceneViewer;
|
|
428
428
|
var attachmentId = child.userData.attachmentId || '';
|
|
429
429
|
|
|
430
|
-
// Use only data points from the animate window (
|
|
430
|
+
// Use only data points from the animate window (behaviorConfig).
|
|
431
431
|
// The static ioConfig.states[] snapshot on userData is intentionally ignored.
|
|
432
|
-
var dataPoints = (_this3$sceneViewer$ma = (_this3$sceneViewer = _this3.sceneViewer) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.managers) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.
|
|
432
|
+
var dataPoints = (_this3$sceneViewer$ma = (_this3$sceneViewer = _this3.sceneViewer) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.managers) === null || _this3$sceneViewer === void 0 || (_this3$sceneViewer = _this3$sceneViewer.ioBehaviorManager) === null || _this3$sceneViewer === void 0 ? void 0 : _this3$sceneViewer.getAnimationDataPoints(parentUuid, attachmentId)) !== null && _this3$sceneViewer$ma !== void 0 ? _this3$sceneViewer$ma : [];
|
|
433
433
|
|
|
434
|
-
// When data points come from
|
|
434
|
+
// When data points come from behaviorConfig they already carry direction:'input'.
|
|
435
435
|
// Pass null so _buildDataPointRow uses the per-dp direction instead of the
|
|
436
436
|
// device-level ioDirection (which may be 'output' and would hide controls).
|
|
437
437
|
var deviceDirection = dataPoints.length > 0 ? null : child.userData.ioDirection || 'output';
|
|
@@ -670,7 +670,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
670
670
|
var _this5$_stateAdapter, _this5$selectedObject, _this5$sceneViewer;
|
|
671
671
|
(_this5$_stateAdapter = _this5._stateAdapter) === null || _this5$_stateAdapter === void 0 || _this5$_stateAdapter.setState(scopedAttachmentId, dpId, newVal);
|
|
672
672
|
var parentUuid = ((_this5$selectedObject = _this5.selectedObject) === null || _this5$selectedObject === void 0 ? void 0 : _this5$selectedObject.uuid) || null;
|
|
673
|
-
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.
|
|
673
|
+
(_this5$sceneViewer = _this5.sceneViewer) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.managers) === null || _this5$sceneViewer === void 0 || (_this5$sceneViewer = _this5$sceneViewer.ioBehaviorManager) === null || _this5$sceneViewer === void 0 || _this5$sceneViewer.triggerState(originalAttachmentId || scopedAttachmentId, dpId, newVal, parentUuid);
|
|
674
674
|
});
|
|
675
675
|
row.appendChild(ctrl);
|
|
676
676
|
this._stateElements.set(key, {
|
|
@@ -53,7 +53,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
53
53
|
key: "loadLibraryModel",
|
|
54
54
|
value: function () {
|
|
55
55
|
var _loadLibraryModel = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(targetMesh, jsonEntry, componentData) {
|
|
56
|
-
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer,
|
|
56
|
+
var component, _jsonEntry$userData, _jsonEntry$userData2, _jsonEntry$userData3, originalProps, connectorChildren, gltfScene, libraryModel, _this$sceneViewer, ioBehavMgr, _loop, _i, _Object$entries, warmFn, _jsonEntry$userData4, _t;
|
|
57
57
|
return _regenerator().w(function (_context2) {
|
|
58
58
|
while (1) switch (_context2.n) {
|
|
59
59
|
case 0:
|
|
@@ -96,22 +96,22 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
96
96
|
_context2.n = 4;
|
|
97
97
|
return attachIODevicesToComponent(libraryModel, componentData, modelPreloader, originalProps.uuid);
|
|
98
98
|
case 4:
|
|
99
|
-
// Register
|
|
100
|
-
|
|
101
|
-
if (!
|
|
99
|
+
// Register behavior configs for each attached device
|
|
100
|
+
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;
|
|
101
|
+
if (!ioBehavMgr) {
|
|
102
102
|
_context2.n = 8;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
106
|
-
var _modelPreloader$compo, _deviceData$
|
|
106
|
+
var _modelPreloader$compo, _deviceData$behaviorC;
|
|
107
107
|
var _Object$entries$_i, attachmentId, attachment, deviceData, deviceRoot;
|
|
108
108
|
return _regenerator().w(function (_context) {
|
|
109
109
|
while (1) switch (_context.n) {
|
|
110
110
|
case 0:
|
|
111
111
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), attachmentId = _Object$entries$_i[0], attachment = _Object$entries$_i[1];
|
|
112
112
|
deviceData = (_modelPreloader$compo = modelPreloader.componentDictionary) === null || _modelPreloader$compo === void 0 ? void 0 : _modelPreloader$compo[attachment.deviceId];
|
|
113
|
-
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192
|
|
114
|
-
if (deviceData !== null && deviceData !== void 0 && deviceData.
|
|
113
|
+
console.log("[ModelManager] attachment \"".concat(attachmentId, "\" \u2192 deviceId \"").concat(attachment.deviceId, "\" \u2192 behaviorConfig:"), (_deviceData$behaviorC = deviceData === null || deviceData === void 0 ? void 0 : deviceData.behaviorConfig) !== null && _deviceData$behaviorC !== void 0 ? _deviceData$behaviorC : 'NONE');
|
|
114
|
+
if (deviceData !== null && deviceData !== void 0 && deviceData.behaviorConfig) {
|
|
115
115
|
_context.n = 1;
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
@@ -123,7 +123,7 @@ var ModelManager = /*#__PURE__*/function () {
|
|
|
123
123
|
if (!deviceRoot && ((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.attachmentId) === attachmentId) deviceRoot = obj;
|
|
124
124
|
});
|
|
125
125
|
if (deviceRoot) {
|
|
126
|
-
|
|
126
|
+
ioBehavMgr.loadBehaviors(attachmentId, deviceData.behaviorConfig, deviceRoot, originalProps.uuid);
|
|
127
127
|
}
|
|
128
128
|
case 2:
|
|
129
129
|
return _context.a(2);
|