door_models 5.3.7 → 5.3.8

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/index.cjs.js CHANGED
@@ -804,8 +804,6 @@ new THREE__namespace.MeshStandardMaterial({
804
804
  roughness: 0.8
805
805
  });
806
806
 
807
- // Type definition for a material prop (string or object with opacity)
808
-
809
807
  // Helper function to check for hex color codes
810
808
  const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
811
809
 
@@ -830,13 +828,9 @@ const buildMaterial = (prop, textures) => {
830
828
  };
831
829
  if (isHexColor(sourceValue)) {
832
830
  params.color = sourceValue;
833
- }
834
- // Check if it's a URL and if it exists in the pre-loaded texture map
835
- else if (textures && textures[sourceValue]) {
831
+ } else if (textures && textures[sourceValue]) {
836
832
  params.map = textures[sourceValue];
837
- }
838
- // Fallback for invalid values
839
- else {
833
+ } else {
840
834
  params.color = "#cccccc";
841
835
  }
842
836
  if (opacity !== undefined && opacity < 1) {
@@ -845,8 +839,6 @@ const buildMaterial = (prop, textures) => {
845
839
  }
846
840
  return new THREE__namespace.MeshStandardMaterial(params);
847
841
  };
848
-
849
- // getFirstValidValue remains useful for fallbacks, so we keep it.
850
842
  const getFirstValidValue = values => {
851
843
  for (const val of values) {
852
844
  if (val) {
@@ -1413,7 +1405,10 @@ function DoorModels(_ref7) {
1413
1405
  doorName,
1414
1406
  materials: materialsProp,
1415
1407
  doorPivot: doorPivotProp,
1416
- doorOpening: doorOpeningProp
1408
+ doorOpening: doorOpeningProp,
1409
+ totalWidth: totalWidthProp,
1410
+ totalHeight: totalHeightProp,
1411
+ frameDepth: frameDepthProp
1417
1412
  } = _ref7;
1418
1413
  const {
1419
1414
  is2D,
@@ -1422,6 +1417,7 @@ function DoorModels(_ref7) {
1422
1417
  door,
1423
1418
  setDoor,
1424
1419
  doorFrame,
1420
+ setDoorFrame,
1425
1421
  interiorFanlight,
1426
1422
  exteriorFanlight,
1427
1423
  frontCoverPanel,
@@ -1431,7 +1427,9 @@ function DoorModels(_ref7) {
1431
1427
  glassDepth,
1432
1428
  handleParseCpid,
1433
1429
  isDoubleDoor,
1434
- setMaterials
1430
+ setMaterials,
1431
+ setTotalWidth,
1432
+ setTotalHeight
1435
1433
  } = useConfigurator();
1436
1434
  React.useEffect(() => {
1437
1435
  if (doorName) {
@@ -1443,12 +1441,6 @@ function DoorModels(_ref7) {
1443
1441
  setMaterials(materialsProp);
1444
1442
  }
1445
1443
  }, [materialsProp, setMaterials]);
1446
- React.useEffect(() => {
1447
- if (doorName) handleParseCpid(doorName);
1448
- }, [doorName, handleParseCpid]);
1449
- React.useEffect(() => {
1450
- if (materialsProp) setMaterials(materialsProp);
1451
- }, [materialsProp, setMaterials]);
1452
1444
  React.useEffect(() => {
1453
1445
  if (doorPivotProp || doorOpeningProp) {
1454
1446
  setDoor(prevDoor => _objectSpread2(_objectSpread2(_objectSpread2({}, prevDoor), doorPivotProp && {
@@ -1458,6 +1450,23 @@ function DoorModels(_ref7) {
1458
1450
  }));
1459
1451
  }
1460
1452
  }, [doorPivotProp, doorOpeningProp, setDoor]);
1453
+ React.useEffect(() => {
1454
+ if (totalWidthProp !== undefined) {
1455
+ setTotalWidth(totalWidthProp);
1456
+ }
1457
+ }, [totalWidthProp, setTotalWidth]);
1458
+ React.useEffect(() => {
1459
+ if (totalHeightProp !== undefined) {
1460
+ setTotalHeight(totalHeightProp);
1461
+ }
1462
+ }, [totalHeightProp, setTotalHeight]);
1463
+ React.useEffect(() => {
1464
+ if (frameDepthProp !== undefined) {
1465
+ setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
1466
+ frameDepth: frameDepthProp
1467
+ }));
1468
+ }
1469
+ }, [frameDepthProp, setDoorFrame]);
1461
1470
 
1462
1471
  // --- Material Logic (Centralized in parent component) ---
1463
1472
  const allMaterials = useDoorMaterials(materialsProp);
@@ -2251,7 +2260,10 @@ const DoorConfigurator = _ref => {
2251
2260
  materials,
2252
2261
  doorPivot,
2253
2262
  doorOpening,
2254
- is2D = false
2263
+ is2D = false,
2264
+ totalWidth,
2265
+ totalHeight,
2266
+ frameDepth
2255
2267
  } = _ref;
2256
2268
  return /*#__PURE__*/jsxRuntime.jsx(ConfiguratorProvider, {
2257
2269
  initialIs2D: is2D,
@@ -2259,7 +2271,10 @@ const DoorConfigurator = _ref => {
2259
2271
  doorName: doorName,
2260
2272
  materials: materials,
2261
2273
  doorPivot: doorPivot,
2262
- doorOpening: doorOpening
2274
+ doorOpening: doorOpening,
2275
+ totalWidth: totalWidth,
2276
+ totalHeight: totalHeight,
2277
+ frameDepth: frameDepth
2263
2278
  })
2264
2279
  });
2265
2280
  };