@almadar/ui 5.114.0 → 5.115.0

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.
@@ -37405,7 +37405,7 @@ var init_GraphCanvas = __esm({
37405
37405
  nodesRef.current = simNodes;
37406
37406
  if (layout === "force") {
37407
37407
  let iterations = 0;
37408
- const maxIterations = 100;
37408
+ const maxIterations = 300;
37409
37409
  const tick = () => {
37410
37410
  const nodes = nodesRef.current;
37411
37411
  const centerX = w / 2;
@@ -37435,9 +37435,9 @@ var init_GraphCanvas = __esm({
37435
37435
  const dx = target.x - source.x;
37436
37436
  const dy = target.y - source.y;
37437
37437
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
37438
- const w2 = edge.weight ?? 1;
37439
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
37440
- const force = (dist - linkTarget) * 0.05;
37438
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
37439
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
37440
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
37441
37441
  const fx = dx / dist * force;
37442
37442
  const fy = dy / dist * force;
37443
37443
  source.fx += fx;
@@ -37445,9 +37445,27 @@ var init_GraphCanvas = __esm({
37445
37445
  target.fx -= fx;
37446
37446
  target.fy -= fy;
37447
37447
  }
37448
+ const centroids = /* @__PURE__ */ new Map();
37448
37449
  for (const node of nodes) {
37449
- node.fx += (centerX - node.x) * 0.01;
37450
- node.fy += (centerY - node.y) * 0.01;
37450
+ const g = node.group ?? "__none__";
37451
+ let c = centroids.get(g);
37452
+ if (!c) {
37453
+ c = { x: 0, y: 0, n: 0 };
37454
+ centroids.set(g, c);
37455
+ }
37456
+ c.x += node.x;
37457
+ c.y += node.y;
37458
+ c.n += 1;
37459
+ }
37460
+ for (const node of nodes) {
37461
+ const c = centroids.get(node.group ?? "__none__");
37462
+ if (c && c.n > 1) {
37463
+ node.fx += (c.x / c.n - node.x) * 0.04;
37464
+ node.fy += (c.y / c.n - node.y) * 0.04;
37465
+ } else {
37466
+ node.fx += (centerX - node.x) * 0.01;
37467
+ node.fy += (centerY - node.y) * 0.01;
37468
+ }
37451
37469
  }
37452
37470
  const damping = 0.9;
37453
37471
  for (const node of nodes) {
package/dist/avl/index.js CHANGED
@@ -37359,7 +37359,7 @@ var init_GraphCanvas = __esm({
37359
37359
  nodesRef.current = simNodes;
37360
37360
  if (layout === "force") {
37361
37361
  let iterations = 0;
37362
- const maxIterations = 100;
37362
+ const maxIterations = 300;
37363
37363
  const tick = () => {
37364
37364
  const nodes = nodesRef.current;
37365
37365
  const centerX = w / 2;
@@ -37389,9 +37389,9 @@ var init_GraphCanvas = __esm({
37389
37389
  const dx = target.x - source.x;
37390
37390
  const dy = target.y - source.y;
37391
37391
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
37392
- const w2 = edge.weight ?? 1;
37393
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
37394
- const force = (dist - linkTarget) * 0.05;
37392
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
37393
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
37394
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
37395
37395
  const fx = dx / dist * force;
37396
37396
  const fy = dy / dist * force;
37397
37397
  source.fx += fx;
@@ -37399,9 +37399,27 @@ var init_GraphCanvas = __esm({
37399
37399
  target.fx -= fx;
37400
37400
  target.fy -= fy;
37401
37401
  }
37402
+ const centroids = /* @__PURE__ */ new Map();
37402
37403
  for (const node of nodes) {
37403
- node.fx += (centerX - node.x) * 0.01;
37404
- node.fy += (centerY - node.y) * 0.01;
37404
+ const g = node.group ?? "__none__";
37405
+ let c = centroids.get(g);
37406
+ if (!c) {
37407
+ c = { x: 0, y: 0, n: 0 };
37408
+ centroids.set(g, c);
37409
+ }
37410
+ c.x += node.x;
37411
+ c.y += node.y;
37412
+ c.n += 1;
37413
+ }
37414
+ for (const node of nodes) {
37415
+ const c = centroids.get(node.group ?? "__none__");
37416
+ if (c && c.n > 1) {
37417
+ node.fx += (c.x / c.n - node.x) * 0.04;
37418
+ node.fy += (c.y / c.n - node.y) * 0.04;
37419
+ } else {
37420
+ node.fx += (centerX - node.x) * 0.01;
37421
+ node.fy += (centerY - node.y) * 0.01;
37422
+ }
37405
37423
  }
37406
37424
  const damping = 0.9;
37407
37425
  for (const node of nodes) {
@@ -36794,7 +36794,7 @@ var init_GraphCanvas = __esm({
36794
36794
  nodesRef.current = simNodes;
36795
36795
  if (layout === "force") {
36796
36796
  let iterations = 0;
36797
- const maxIterations = 100;
36797
+ const maxIterations = 300;
36798
36798
  const tick = () => {
36799
36799
  const nodes = nodesRef.current;
36800
36800
  const centerX = w / 2;
@@ -36824,9 +36824,9 @@ var init_GraphCanvas = __esm({
36824
36824
  const dx = target.x - source.x;
36825
36825
  const dy = target.y - source.y;
36826
36826
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
36827
- const w2 = edge.weight ?? 1;
36828
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
36829
- const force = (dist - linkTarget) * 0.05;
36827
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
36828
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
36829
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
36830
36830
  const fx = dx / dist * force;
36831
36831
  const fy = dy / dist * force;
36832
36832
  source.fx += fx;
@@ -36834,9 +36834,27 @@ var init_GraphCanvas = __esm({
36834
36834
  target.fx -= fx;
36835
36835
  target.fy -= fy;
36836
36836
  }
36837
+ const centroids = /* @__PURE__ */ new Map();
36837
36838
  for (const node of nodes) {
36838
- node.fx += (centerX - node.x) * 0.01;
36839
- node.fy += (centerY - node.y) * 0.01;
36839
+ const g = node.group ?? "__none__";
36840
+ let c = centroids.get(g);
36841
+ if (!c) {
36842
+ c = { x: 0, y: 0, n: 0 };
36843
+ centroids.set(g, c);
36844
+ }
36845
+ c.x += node.x;
36846
+ c.y += node.y;
36847
+ c.n += 1;
36848
+ }
36849
+ for (const node of nodes) {
36850
+ const c = centroids.get(node.group ?? "__none__");
36851
+ if (c && c.n > 1) {
36852
+ node.fx += (c.x / c.n - node.x) * 0.04;
36853
+ node.fy += (c.y / c.n - node.y) * 0.04;
36854
+ } else {
36855
+ node.fx += (centerX - node.x) * 0.01;
36856
+ node.fy += (centerY - node.y) * 0.01;
36857
+ }
36840
36858
  }
36841
36859
  const damping = 0.9;
36842
36860
  for (const node of nodes) {
@@ -36749,7 +36749,7 @@ var init_GraphCanvas = __esm({
36749
36749
  nodesRef.current = simNodes;
36750
36750
  if (layout === "force") {
36751
36751
  let iterations = 0;
36752
- const maxIterations = 100;
36752
+ const maxIterations = 300;
36753
36753
  const tick = () => {
36754
36754
  const nodes = nodesRef.current;
36755
36755
  const centerX = w / 2;
@@ -36779,9 +36779,9 @@ var init_GraphCanvas = __esm({
36779
36779
  const dx = target.x - source.x;
36780
36780
  const dy = target.y - source.y;
36781
36781
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
36782
- const w2 = edge.weight ?? 1;
36783
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
36784
- const force = (dist - linkTarget) * 0.05;
36782
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
36783
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
36784
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
36785
36785
  const fx = dx / dist * force;
36786
36786
  const fy = dy / dist * force;
36787
36787
  source.fx += fx;
@@ -36789,9 +36789,27 @@ var init_GraphCanvas = __esm({
36789
36789
  target.fx -= fx;
36790
36790
  target.fy -= fy;
36791
36791
  }
36792
+ const centroids = /* @__PURE__ */ new Map();
36792
36793
  for (const node of nodes) {
36793
- node.fx += (centerX - node.x) * 0.01;
36794
- node.fy += (centerY - node.y) * 0.01;
36794
+ const g = node.group ?? "__none__";
36795
+ let c = centroids.get(g);
36796
+ if (!c) {
36797
+ c = { x: 0, y: 0, n: 0 };
36798
+ centroids.set(g, c);
36799
+ }
36800
+ c.x += node.x;
36801
+ c.y += node.y;
36802
+ c.n += 1;
36803
+ }
36804
+ for (const node of nodes) {
36805
+ const c = centroids.get(node.group ?? "__none__");
36806
+ if (c && c.n > 1) {
36807
+ node.fx += (c.x / c.n - node.x) * 0.04;
36808
+ node.fy += (c.y / c.n - node.y) * 0.04;
36809
+ } else {
36810
+ node.fx += (centerX - node.x) * 0.01;
36811
+ node.fy += (centerY - node.y) * 0.01;
36812
+ }
36795
36813
  }
36796
36814
  const damping = 0.9;
36797
36815
  for (const node of nodes) {
@@ -706,6 +706,7 @@ function ModelLoader({
706
706
  box.getSize(size);
707
707
  const maxDim = Math.max(size.x, size.y, size.z);
708
708
  if (!Number.isFinite(maxDim) || maxDim < 0.05) return 1;
709
+ log3.warn(`TMP-GG1 bounds ${url.split("/").pop() ?? url} size=${JSON.stringify([size.x, size.y, size.z])} scaleProp=${JSON.stringify(scale)}`);
709
710
  return 1 / maxDim;
710
711
  }, [model]);
711
712
  const scaleArray = React3.useMemo(() => {
@@ -913,7 +914,11 @@ function Sprite3D({ node, projector }) {
913
914
  node.height * projector.cellSize,
914
915
  node.width * projector.cellSize
915
916
  ];
916
- return /* @__PURE__ */ jsxRuntime.jsx("group", { position: projector.toWorld(node.position), children: /* @__PURE__ */ jsxRuntime.jsx(
917
+ const world = projector.toWorld(node.position);
918
+ if (node.position.z !== void 0) {
919
+ console.warn(`TMP-GG1 sprite3d ${asset.url.split("/").pop() ?? asset.url} posZ=${node.position.z} world=${JSON.stringify(world)} scale=${JSON.stringify(scale)}`);
920
+ }
921
+ return /* @__PURE__ */ jsxRuntime.jsx("group", { position: world, children: /* @__PURE__ */ jsxRuntime.jsx(
917
922
  ModelLoader,
918
923
  {
919
924
  url: asset.url,
@@ -682,6 +682,7 @@ function ModelLoader({
682
682
  box.getSize(size);
683
683
  const maxDim = Math.max(size.x, size.y, size.z);
684
684
  if (!Number.isFinite(maxDim) || maxDim < 0.05) return 1;
685
+ log3.warn(`TMP-GG1 bounds ${url.split("/").pop() ?? url} size=${JSON.stringify([size.x, size.y, size.z])} scaleProp=${JSON.stringify(scale)}`);
685
686
  return 1 / maxDim;
686
687
  }, [model]);
687
688
  const scaleArray = useMemo(() => {
@@ -889,7 +890,11 @@ function Sprite3D({ node, projector }) {
889
890
  node.height * projector.cellSize,
890
891
  node.width * projector.cellSize
891
892
  ];
892
- return /* @__PURE__ */ jsx("group", { position: projector.toWorld(node.position), children: /* @__PURE__ */ jsx(
893
+ const world = projector.toWorld(node.position);
894
+ if (node.position.z !== void 0) {
895
+ console.warn(`TMP-GG1 sprite3d ${asset.url.split("/").pop() ?? asset.url} posZ=${node.position.z} world=${JSON.stringify(world)} scale=${JSON.stringify(scale)}`);
896
+ }
897
+ return /* @__PURE__ */ jsx("group", { position: world, children: /* @__PURE__ */ jsx(
893
898
  ModelLoader,
894
899
  {
895
900
  url: asset.url,
@@ -35535,7 +35535,7 @@ var init_GraphCanvas = __esm({
35535
35535
  nodesRef.current = simNodes;
35536
35536
  if (layout === "force") {
35537
35537
  let iterations = 0;
35538
- const maxIterations = 100;
35538
+ const maxIterations = 300;
35539
35539
  const tick = () => {
35540
35540
  const nodes = nodesRef.current;
35541
35541
  const centerX = w / 2;
@@ -35565,9 +35565,9 @@ var init_GraphCanvas = __esm({
35565
35565
  const dx = target.x - source.x;
35566
35566
  const dy = target.y - source.y;
35567
35567
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
35568
- const w2 = edge.weight ?? 1;
35569
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
35570
- const force = (dist - linkTarget) * 0.05;
35568
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
35569
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
35570
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
35571
35571
  const fx = dx / dist * force;
35572
35572
  const fy = dy / dist * force;
35573
35573
  source.fx += fx;
@@ -35575,9 +35575,27 @@ var init_GraphCanvas = __esm({
35575
35575
  target.fx -= fx;
35576
35576
  target.fy -= fy;
35577
35577
  }
35578
+ const centroids = /* @__PURE__ */ new Map();
35578
35579
  for (const node of nodes) {
35579
- node.fx += (centerX - node.x) * 0.01;
35580
- node.fy += (centerY - node.y) * 0.01;
35580
+ const g = node.group ?? "__none__";
35581
+ let c = centroids.get(g);
35582
+ if (!c) {
35583
+ c = { x: 0, y: 0, n: 0 };
35584
+ centroids.set(g, c);
35585
+ }
35586
+ c.x += node.x;
35587
+ c.y += node.y;
35588
+ c.n += 1;
35589
+ }
35590
+ for (const node of nodes) {
35591
+ const c = centroids.get(node.group ?? "__none__");
35592
+ if (c && c.n > 1) {
35593
+ node.fx += (c.x / c.n - node.x) * 0.04;
35594
+ node.fy += (c.y / c.n - node.y) * 0.04;
35595
+ } else {
35596
+ node.fx += (centerX - node.x) * 0.01;
35597
+ node.fy += (centerY - node.y) * 0.01;
35598
+ }
35581
35599
  }
35582
35600
  const damping = 0.9;
35583
35601
  for (const node of nodes) {
@@ -35490,7 +35490,7 @@ var init_GraphCanvas = __esm({
35490
35490
  nodesRef.current = simNodes;
35491
35491
  if (layout === "force") {
35492
35492
  let iterations = 0;
35493
- const maxIterations = 100;
35493
+ const maxIterations = 300;
35494
35494
  const tick = () => {
35495
35495
  const nodes = nodesRef.current;
35496
35496
  const centerX = w / 2;
@@ -35520,9 +35520,9 @@ var init_GraphCanvas = __esm({
35520
35520
  const dx = target.x - source.x;
35521
35521
  const dy = target.y - source.y;
35522
35522
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
35523
- const w2 = edge.weight ?? 1;
35524
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
35525
- const force = (dist - linkTarget) * 0.05;
35523
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
35524
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
35525
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
35526
35526
  const fx = dx / dist * force;
35527
35527
  const fy = dy / dist * force;
35528
35528
  source.fx += fx;
@@ -35530,9 +35530,27 @@ var init_GraphCanvas = __esm({
35530
35530
  target.fx -= fx;
35531
35531
  target.fy -= fy;
35532
35532
  }
35533
+ const centroids = /* @__PURE__ */ new Map();
35533
35534
  for (const node of nodes) {
35534
- node.fx += (centerX - node.x) * 0.01;
35535
- node.fy += (centerY - node.y) * 0.01;
35535
+ const g = node.group ?? "__none__";
35536
+ let c = centroids.get(g);
35537
+ if (!c) {
35538
+ c = { x: 0, y: 0, n: 0 };
35539
+ centroids.set(g, c);
35540
+ }
35541
+ c.x += node.x;
35542
+ c.y += node.y;
35543
+ c.n += 1;
35544
+ }
35545
+ for (const node of nodes) {
35546
+ const c = centroids.get(node.group ?? "__none__");
35547
+ if (c && c.n > 1) {
35548
+ node.fx += (c.x / c.n - node.x) * 0.04;
35549
+ node.fy += (c.y / c.n - node.y) * 0.04;
35550
+ } else {
35551
+ node.fx += (centerX - node.x) * 0.01;
35552
+ node.fy += (centerY - node.y) * 0.01;
35553
+ }
35536
35554
  }
35537
35555
  const damping = 0.9;
35538
35556
  for (const node of nodes) {
@@ -34900,7 +34900,7 @@ var init_GraphCanvas = __esm({
34900
34900
  nodesRef.current = simNodes;
34901
34901
  if (layout === "force") {
34902
34902
  let iterations = 0;
34903
- const maxIterations = 100;
34903
+ const maxIterations = 300;
34904
34904
  const tick = () => {
34905
34905
  const nodes = nodesRef.current;
34906
34906
  const centerX = w / 2;
@@ -34930,9 +34930,9 @@ var init_GraphCanvas = __esm({
34930
34930
  const dx = target.x - source.x;
34931
34931
  const dy = target.y - source.y;
34932
34932
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
34933
- const w2 = edge.weight ?? 1;
34934
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
34935
- const force = (dist - linkTarget) * 0.05;
34933
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
34934
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
34935
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
34936
34936
  const fx = dx / dist * force;
34937
34937
  const fy = dy / dist * force;
34938
34938
  source.fx += fx;
@@ -34940,9 +34940,27 @@ var init_GraphCanvas = __esm({
34940
34940
  target.fx -= fx;
34941
34941
  target.fy -= fy;
34942
34942
  }
34943
+ const centroids = /* @__PURE__ */ new Map();
34943
34944
  for (const node of nodes) {
34944
- node.fx += (centerX - node.x) * 0.01;
34945
- node.fy += (centerY - node.y) * 0.01;
34945
+ const g = node.group ?? "__none__";
34946
+ let c = centroids.get(g);
34947
+ if (!c) {
34948
+ c = { x: 0, y: 0, n: 0 };
34949
+ centroids.set(g, c);
34950
+ }
34951
+ c.x += node.x;
34952
+ c.y += node.y;
34953
+ c.n += 1;
34954
+ }
34955
+ for (const node of nodes) {
34956
+ const c = centroids.get(node.group ?? "__none__");
34957
+ if (c && c.n > 1) {
34958
+ node.fx += (c.x / c.n - node.x) * 0.04;
34959
+ node.fy += (c.y / c.n - node.y) * 0.04;
34960
+ } else {
34961
+ node.fx += (centerX - node.x) * 0.01;
34962
+ node.fy += (centerY - node.y) * 0.01;
34963
+ }
34946
34964
  }
34947
34965
  const damping = 0.9;
34948
34966
  for (const node of nodes) {
@@ -34856,7 +34856,7 @@ var init_GraphCanvas = __esm({
34856
34856
  nodesRef.current = simNodes;
34857
34857
  if (layout === "force") {
34858
34858
  let iterations = 0;
34859
- const maxIterations = 100;
34859
+ const maxIterations = 300;
34860
34860
  const tick = () => {
34861
34861
  const nodes = nodesRef.current;
34862
34862
  const centerX = w / 2;
@@ -34886,9 +34886,9 @@ var init_GraphCanvas = __esm({
34886
34886
  const dx = target.x - source.x;
34887
34887
  const dy = target.y - source.y;
34888
34888
  const dist = Math.sqrt(dx * dx + dy * dy) || 1;
34889
- const w2 = edge.weight ?? 1;
34890
- const linkTarget = linkDistance * (1 + (1 - Math.min(1, Math.max(0, w2))) * 1.5);
34891
- const force = (dist - linkTarget) * 0.05;
34889
+ const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
34890
+ const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
34891
+ const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
34892
34892
  const fx = dx / dist * force;
34893
34893
  const fy = dy / dist * force;
34894
34894
  source.fx += fx;
@@ -34896,9 +34896,27 @@ var init_GraphCanvas = __esm({
34896
34896
  target.fx -= fx;
34897
34897
  target.fy -= fy;
34898
34898
  }
34899
+ const centroids = /* @__PURE__ */ new Map();
34899
34900
  for (const node of nodes) {
34900
- node.fx += (centerX - node.x) * 0.01;
34901
- node.fy += (centerY - node.y) * 0.01;
34901
+ const g = node.group ?? "__none__";
34902
+ let c = centroids.get(g);
34903
+ if (!c) {
34904
+ c = { x: 0, y: 0, n: 0 };
34905
+ centroids.set(g, c);
34906
+ }
34907
+ c.x += node.x;
34908
+ c.y += node.y;
34909
+ c.n += 1;
34910
+ }
34911
+ for (const node of nodes) {
34912
+ const c = centroids.get(node.group ?? "__none__");
34913
+ if (c && c.n > 1) {
34914
+ node.fx += (c.x / c.n - node.x) * 0.04;
34915
+ node.fy += (c.y / c.n - node.y) * 0.04;
34916
+ } else {
34917
+ node.fx += (centerX - node.x) * 0.01;
34918
+ node.fy += (centerY - node.y) * 0.01;
34919
+ }
34902
34920
  }
34903
34921
  const damping = 0.9;
34904
34922
  for (const node of nodes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.114.0",
3
+ "version": "5.115.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [