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.esm.js CHANGED
@@ -777,8 +777,6 @@ new THREE.MeshStandardMaterial({
777
777
  roughness: 0.8
778
778
  });
779
779
 
780
- // Type definition for a material prop (string or object with opacity)
781
-
782
780
  // Helper function to check for hex color codes
783
781
  const isHexColor = str => /^#([0-9A-F]{3}){1,2}$/i.test(str);
784
782
 
@@ -803,13 +801,9 @@ const buildMaterial = (prop, textures) => {
803
801
  };
804
802
  if (isHexColor(sourceValue)) {
805
803
  params.color = sourceValue;
806
- }
807
- // Check if it's a URL and if it exists in the pre-loaded texture map
808
- else if (textures && textures[sourceValue]) {
804
+ } else if (textures && textures[sourceValue]) {
809
805
  params.map = textures[sourceValue];
810
- }
811
- // Fallback for invalid values
812
- else {
806
+ } else {
813
807
  params.color = "#cccccc";
814
808
  }
815
809
  if (opacity !== undefined && opacity < 1) {
@@ -818,8 +812,6 @@ const buildMaterial = (prop, textures) => {
818
812
  }
819
813
  return new THREE.MeshStandardMaterial(params);
820
814
  };
821
-
822
- // getFirstValidValue remains useful for fallbacks, so we keep it.
823
815
  const getFirstValidValue = values => {
824
816
  for (const val of values) {
825
817
  if (val) {
@@ -1386,7 +1378,10 @@ function DoorModels(_ref7) {
1386
1378
  doorName,
1387
1379
  materials: materialsProp,
1388
1380
  doorPivot: doorPivotProp,
1389
- doorOpening: doorOpeningProp
1381
+ doorOpening: doorOpeningProp,
1382
+ totalWidth: totalWidthProp,
1383
+ totalHeight: totalHeightProp,
1384
+ frameDepth: frameDepthProp
1390
1385
  } = _ref7;
1391
1386
  const {
1392
1387
  is2D,
@@ -1395,6 +1390,7 @@ function DoorModels(_ref7) {
1395
1390
  door,
1396
1391
  setDoor,
1397
1392
  doorFrame,
1393
+ setDoorFrame,
1398
1394
  interiorFanlight,
1399
1395
  exteriorFanlight,
1400
1396
  frontCoverPanel,
@@ -1404,7 +1400,9 @@ function DoorModels(_ref7) {
1404
1400
  glassDepth,
1405
1401
  handleParseCpid,
1406
1402
  isDoubleDoor,
1407
- setMaterials
1403
+ setMaterials,
1404
+ setTotalWidth,
1405
+ setTotalHeight
1408
1406
  } = useConfigurator();
1409
1407
  useEffect(() => {
1410
1408
  if (doorName) {
@@ -1416,12 +1414,6 @@ function DoorModels(_ref7) {
1416
1414
  setMaterials(materialsProp);
1417
1415
  }
1418
1416
  }, [materialsProp, setMaterials]);
1419
- useEffect(() => {
1420
- if (doorName) handleParseCpid(doorName);
1421
- }, [doorName, handleParseCpid]);
1422
- useEffect(() => {
1423
- if (materialsProp) setMaterials(materialsProp);
1424
- }, [materialsProp, setMaterials]);
1425
1417
  useEffect(() => {
1426
1418
  if (doorPivotProp || doorOpeningProp) {
1427
1419
  setDoor(prevDoor => _objectSpread2(_objectSpread2(_objectSpread2({}, prevDoor), doorPivotProp && {
@@ -1431,6 +1423,23 @@ function DoorModels(_ref7) {
1431
1423
  }));
1432
1424
  }
1433
1425
  }, [doorPivotProp, doorOpeningProp, setDoor]);
1426
+ useEffect(() => {
1427
+ if (totalWidthProp !== undefined) {
1428
+ setTotalWidth(totalWidthProp);
1429
+ }
1430
+ }, [totalWidthProp, setTotalWidth]);
1431
+ useEffect(() => {
1432
+ if (totalHeightProp !== undefined) {
1433
+ setTotalHeight(totalHeightProp);
1434
+ }
1435
+ }, [totalHeightProp, setTotalHeight]);
1436
+ useEffect(() => {
1437
+ if (frameDepthProp !== undefined) {
1438
+ setDoorFrame(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
1439
+ frameDepth: frameDepthProp
1440
+ }));
1441
+ }
1442
+ }, [frameDepthProp, setDoorFrame]);
1434
1443
 
1435
1444
  // --- Material Logic (Centralized in parent component) ---
1436
1445
  const allMaterials = useDoorMaterials(materialsProp);
@@ -2224,7 +2233,10 @@ const DoorConfigurator = _ref => {
2224
2233
  materials,
2225
2234
  doorPivot,
2226
2235
  doorOpening,
2227
- is2D = false
2236
+ is2D = false,
2237
+ totalWidth,
2238
+ totalHeight,
2239
+ frameDepth
2228
2240
  } = _ref;
2229
2241
  return /*#__PURE__*/jsx(ConfiguratorProvider, {
2230
2242
  initialIs2D: is2D,
@@ -2232,7 +2244,10 @@ const DoorConfigurator = _ref => {
2232
2244
  doorName: doorName,
2233
2245
  materials: materials,
2234
2246
  doorPivot: doorPivot,
2235
- doorOpening: doorOpening
2247
+ doorOpening: doorOpening,
2248
+ totalWidth: totalWidth,
2249
+ totalHeight: totalHeight,
2250
+ frameDepth: frameDepth
2236
2251
  })
2237
2252
  });
2238
2253
  };