@lv-x-software-house/x_view 1.2.2-dev.2 → 1.2.2-dev.4

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.js CHANGED
@@ -855,7 +855,6 @@ var x_view_config = {
855
855
  ANCESTOR_HIGHLIGHT_COLOR: "#FFD700",
856
856
  BLOOM_EFFECT: { strength: 1.35, radius: 0.6, threshold: 0.52 },
857
857
  EMISSIVE_MULTIPLIER: {
858
- // AJUSTE: Valores agora representam ADIÇÃO de intensidade, não multiplicação
859
858
  BASE: 0,
860
859
  HOVER: 2,
861
860
  SELECTED: 1.5,
@@ -907,7 +906,6 @@ var computeNodeMaterialProps = (colorHex) => {
907
906
  return {
908
907
  color: srgb,
909
908
  emissive: emissiveColor
910
- // Intensity é controlada externamente
911
909
  };
912
910
  };
913
911
  var createNodeMesh = (nodeData, position, glowTexture) => {
@@ -1198,6 +1196,7 @@ var createMultipleLinkLines = (linksArray, sourceNodeMesh, targetNodeMesh, resol
1198
1196
  resolution,
1199
1197
  isCurved,
1200
1198
  isCurved,
1199
+ isCurved,
1201
1200
  curveOffset
1202
1201
  );
1203
1202
  line.userData = {
@@ -1574,12 +1573,12 @@ var userActionHandlers = {
1574
1573
  stateRef.current.creation = { isActive: true, sourceNodeData };
1575
1574
  const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
1576
1575
  const sourceColor = sourceNodeData.color || "#cccccc";
1577
- const { emissiveIntensity } = computeNodeMaterialProps(sourceColor);
1578
- const ghostColor = new THREE.Color(sourceColor);
1576
+ const { color: ghostColor, emissive: ghostEmissive } = computeNodeMaterialProps(sourceColor);
1579
1577
  const ghostMaterial = new THREE.MeshStandardMaterial({
1580
1578
  color: ghostColor,
1581
- emissive: ghostColor,
1582
- emissiveIntensity,
1579
+ emissive: ghostEmissive,
1580
+ emissiveIntensity: MIN_VISIBILITY_INTENSITY,
1581
+ // <-- Forçamos o brilho mínimo
1583
1582
  roughness: 0.6,
1584
1583
  metalness: 0,
1585
1584
  transparent: true,
@@ -1708,12 +1707,12 @@ var userActionHandlers = {
1708
1707
  stateRef.current.creation = { isActive: true, sourceNodeData };
1709
1708
  const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
1710
1709
  const sourceColor = sourceNodeData.color || "#cccccc";
1711
- const { emissiveIntensity } = computeNodeMaterialProps(sourceColor);
1712
- const ghostColor = new THREE.Color(sourceColor);
1710
+ const { color: ghostColor, emissive: ghostEmissive } = computeNodeMaterialProps(sourceColor);
1713
1711
  const ghostMaterial = new THREE.MeshStandardMaterial({
1714
1712
  color: ghostColor,
1715
- emissive: ghostColor,
1716
- emissiveIntensity,
1713
+ emissive: ghostEmissive,
1714
+ emissiveIntensity: MIN_VISIBILITY_INTENSITY,
1715
+ // <-- Forçamos o brilho mínimo
1717
1716
  roughness: 0.6,
1718
1717
  metalness: 0,
1719
1718
  transparent: true,
@@ -5256,6 +5255,7 @@ function CreateAncestryPanel({
5256
5255
  const branchProgressMapRef = (0, import_react10.useRef)({});
5257
5256
  const [lastSavedSnapshot, setLastSavedSnapshot] = (0, import_react10.useState)(null);
5258
5257
  const [isPrivate, setIsPrivate] = (0, import_react10.useState)(ancestryMode.is_private || false);
5258
+ const initializedContextIdRef = (0, import_react10.useRef)(null);
5259
5259
  const availableImages = customProps.filter((p) => p.type === "images").flatMap((p) => Array.isArray(p.value) ? p.value : []).filter((img) => img.value && img.value.trim() !== "");
5260
5260
  const handleImageClickFromText = (url, name) => {
5261
5261
  if (onOpenImageViewer) {
@@ -5454,6 +5454,11 @@ function CreateAncestryPanel({
5454
5454
  }, [isContextLinked, branchStack]);
5455
5455
  (0, import_react10.useEffect)(() => {
5456
5456
  const ctx = getCurrentContext();
5457
+ const currentContextId = branchStack.length > 0 ? branchStack[branchStack.length - 1].branchId : ancestryMode.currentAncestryId || `new_${ancestryMode.ancestral_node}`;
5458
+ if (initializedContextIdRef.current === currentContextId) {
5459
+ return;
5460
+ }
5461
+ initializedContextIdRef.current = currentContextId;
5457
5462
  let sourceObject = {};
5458
5463
  if (ctx) {
5459
5464
  sourceObject = ctx;
@@ -5804,7 +5809,7 @@ function CreateAncestryPanel({
5804
5809
  const currentAbsTreeStr = JSON.stringify(ancestryMode.abstraction_tree);
5805
5810
  abstractionTreeChanged = currentAbsTreeStr !== lastSavedSnapshot.abstractionTree;
5806
5811
  }
5807
- return treeChanged || nameChanged || descChanged || sectionsChanged || propsChanged || privateChanged;
5812
+ return treeChanged || nameChanged || descChanged || sectionsChanged || propsChanged || privateChanged || abstractionTreeChanged;
5808
5813
  }, [
5809
5814
  ancestryName,
5810
5815
  description,
@@ -10504,32 +10509,33 @@ function XViewScene({
10504
10509
  const handleGhostNodeColorChange = (newColor) => {
10505
10510
  const { node: ghostNode, aura: ghostAura } = stateRef.current.ghostElements;
10506
10511
  if (!ghostNode) return;
10507
- const { emissiveIntensity } = computeNodeMaterialProps(newColor);
10508
- const pureColor = new THREE3.Color(newColor);
10512
+ const { color, emissive } = computeNodeMaterialProps(newColor);
10513
+ const currentIntensity = ghostNode.userData.intensity !== void 0 ? Number(ghostNode.userData.intensity) : 0;
10514
+ const finalIntensity = currentIntensity + MIN_VISIBILITY_INTENSITY;
10509
10515
  const isImageNode = ghostNode.userData.useImageAsTexture === true || String(ghostNode.userData.useImageAsTexture) === "true";
10510
10516
  if (isImageNode) {
10511
10517
  const borderMesh = ghostNode.getObjectByName("borderRing");
10512
10518
  if (borderMesh && borderMesh.material) {
10513
- borderMesh.material.color.copy(pureColor);
10519
+ borderMesh.material.color.copy(color);
10514
10520
  if (borderMesh.material.emissive) {
10515
- borderMesh.material.emissive.copy(pureColor);
10516
- borderMesh.material.emissiveIntensity = emissiveIntensity;
10521
+ borderMesh.material.emissive.copy(emissive);
10522
+ borderMesh.material.emissiveIntensity = finalIntensity;
10517
10523
  }
10518
10524
  }
10519
10525
  } else {
10520
10526
  if (ghostNode.material) {
10521
- ghostNode.material.color.copy(pureColor);
10527
+ ghostNode.material.color.copy(color);
10522
10528
  if (ghostNode.material.emissive) {
10523
- ghostNode.material.emissive.copy(pureColor);
10524
- ghostNode.material.emissiveIntensity = emissiveIntensity;
10529
+ ghostNode.material.emissive.copy(emissive);
10530
+ ghostNode.material.emissiveIntensity = finalIntensity;
10525
10531
  }
10526
10532
  }
10527
10533
  }
10528
10534
  if (ghostAura && ghostAura.material) {
10529
- ghostAura.material.color.set(newColor);
10535
+ ghostAura.material.color.copy(color).lerp(new THREE3.Color("#ffffff"), 0.25);
10530
10536
  }
10531
10537
  ghostNode.userData.color = newColor;
10532
- ghostNode.userData._baseEmissiveIntensity = emissiveIntensity;
10538
+ ghostNode.userData._baseEmissiveIntensity = finalIntensity;
10533
10539
  };
10534
10540
  const handleGhostNodeSizeChange = (sizeKey) => {
10535
10541
  const { node: ghostNode } = stateRef.current.ghostElements;
@@ -10570,7 +10576,9 @@ function XViewScene({
10570
10576
  var _a2;
10571
10577
  const mesh = stateRef.current.nodeObjects[String(nodeId)];
10572
10578
  if (!mesh) return;
10573
- const { color, emissive, emissiveIntensity } = computeNodeMaterialProps(newColor);
10579
+ const { color, emissive } = computeNodeMaterialProps(newColor);
10580
+ const currentIntensity = mesh.userData.intensity !== void 0 ? Number(mesh.userData.intensity) : 0;
10581
+ const finalIntensity = currentIntensity + MIN_VISIBILITY_INTENSITY;
10574
10582
  const isImageNode = mesh.userData.useImageAsTexture === true || String(mesh.userData.useImageAsTexture) === "true";
10575
10583
  if (isImageNode) {
10576
10584
  const borderMesh = mesh.getObjectByName("borderRing");
@@ -10578,20 +10586,22 @@ function XViewScene({
10578
10586
  borderMesh.material.color.copy(color);
10579
10587
  if (borderMesh.material.emissive) {
10580
10588
  borderMesh.material.emissive.copy(emissive);
10581
- borderMesh.material.emissiveIntensity = emissiveIntensity;
10589
+ borderMesh.material.emissiveIntensity = finalIntensity;
10582
10590
  }
10583
10591
  }
10584
10592
  } else {
10585
10593
  if (mesh.material) {
10586
10594
  mesh.material.color.copy(color);
10587
10595
  mesh.material.emissive.copy(emissive);
10588
- mesh.material.emissiveIntensity = emissiveIntensity;
10596
+ mesh.material.emissiveIntensity = finalIntensity;
10589
10597
  }
10590
10598
  }
10591
10599
  const aura = mesh.getObjectByName("aura");
10592
- if ((_a2 = aura == null ? void 0 : aura.material) == null ? void 0 : _a2.color) aura.material.color.set(newColor);
10600
+ if ((_a2 = aura == null ? void 0 : aura.material) == null ? void 0 : _a2.color) {
10601
+ aura.material.color.copy(color).lerp(new THREE3.Color("#ffffff"), 0.25);
10602
+ }
10593
10603
  mesh.userData.color = newColor;
10594
- mesh.userData._baseEmissiveIntensity = emissiveIntensity;
10604
+ mesh.userData._baseEmissiveIntensity = finalIntensity;
10595
10605
  };
10596
10606
  const handleDetailNodeSizeChange = (nodeId, newSize) => {
10597
10607
  const mesh = stateRef.current.nodeObjects[String(nodeId)];
package/dist/index.mjs CHANGED
@@ -811,7 +811,6 @@ var x_view_config = {
811
811
  ANCESTOR_HIGHLIGHT_COLOR: "#FFD700",
812
812
  BLOOM_EFFECT: { strength: 1.35, radius: 0.6, threshold: 0.52 },
813
813
  EMISSIVE_MULTIPLIER: {
814
- // AJUSTE: Valores agora representam ADIÇÃO de intensidade, não multiplicação
815
814
  BASE: 0,
816
815
  HOVER: 2,
817
816
  SELECTED: 1.5,
@@ -863,7 +862,6 @@ var computeNodeMaterialProps = (colorHex) => {
863
862
  return {
864
863
  color: srgb,
865
864
  emissive: emissiveColor
866
- // Intensity é controlada externamente
867
865
  };
868
866
  };
869
867
  var createNodeMesh = (nodeData, position, glowTexture) => {
@@ -1154,6 +1152,7 @@ var createMultipleLinkLines = (linksArray, sourceNodeMesh, targetNodeMesh, resol
1154
1152
  resolution,
1155
1153
  isCurved,
1156
1154
  isCurved,
1155
+ isCurved,
1157
1156
  curveOffset
1158
1157
  );
1159
1158
  line.userData = {
@@ -1530,12 +1529,12 @@ var userActionHandlers = {
1530
1529
  stateRef.current.creation = { isActive: true, sourceNodeData };
1531
1530
  const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
1532
1531
  const sourceColor = sourceNodeData.color || "#cccccc";
1533
- const { emissiveIntensity } = computeNodeMaterialProps(sourceColor);
1534
- const ghostColor = new THREE.Color(sourceColor);
1532
+ const { color: ghostColor, emissive: ghostEmissive } = computeNodeMaterialProps(sourceColor);
1535
1533
  const ghostMaterial = new THREE.MeshStandardMaterial({
1536
1534
  color: ghostColor,
1537
- emissive: ghostColor,
1538
- emissiveIntensity,
1535
+ emissive: ghostEmissive,
1536
+ emissiveIntensity: MIN_VISIBILITY_INTENSITY,
1537
+ // <-- Forçamos o brilho mínimo
1539
1538
  roughness: 0.6,
1540
1539
  metalness: 0,
1541
1540
  transparent: true,
@@ -1664,12 +1663,12 @@ var userActionHandlers = {
1664
1663
  stateRef.current.creation = { isActive: true, sourceNodeData };
1665
1664
  const ghostGeometry = new THREE.SphereGeometry(1.5, 32, 32);
1666
1665
  const sourceColor = sourceNodeData.color || "#cccccc";
1667
- const { emissiveIntensity } = computeNodeMaterialProps(sourceColor);
1668
- const ghostColor = new THREE.Color(sourceColor);
1666
+ const { color: ghostColor, emissive: ghostEmissive } = computeNodeMaterialProps(sourceColor);
1669
1667
  const ghostMaterial = new THREE.MeshStandardMaterial({
1670
1668
  color: ghostColor,
1671
- emissive: ghostColor,
1672
- emissiveIntensity,
1669
+ emissive: ghostEmissive,
1670
+ emissiveIntensity: MIN_VISIBILITY_INTENSITY,
1671
+ // <-- Forçamos o brilho mínimo
1673
1672
  roughness: 0.6,
1674
1673
  metalness: 0,
1675
1674
  transparent: true,
@@ -5242,6 +5241,7 @@ function CreateAncestryPanel({
5242
5241
  const branchProgressMapRef = useRef8({});
5243
5242
  const [lastSavedSnapshot, setLastSavedSnapshot] = useState10(null);
5244
5243
  const [isPrivate, setIsPrivate] = useState10(ancestryMode.is_private || false);
5244
+ const initializedContextIdRef = useRef8(null);
5245
5245
  const availableImages = customProps.filter((p) => p.type === "images").flatMap((p) => Array.isArray(p.value) ? p.value : []).filter((img) => img.value && img.value.trim() !== "");
5246
5246
  const handleImageClickFromText = (url, name) => {
5247
5247
  if (onOpenImageViewer) {
@@ -5440,6 +5440,11 @@ function CreateAncestryPanel({
5440
5440
  }, [isContextLinked, branchStack]);
5441
5441
  useEffect10(() => {
5442
5442
  const ctx = getCurrentContext();
5443
+ const currentContextId = branchStack.length > 0 ? branchStack[branchStack.length - 1].branchId : ancestryMode.currentAncestryId || `new_${ancestryMode.ancestral_node}`;
5444
+ if (initializedContextIdRef.current === currentContextId) {
5445
+ return;
5446
+ }
5447
+ initializedContextIdRef.current = currentContextId;
5443
5448
  let sourceObject = {};
5444
5449
  if (ctx) {
5445
5450
  sourceObject = ctx;
@@ -5790,7 +5795,7 @@ function CreateAncestryPanel({
5790
5795
  const currentAbsTreeStr = JSON.stringify(ancestryMode.abstraction_tree);
5791
5796
  abstractionTreeChanged = currentAbsTreeStr !== lastSavedSnapshot.abstractionTree;
5792
5797
  }
5793
- return treeChanged || nameChanged || descChanged || sectionsChanged || propsChanged || privateChanged;
5798
+ return treeChanged || nameChanged || descChanged || sectionsChanged || propsChanged || privateChanged || abstractionTreeChanged;
5794
5799
  }, [
5795
5800
  ancestryName,
5796
5801
  description,
@@ -10503,32 +10508,33 @@ function XViewScene({
10503
10508
  const handleGhostNodeColorChange = (newColor) => {
10504
10509
  const { node: ghostNode, aura: ghostAura } = stateRef.current.ghostElements;
10505
10510
  if (!ghostNode) return;
10506
- const { emissiveIntensity } = computeNodeMaterialProps(newColor);
10507
- const pureColor = new THREE3.Color(newColor);
10511
+ const { color, emissive } = computeNodeMaterialProps(newColor);
10512
+ const currentIntensity = ghostNode.userData.intensity !== void 0 ? Number(ghostNode.userData.intensity) : 0;
10513
+ const finalIntensity = currentIntensity + MIN_VISIBILITY_INTENSITY;
10508
10514
  const isImageNode = ghostNode.userData.useImageAsTexture === true || String(ghostNode.userData.useImageAsTexture) === "true";
10509
10515
  if (isImageNode) {
10510
10516
  const borderMesh = ghostNode.getObjectByName("borderRing");
10511
10517
  if (borderMesh && borderMesh.material) {
10512
- borderMesh.material.color.copy(pureColor);
10518
+ borderMesh.material.color.copy(color);
10513
10519
  if (borderMesh.material.emissive) {
10514
- borderMesh.material.emissive.copy(pureColor);
10515
- borderMesh.material.emissiveIntensity = emissiveIntensity;
10520
+ borderMesh.material.emissive.copy(emissive);
10521
+ borderMesh.material.emissiveIntensity = finalIntensity;
10516
10522
  }
10517
10523
  }
10518
10524
  } else {
10519
10525
  if (ghostNode.material) {
10520
- ghostNode.material.color.copy(pureColor);
10526
+ ghostNode.material.color.copy(color);
10521
10527
  if (ghostNode.material.emissive) {
10522
- ghostNode.material.emissive.copy(pureColor);
10523
- ghostNode.material.emissiveIntensity = emissiveIntensity;
10528
+ ghostNode.material.emissive.copy(emissive);
10529
+ ghostNode.material.emissiveIntensity = finalIntensity;
10524
10530
  }
10525
10531
  }
10526
10532
  }
10527
10533
  if (ghostAura && ghostAura.material) {
10528
- ghostAura.material.color.set(newColor);
10534
+ ghostAura.material.color.copy(color).lerp(new THREE3.Color("#ffffff"), 0.25);
10529
10535
  }
10530
10536
  ghostNode.userData.color = newColor;
10531
- ghostNode.userData._baseEmissiveIntensity = emissiveIntensity;
10537
+ ghostNode.userData._baseEmissiveIntensity = finalIntensity;
10532
10538
  };
10533
10539
  const handleGhostNodeSizeChange = (sizeKey) => {
10534
10540
  const { node: ghostNode } = stateRef.current.ghostElements;
@@ -10569,7 +10575,9 @@ function XViewScene({
10569
10575
  var _a2;
10570
10576
  const mesh = stateRef.current.nodeObjects[String(nodeId)];
10571
10577
  if (!mesh) return;
10572
- const { color, emissive, emissiveIntensity } = computeNodeMaterialProps(newColor);
10578
+ const { color, emissive } = computeNodeMaterialProps(newColor);
10579
+ const currentIntensity = mesh.userData.intensity !== void 0 ? Number(mesh.userData.intensity) : 0;
10580
+ const finalIntensity = currentIntensity + MIN_VISIBILITY_INTENSITY;
10573
10581
  const isImageNode = mesh.userData.useImageAsTexture === true || String(mesh.userData.useImageAsTexture) === "true";
10574
10582
  if (isImageNode) {
10575
10583
  const borderMesh = mesh.getObjectByName("borderRing");
@@ -10577,20 +10585,22 @@ function XViewScene({
10577
10585
  borderMesh.material.color.copy(color);
10578
10586
  if (borderMesh.material.emissive) {
10579
10587
  borderMesh.material.emissive.copy(emissive);
10580
- borderMesh.material.emissiveIntensity = emissiveIntensity;
10588
+ borderMesh.material.emissiveIntensity = finalIntensity;
10581
10589
  }
10582
10590
  }
10583
10591
  } else {
10584
10592
  if (mesh.material) {
10585
10593
  mesh.material.color.copy(color);
10586
10594
  mesh.material.emissive.copy(emissive);
10587
- mesh.material.emissiveIntensity = emissiveIntensity;
10595
+ mesh.material.emissiveIntensity = finalIntensity;
10588
10596
  }
10589
10597
  }
10590
10598
  const aura = mesh.getObjectByName("aura");
10591
- if ((_a2 = aura == null ? void 0 : aura.material) == null ? void 0 : _a2.color) aura.material.color.set(newColor);
10599
+ if ((_a2 = aura == null ? void 0 : aura.material) == null ? void 0 : _a2.color) {
10600
+ aura.material.color.copy(color).lerp(new THREE3.Color("#ffffff"), 0.25);
10601
+ }
10592
10602
  mesh.userData.color = newColor;
10593
- mesh.userData._baseEmissiveIntensity = emissiveIntensity;
10603
+ mesh.userData._baseEmissiveIntensity = finalIntensity;
10594
10604
  };
10595
10605
  const handleDetailNodeSizeChange = (nodeId, newSize) => {
10596
10606
  const mesh = stateRef.current.nodeObjects[String(nodeId)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.2-dev.2",
3
+ "version": "1.2.2-dev.4",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",