@almadar/ui 5.116.0 → 5.116.1

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.
@@ -37242,7 +37242,7 @@ function measureLabelWidth(text) {
37242
37242
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
37243
37243
  if (!labelMeasureCtx) return text.length * 6;
37244
37244
  labelMeasureCtx.font = "12px system-ui";
37245
- return labelMeasureCtx.measureText(text).width;
37245
+ return labelMeasureCtx.measureText(text).width + 4;
37246
37246
  }
37247
37247
  function getGroupColor(group, groups) {
37248
37248
  if (!group) return GROUP_COLORS2[0];
@@ -37380,10 +37380,13 @@ var init_GraphCanvas = __esm({
37380
37380
  if (!canvas || propNodes.length === 0) return;
37381
37381
  const w = logicalW;
37382
37382
  const h = height;
37383
+ const prevPos = /* @__PURE__ */ new Map();
37384
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
37383
37385
  const simNodes = propNodes.map((n, idx) => {
37384
- let x = n.x ?? 0;
37385
- let y = n.y ?? 0;
37386
- if (!n.x || !n.y) {
37386
+ const prev = prevPos.get(n.id);
37387
+ let x = prev?.x ?? n.x ?? 0;
37388
+ let y = prev?.y ?? n.y ?? 0;
37389
+ if (!prev && (!n.x || !n.y)) {
37387
37390
  if (layout === "circular") {
37388
37391
  const angle = idx / propNodes.length * 2 * Math.PI;
37389
37392
  const radius = Math.min(w, h) * 0.35;
@@ -37404,7 +37407,6 @@ var init_GraphCanvas = __esm({
37404
37407
  });
37405
37408
  nodesRef.current = simNodes;
37406
37409
  if (layout === "force") {
37407
- let iterations = 0;
37408
37410
  const maxIterations = 300;
37409
37411
  const tick = () => {
37410
37412
  const nodes = nodesRef.current;
@@ -37509,13 +37511,9 @@ var init_GraphCanvas = __esm({
37509
37511
  }
37510
37512
  }
37511
37513
  }
37512
- iterations++;
37513
- forceUpdate((n) => n + 1);
37514
- if (iterations < maxIterations) {
37515
- animRef.current = requestAnimationFrame(tick);
37516
- }
37517
37514
  };
37518
- animRef.current = requestAnimationFrame(tick);
37515
+ for (let i = 0; i < maxIterations; i++) tick();
37516
+ forceUpdate((n) => n + 1);
37519
37517
  } else {
37520
37518
  forceUpdate((n) => n + 1);
37521
37519
  }
package/dist/avl/index.js CHANGED
@@ -37196,7 +37196,7 @@ function measureLabelWidth(text) {
37196
37196
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
37197
37197
  if (!labelMeasureCtx) return text.length * 6;
37198
37198
  labelMeasureCtx.font = "12px system-ui";
37199
- return labelMeasureCtx.measureText(text).width;
37199
+ return labelMeasureCtx.measureText(text).width + 4;
37200
37200
  }
37201
37201
  function getGroupColor(group, groups) {
37202
37202
  if (!group) return GROUP_COLORS2[0];
@@ -37334,10 +37334,13 @@ var init_GraphCanvas = __esm({
37334
37334
  if (!canvas || propNodes.length === 0) return;
37335
37335
  const w = logicalW;
37336
37336
  const h = height;
37337
+ const prevPos = /* @__PURE__ */ new Map();
37338
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
37337
37339
  const simNodes = propNodes.map((n, idx) => {
37338
- let x = n.x ?? 0;
37339
- let y = n.y ?? 0;
37340
- if (!n.x || !n.y) {
37340
+ const prev = prevPos.get(n.id);
37341
+ let x = prev?.x ?? n.x ?? 0;
37342
+ let y = prev?.y ?? n.y ?? 0;
37343
+ if (!prev && (!n.x || !n.y)) {
37341
37344
  if (layout === "circular") {
37342
37345
  const angle = idx / propNodes.length * 2 * Math.PI;
37343
37346
  const radius = Math.min(w, h) * 0.35;
@@ -37358,7 +37361,6 @@ var init_GraphCanvas = __esm({
37358
37361
  });
37359
37362
  nodesRef.current = simNodes;
37360
37363
  if (layout === "force") {
37361
- let iterations = 0;
37362
37364
  const maxIterations = 300;
37363
37365
  const tick = () => {
37364
37366
  const nodes = nodesRef.current;
@@ -37463,13 +37465,9 @@ var init_GraphCanvas = __esm({
37463
37465
  }
37464
37466
  }
37465
37467
  }
37466
- iterations++;
37467
- forceUpdate((n) => n + 1);
37468
- if (iterations < maxIterations) {
37469
- animRef.current = requestAnimationFrame(tick);
37470
- }
37471
37468
  };
37472
- animRef.current = requestAnimationFrame(tick);
37469
+ for (let i = 0; i < maxIterations; i++) tick();
37470
+ forceUpdate((n) => n + 1);
37473
37471
  } else {
37474
37472
  forceUpdate((n) => n + 1);
37475
37473
  }
@@ -36631,7 +36631,7 @@ function measureLabelWidth(text) {
36631
36631
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
36632
36632
  if (!labelMeasureCtx) return text.length * 6;
36633
36633
  labelMeasureCtx.font = "12px system-ui";
36634
- return labelMeasureCtx.measureText(text).width;
36634
+ return labelMeasureCtx.measureText(text).width + 4;
36635
36635
  }
36636
36636
  function getGroupColor(group, groups) {
36637
36637
  if (!group) return GROUP_COLORS2[0];
@@ -36769,10 +36769,13 @@ var init_GraphCanvas = __esm({
36769
36769
  if (!canvas || propNodes.length === 0) return;
36770
36770
  const w = logicalW;
36771
36771
  const h = height;
36772
+ const prevPos = /* @__PURE__ */ new Map();
36773
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
36772
36774
  const simNodes = propNodes.map((n, idx) => {
36773
- let x = n.x ?? 0;
36774
- let y = n.y ?? 0;
36775
- if (!n.x || !n.y) {
36775
+ const prev = prevPos.get(n.id);
36776
+ let x = prev?.x ?? n.x ?? 0;
36777
+ let y = prev?.y ?? n.y ?? 0;
36778
+ if (!prev && (!n.x || !n.y)) {
36776
36779
  if (layout === "circular") {
36777
36780
  const angle = idx / propNodes.length * 2 * Math.PI;
36778
36781
  const radius = Math.min(w, h) * 0.35;
@@ -36793,7 +36796,6 @@ var init_GraphCanvas = __esm({
36793
36796
  });
36794
36797
  nodesRef.current = simNodes;
36795
36798
  if (layout === "force") {
36796
- let iterations = 0;
36797
36799
  const maxIterations = 300;
36798
36800
  const tick = () => {
36799
36801
  const nodes = nodesRef.current;
@@ -36898,13 +36900,9 @@ var init_GraphCanvas = __esm({
36898
36900
  }
36899
36901
  }
36900
36902
  }
36901
- iterations++;
36902
- forceUpdate((n) => n + 1);
36903
- if (iterations < maxIterations) {
36904
- animRef.current = requestAnimationFrame(tick);
36905
- }
36906
36903
  };
36907
- animRef.current = requestAnimationFrame(tick);
36904
+ for (let i = 0; i < maxIterations; i++) tick();
36905
+ forceUpdate((n) => n + 1);
36908
36906
  } else {
36909
36907
  forceUpdate((n) => n + 1);
36910
36908
  }
@@ -36586,7 +36586,7 @@ function measureLabelWidth(text) {
36586
36586
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
36587
36587
  if (!labelMeasureCtx) return text.length * 6;
36588
36588
  labelMeasureCtx.font = "12px system-ui";
36589
- return labelMeasureCtx.measureText(text).width;
36589
+ return labelMeasureCtx.measureText(text).width + 4;
36590
36590
  }
36591
36591
  function getGroupColor(group, groups) {
36592
36592
  if (!group) return GROUP_COLORS2[0];
@@ -36724,10 +36724,13 @@ var init_GraphCanvas = __esm({
36724
36724
  if (!canvas || propNodes.length === 0) return;
36725
36725
  const w = logicalW;
36726
36726
  const h = height;
36727
+ const prevPos = /* @__PURE__ */ new Map();
36728
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
36727
36729
  const simNodes = propNodes.map((n, idx) => {
36728
- let x = n.x ?? 0;
36729
- let y = n.y ?? 0;
36730
- if (!n.x || !n.y) {
36730
+ const prev = prevPos.get(n.id);
36731
+ let x = prev?.x ?? n.x ?? 0;
36732
+ let y = prev?.y ?? n.y ?? 0;
36733
+ if (!prev && (!n.x || !n.y)) {
36731
36734
  if (layout === "circular") {
36732
36735
  const angle = idx / propNodes.length * 2 * Math.PI;
36733
36736
  const radius = Math.min(w, h) * 0.35;
@@ -36748,7 +36751,6 @@ var init_GraphCanvas = __esm({
36748
36751
  });
36749
36752
  nodesRef.current = simNodes;
36750
36753
  if (layout === "force") {
36751
- let iterations = 0;
36752
36754
  const maxIterations = 300;
36753
36755
  const tick = () => {
36754
36756
  const nodes = nodesRef.current;
@@ -36853,13 +36855,9 @@ var init_GraphCanvas = __esm({
36853
36855
  }
36854
36856
  }
36855
36857
  }
36856
- iterations++;
36857
- forceUpdate((n) => n + 1);
36858
- if (iterations < maxIterations) {
36859
- animRef.current = requestAnimationFrame(tick);
36860
- }
36861
36858
  };
36862
- animRef.current = requestAnimationFrame(tick);
36859
+ for (let i = 0; i < maxIterations; i++) tick();
36860
+ forceUpdate((n) => n + 1);
36863
36861
  } else {
36864
36862
  forceUpdate((n) => n + 1);
36865
36863
  }
@@ -35372,7 +35372,7 @@ function measureLabelWidth(text) {
35372
35372
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
35373
35373
  if (!labelMeasureCtx) return text.length * 6;
35374
35374
  labelMeasureCtx.font = "12px system-ui";
35375
- return labelMeasureCtx.measureText(text).width;
35375
+ return labelMeasureCtx.measureText(text).width + 4;
35376
35376
  }
35377
35377
  function getGroupColor(group, groups) {
35378
35378
  if (!group) return GROUP_COLORS2[0];
@@ -35510,10 +35510,13 @@ var init_GraphCanvas = __esm({
35510
35510
  if (!canvas || propNodes.length === 0) return;
35511
35511
  const w = logicalW;
35512
35512
  const h = height;
35513
+ const prevPos = /* @__PURE__ */ new Map();
35514
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
35513
35515
  const simNodes = propNodes.map((n, idx) => {
35514
- let x = n.x ?? 0;
35515
- let y = n.y ?? 0;
35516
- if (!n.x || !n.y) {
35516
+ const prev = prevPos.get(n.id);
35517
+ let x = prev?.x ?? n.x ?? 0;
35518
+ let y = prev?.y ?? n.y ?? 0;
35519
+ if (!prev && (!n.x || !n.y)) {
35517
35520
  if (layout === "circular") {
35518
35521
  const angle = idx / propNodes.length * 2 * Math.PI;
35519
35522
  const radius = Math.min(w, h) * 0.35;
@@ -35534,7 +35537,6 @@ var init_GraphCanvas = __esm({
35534
35537
  });
35535
35538
  nodesRef.current = simNodes;
35536
35539
  if (layout === "force") {
35537
- let iterations = 0;
35538
35540
  const maxIterations = 300;
35539
35541
  const tick = () => {
35540
35542
  const nodes = nodesRef.current;
@@ -35639,13 +35641,9 @@ var init_GraphCanvas = __esm({
35639
35641
  }
35640
35642
  }
35641
35643
  }
35642
- iterations++;
35643
- forceUpdate((n) => n + 1);
35644
- if (iterations < maxIterations) {
35645
- animRef.current = requestAnimationFrame(tick);
35646
- }
35647
35644
  };
35648
- animRef.current = requestAnimationFrame(tick);
35645
+ for (let i = 0; i < maxIterations; i++) tick();
35646
+ forceUpdate((n) => n + 1);
35649
35647
  } else {
35650
35648
  forceUpdate((n) => n + 1);
35651
35649
  }
@@ -35327,7 +35327,7 @@ function measureLabelWidth(text) {
35327
35327
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
35328
35328
  if (!labelMeasureCtx) return text.length * 6;
35329
35329
  labelMeasureCtx.font = "12px system-ui";
35330
- return labelMeasureCtx.measureText(text).width;
35330
+ return labelMeasureCtx.measureText(text).width + 4;
35331
35331
  }
35332
35332
  function getGroupColor(group, groups) {
35333
35333
  if (!group) return GROUP_COLORS2[0];
@@ -35465,10 +35465,13 @@ var init_GraphCanvas = __esm({
35465
35465
  if (!canvas || propNodes.length === 0) return;
35466
35466
  const w = logicalW;
35467
35467
  const h = height;
35468
+ const prevPos = /* @__PURE__ */ new Map();
35469
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
35468
35470
  const simNodes = propNodes.map((n, idx) => {
35469
- let x = n.x ?? 0;
35470
- let y = n.y ?? 0;
35471
- if (!n.x || !n.y) {
35471
+ const prev = prevPos.get(n.id);
35472
+ let x = prev?.x ?? n.x ?? 0;
35473
+ let y = prev?.y ?? n.y ?? 0;
35474
+ if (!prev && (!n.x || !n.y)) {
35472
35475
  if (layout === "circular") {
35473
35476
  const angle = idx / propNodes.length * 2 * Math.PI;
35474
35477
  const radius = Math.min(w, h) * 0.35;
@@ -35489,7 +35492,6 @@ var init_GraphCanvas = __esm({
35489
35492
  });
35490
35493
  nodesRef.current = simNodes;
35491
35494
  if (layout === "force") {
35492
- let iterations = 0;
35493
35495
  const maxIterations = 300;
35494
35496
  const tick = () => {
35495
35497
  const nodes = nodesRef.current;
@@ -35594,13 +35596,9 @@ var init_GraphCanvas = __esm({
35594
35596
  }
35595
35597
  }
35596
35598
  }
35597
- iterations++;
35598
- forceUpdate((n) => n + 1);
35599
- if (iterations < maxIterations) {
35600
- animRef.current = requestAnimationFrame(tick);
35601
- }
35602
35599
  };
35603
- animRef.current = requestAnimationFrame(tick);
35600
+ for (let i = 0; i < maxIterations; i++) tick();
35601
+ forceUpdate((n) => n + 1);
35604
35602
  } else {
35605
35603
  forceUpdate((n) => n + 1);
35606
35604
  }
@@ -34737,7 +34737,7 @@ function measureLabelWidth(text) {
34737
34737
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
34738
34738
  if (!labelMeasureCtx) return text.length * 6;
34739
34739
  labelMeasureCtx.font = "12px system-ui";
34740
- return labelMeasureCtx.measureText(text).width;
34740
+ return labelMeasureCtx.measureText(text).width + 4;
34741
34741
  }
34742
34742
  function getGroupColor(group, groups) {
34743
34743
  if (!group) return GROUP_COLORS2[0];
@@ -34875,10 +34875,13 @@ var init_GraphCanvas = __esm({
34875
34875
  if (!canvas || propNodes.length === 0) return;
34876
34876
  const w = logicalW;
34877
34877
  const h = height;
34878
+ const prevPos = /* @__PURE__ */ new Map();
34879
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
34878
34880
  const simNodes = propNodes.map((n, idx) => {
34879
- let x = n.x ?? 0;
34880
- let y = n.y ?? 0;
34881
- if (!n.x || !n.y) {
34881
+ const prev = prevPos.get(n.id);
34882
+ let x = prev?.x ?? n.x ?? 0;
34883
+ let y = prev?.y ?? n.y ?? 0;
34884
+ if (!prev && (!n.x || !n.y)) {
34882
34885
  if (layout === "circular") {
34883
34886
  const angle = idx / propNodes.length * 2 * Math.PI;
34884
34887
  const radius = Math.min(w, h) * 0.35;
@@ -34899,7 +34902,6 @@ var init_GraphCanvas = __esm({
34899
34902
  });
34900
34903
  nodesRef.current = simNodes;
34901
34904
  if (layout === "force") {
34902
- let iterations = 0;
34903
34905
  const maxIterations = 300;
34904
34906
  const tick = () => {
34905
34907
  const nodes = nodesRef.current;
@@ -35004,13 +35006,9 @@ var init_GraphCanvas = __esm({
35004
35006
  }
35005
35007
  }
35006
35008
  }
35007
- iterations++;
35008
- forceUpdate((n) => n + 1);
35009
- if (iterations < maxIterations) {
35010
- animRef.current = requestAnimationFrame(tick);
35011
- }
35012
35009
  };
35013
- animRef.current = requestAnimationFrame(tick);
35010
+ for (let i = 0; i < maxIterations; i++) tick();
35011
+ forceUpdate((n) => n + 1);
35014
35012
  } else {
35015
35013
  forceUpdate((n) => n + 1);
35016
35014
  }
@@ -34693,7 +34693,7 @@ function measureLabelWidth(text) {
34693
34693
  if (!labelMeasureCtx) labelMeasureCtx = document.createElement("canvas").getContext("2d");
34694
34694
  if (!labelMeasureCtx) return text.length * 6;
34695
34695
  labelMeasureCtx.font = "12px system-ui";
34696
- return labelMeasureCtx.measureText(text).width;
34696
+ return labelMeasureCtx.measureText(text).width + 4;
34697
34697
  }
34698
34698
  function getGroupColor(group, groups) {
34699
34699
  if (!group) return GROUP_COLORS2[0];
@@ -34831,10 +34831,13 @@ var init_GraphCanvas = __esm({
34831
34831
  if (!canvas || propNodes.length === 0) return;
34832
34832
  const w = logicalW;
34833
34833
  const h = height;
34834
+ const prevPos = /* @__PURE__ */ new Map();
34835
+ for (const pn of nodesRef.current) if (pn.x != null && pn.y != null) prevPos.set(pn.id, { x: pn.x, y: pn.y });
34834
34836
  const simNodes = propNodes.map((n, idx) => {
34835
- let x = n.x ?? 0;
34836
- let y = n.y ?? 0;
34837
- if (!n.x || !n.y) {
34837
+ const prev = prevPos.get(n.id);
34838
+ let x = prev?.x ?? n.x ?? 0;
34839
+ let y = prev?.y ?? n.y ?? 0;
34840
+ if (!prev && (!n.x || !n.y)) {
34838
34841
  if (layout === "circular") {
34839
34842
  const angle = idx / propNodes.length * 2 * Math.PI;
34840
34843
  const radius = Math.min(w, h) * 0.35;
@@ -34855,7 +34858,6 @@ var init_GraphCanvas = __esm({
34855
34858
  });
34856
34859
  nodesRef.current = simNodes;
34857
34860
  if (layout === "force") {
34858
- let iterations = 0;
34859
34861
  const maxIterations = 300;
34860
34862
  const tick = () => {
34861
34863
  const nodes = nodesRef.current;
@@ -34960,13 +34962,9 @@ var init_GraphCanvas = __esm({
34960
34962
  }
34961
34963
  }
34962
34964
  }
34963
- iterations++;
34964
- forceUpdate((n) => n + 1);
34965
- if (iterations < maxIterations) {
34966
- animRef.current = requestAnimationFrame(tick);
34967
- }
34968
34965
  };
34969
- animRef.current = requestAnimationFrame(tick);
34966
+ for (let i = 0; i < maxIterations; i++) tick();
34967
+ forceUpdate((n) => n + 1);
34970
34968
  } else {
34971
34969
  forceUpdate((n) => n + 1);
34972
34970
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.116.0",
3
+ "version": "5.116.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [