@opentrace/components 0.1.1-rc.11 → 0.1.1-rc.30

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.
Files changed (39) hide show
  1. package/dist/opentrace-components.cjs +159 -47
  2. package/dist/opentrace-components.cjs.map +1 -1
  3. package/dist/opentrace-components.js +160 -48
  4. package/dist/opentrace-components.js.map +1 -1
  5. package/dist/src/GraphCanvas.d.ts +22 -1
  6. package/dist/src/GraphCanvas.d.ts.map +1 -1
  7. package/dist/src/colors/linkColors.d.ts.map +1 -1
  8. package/dist/src/colors/nodeColors.d.ts.map +1 -1
  9. package/dist/src/config/graphLayout.d.ts +3 -2
  10. package/dist/src/config/graphLayout.d.ts.map +1 -1
  11. package/dist/src/graph/LayoutPipeline.d.ts.map +1 -1
  12. package/dist/src/graph/__tests__/optimizeWorker.test.d.ts +2 -0
  13. package/dist/src/graph/__tests__/optimizeWorker.test.d.ts.map +1 -0
  14. package/dist/src/graph/__tests__/spacingWorker.test.d.ts +2 -0
  15. package/dist/src/graph/__tests__/spacingWorker.test.d.ts.map +1 -0
  16. package/dist/src/graph/__tests__/useCommunities.test.d.ts +2 -0
  17. package/dist/src/graph/__tests__/useCommunities.test.d.ts.map +1 -0
  18. package/dist/src/graph/__tests__/useGraphFilters.test.d.ts +2 -0
  19. package/dist/src/graph/__tests__/useGraphFilters.test.d.ts.map +1 -0
  20. package/dist/src/graph/__tests__/useHighlights.test.d.ts +2 -0
  21. package/dist/src/graph/__tests__/useHighlights.test.d.ts.map +1 -0
  22. package/dist/src/graph/types.d.ts +2 -0
  23. package/dist/src/graph/types.d.ts.map +1 -1
  24. package/dist/src/graph/useGraphFilters.d.ts.map +1 -1
  25. package/dist/src/graph/useGraphInstance.d.ts.map +1 -1
  26. package/dist/src/graph/useGraphVisuals.d.ts.map +1 -1
  27. package/dist/src/index.d.ts +2 -1
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/sigma/zoomToNodes.d.ts +7 -2
  30. package/dist/src/sigma/zoomToNodes.d.ts.map +1 -1
  31. package/dist/{useHighlights-BHlafcBH.js → useHighlights-DbMfb0-p.js} +122 -74
  32. package/dist/useHighlights-DbMfb0-p.js.map +1 -0
  33. package/dist/{useHighlights-D6Jl6Woe.cjs → useHighlights-fRWg-A_c.cjs} +122 -74
  34. package/dist/useHighlights-fRWg-A_c.cjs.map +1 -0
  35. package/dist/utils.cjs +1 -1
  36. package/dist/utils.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/useHighlights-BHlafcBH.js.map +0 -1
  39. package/dist/useHighlights-D6Jl6Woe.cjs.map +0 -1
@@ -4614,37 +4614,38 @@ function requireIsGraph() {
4614
4614
  };
4615
4615
  return isGraph;
4616
4616
  }
4617
- const PALETTE$1 = [
4618
- "#6366f1",
4617
+ const PALETTE_SIZE$1 = 12;
4618
+ const FALLBACK_PALETTE$1 = [
4619
+ "#818cf8",
4619
4620
  // Indigo
4620
- "#f59e0b",
4621
+ "#fbbf24",
4621
4622
  // Amber
4622
- "#10b981",
4623
- // Emerald
4624
- "#8b5cf6",
4623
+ "#4ade80",
4624
+ // Green
4625
+ "#c084fc",
4625
4626
  // Violet
4626
- "#ef4444",
4627
- // Red
4628
- "#3b82f6",
4627
+ "#fb7185",
4628
+ // Rose
4629
+ "#60a5fa",
4629
4630
  // Blue
4630
- "#ec4899",
4631
+ "#f472b6",
4631
4632
  // Pink
4632
- "#14b8a6",
4633
+ "#2dd4bf",
4633
4634
  // Teal
4634
- "#f97316",
4635
+ "#fb923c",
4635
4636
  // Orange
4636
- "#84cc16",
4637
+ "#a3e635",
4637
4638
  // Lime
4638
- "#a855f7",
4639
- // Purple
4640
- "#06b6d4"
4639
+ "#e879f9",
4640
+ // Fuchsia
4641
+ "#22d3ee"
4641
4642
  // Cyan
4642
4643
  ];
4643
- const KNOWN$1 = {
4644
- Repository: "#10b981",
4645
- Class: "#3b82f6",
4646
- Function: "#a855f7",
4647
- File: "#84cc16",
4644
+ const FALLBACK_KNOWN$1 = {
4645
+ Repository: "#4ade80",
4646
+ Class: "#60a5fa",
4647
+ Function: "#c084fc",
4648
+ File: "#a3e635",
4648
4649
  Directory: "#22d3ee"
4649
4650
  };
4650
4651
  function djb2$1(str) {
@@ -4654,60 +4655,77 @@ function djb2$1(str) {
4654
4655
  }
4655
4656
  return Math.abs(h);
4656
4657
  }
4658
+ let cache$1 = null;
4659
+ function resolveColors$1() {
4660
+ if (typeof document === "undefined") {
4661
+ return {
4662
+ themeKey: "__fallback__",
4663
+ known: new Map(Object.entries(FALLBACK_KNOWN$1)),
4664
+ palette: FALLBACK_PALETTE$1
4665
+ };
4666
+ }
4667
+ const root = document.documentElement;
4668
+ const themeKey = `${root.dataset.theme ?? ""}_${root.dataset.mode ?? ""}`;
4669
+ if (cache$1 && cache$1.themeKey === themeKey) return cache$1;
4670
+ const style = getComputedStyle(root);
4671
+ const known = /* @__PURE__ */ new Map();
4672
+ for (const [type, fallback] of Object.entries(FALLBACK_KNOWN$1)) {
4673
+ const varName = `--graph-node-${type.toLowerCase()}`;
4674
+ const val = style.getPropertyValue(varName).trim();
4675
+ known.set(type, val || fallback);
4676
+ }
4677
+ const palette = [];
4678
+ for (let i = 0; i < PALETTE_SIZE$1; i++) {
4679
+ const val = style.getPropertyValue(`--graph-node-palette-${i}`).trim();
4680
+ palette.push(val || FALLBACK_PALETTE$1[i]);
4681
+ }
4682
+ cache$1 = { themeKey, known, palette };
4683
+ return cache$1;
4684
+ }
4657
4685
  function getNodeColor(type) {
4658
- return KNOWN$1[type] ?? PALETTE$1[djb2$1(type) % PALETTE$1.length];
4686
+ const { known, palette } = resolveColors$1();
4687
+ return known.get(type) ?? palette[djb2$1(type) % palette.length];
4659
4688
  }
4660
- const PALETTE = [
4661
- "#f472b6",
4689
+ const PALETTE_SIZE = 12;
4690
+ const FALLBACK_PALETTE = [
4691
+ "#f9a8d4",
4662
4692
  // Pink
4663
- "#60a5fa",
4693
+ "#93c5fd",
4664
4694
  // Blue
4665
- "#34d399",
4695
+ "#6ee7b7",
4666
4696
  // Emerald
4667
- "#fbbf24",
4697
+ "#fde68a",
4668
4698
  // Amber
4669
- "#a78bfa",
4699
+ "#c4b5fd",
4670
4700
  // Violet
4671
- "#fb923c",
4701
+ "#fdba74",
4672
4702
  // Orange
4673
- "#2dd4bf",
4703
+ "#5eead4",
4674
4704
  // Teal
4675
- "#f87171",
4705
+ "#fca5a5",
4676
4706
  // Red
4677
- "#38bdf8",
4707
+ "#7dd3fc",
4678
4708
  // Sky
4679
- "#a3e635",
4709
+ "#bef264",
4680
4710
  // Lime
4681
- "#c084fc",
4711
+ "#d8b4fe",
4682
4712
  // Purple
4683
- "#22d3ee"
4713
+ "#67e8f9"
4684
4714
  // Cyan
4685
4715
  ];
4686
- const KNOWN = {
4687
- CALLS: "#60a5fa",
4688
- // Blue invocation / dependency chains
4689
- READS: "#fbbf24",
4690
- // Amber data access
4691
- WRITES: "#fb923c",
4692
- // Orange data mutation
4693
- DEFINED_IN: "#34d399",
4694
- // Emerald containment / location
4695
- PART_OF: "#2dd4bf",
4696
- // Teal structural membership
4697
- DEPENDS_ON: "#f472b6",
4698
- // Pink dependency edges
4699
- EXTENDS: "#a78bfa",
4700
- // Violet — inheritance
4701
- HANDLES: "#38bdf8",
4702
- // Sky — endpoint handling
4703
- IMPORTS: "#c084fc",
4704
- // Purple — module imports
4705
- AUTHORED: "#f87171",
4706
- // Red — authorship
4707
- ASSIGNED: "#22d3ee",
4708
- // Cyan — assignment
4709
- PARTICIPATED: "#a3e635"
4710
- // Lime — participation
4716
+ const FALLBACK_KNOWN = {
4717
+ CALLS: { varSuffix: "calls", color: "#93c5fd" },
4718
+ READS: { varSuffix: "reads", color: "#fde68a" },
4719
+ WRITES: { varSuffix: "writes", color: "#fdba74" },
4720
+ DEFINED_IN: { varSuffix: "defined-in", color: "#6ee7b7" },
4721
+ PART_OF: { varSuffix: "part-of", color: "#5eead4" },
4722
+ DEPENDS_ON: { varSuffix: "depends-on", color: "#f9a8d4" },
4723
+ EXTENDS: { varSuffix: "extends", color: "#c4b5fd" },
4724
+ HANDLES: { varSuffix: "handles", color: "#7dd3fc" },
4725
+ IMPORTS: { varSuffix: "imports", color: "#d8b4fe" },
4726
+ AUTHORED: { varSuffix: "authored", color: "#fca5a5" },
4727
+ ASSIGNED: { varSuffix: "assigned", color: "#67e8f9" },
4728
+ PARTICIPATED: { varSuffix: "participated", color: "#bef264" }
4711
4729
  };
4712
4730
  function djb2(str) {
4713
4731
  let h = 5381;
@@ -4716,9 +4734,36 @@ function djb2(str) {
4716
4734
  }
4717
4735
  return Math.abs(h);
4718
4736
  }
4737
+ let cache = null;
4738
+ function resolveColors() {
4739
+ if (typeof document === "undefined") {
4740
+ const known2 = /* @__PURE__ */ new Map();
4741
+ for (const [key, { color }] of Object.entries(FALLBACK_KNOWN)) {
4742
+ known2.set(key, color);
4743
+ }
4744
+ return { themeKey: "__fallback__", known: known2, palette: FALLBACK_PALETTE };
4745
+ }
4746
+ const root = document.documentElement;
4747
+ const themeKey = `${root.dataset.theme ?? ""}_${root.dataset.mode ?? ""}`;
4748
+ if (cache && cache.themeKey === themeKey) return cache;
4749
+ const style = getComputedStyle(root);
4750
+ const known = /* @__PURE__ */ new Map();
4751
+ for (const [key, { varSuffix, color }] of Object.entries(FALLBACK_KNOWN)) {
4752
+ const val = style.getPropertyValue(`--graph-edge-${varSuffix}`).trim();
4753
+ known.set(key, val || color);
4754
+ }
4755
+ const palette = [];
4756
+ for (let i = 0; i < PALETTE_SIZE; i++) {
4757
+ const val = style.getPropertyValue(`--graph-edge-palette-${i}`).trim();
4758
+ palette.push(val || FALLBACK_PALETTE[i]);
4759
+ }
4760
+ cache = { themeKey, known, palette };
4761
+ return cache;
4762
+ }
4719
4763
  function getLinkColor(type) {
4720
4764
  const upper = type.toUpperCase();
4721
- return KNOWN[upper] ?? PALETTE[djb2(upper) % PALETTE.length];
4765
+ const { known, palette } = resolveColors();
4766
+ return known.get(upper) ?? palette[djb2(upper) % palette.length];
4722
4767
  }
4723
4768
  const COMMUNITY_PALETTE = [
4724
4769
  "#f472b6",
@@ -4936,19 +4981,22 @@ function useGraphFilters(graph, layoutReady, filterState, communityAssignments,
4936
4981
  attrs.hidden = hidden;
4937
4982
  return attrs;
4938
4983
  });
4939
- graph.updateEachEdgeAttributes((_id, attrs, source, target) => {
4940
- if (hiddenNodes.has(source) || hiddenNodes.has(target)) {
4941
- attrs.hidden = true;
4942
- return attrs;
4943
- }
4944
- const label = attrs.label;
4945
- if (label && filterState.hiddenLinkTypes.has(label)) {
4946
- attrs.hidden = true;
4984
+ graph.updateEachEdgeAttributes(
4985
+ (_id, attrs, source, target) => {
4986
+ if (hiddenNodes.has(source) || hiddenNodes.has(target)) {
4987
+ attrs.hidden = true;
4988
+ return attrs;
4989
+ }
4990
+ const label = attrs.label;
4991
+ if (label && filterState.hiddenLinkTypes.has(label)) {
4992
+ attrs.hidden = true;
4993
+ return attrs;
4994
+ }
4995
+ attrs.hidden = false;
4947
4996
  return attrs;
4948
- }
4949
- attrs.hidden = false;
4950
- return attrs;
4951
- });
4997
+ },
4998
+ { attributes: ["type"] }
4999
+ );
4952
5000
  }, [
4953
5001
  graph,
4954
5002
  layoutReady,
@@ -6688,4 +6736,4 @@ exports.shouldHideNode = shouldHideNode;
6688
6736
  exports.useCommunities = useCommunities;
6689
6737
  exports.useGraphFilters = useGraphFilters;
6690
6738
  exports.useHighlights = useHighlights;
6691
- //# sourceMappingURL=useHighlights-D6Jl6Woe.cjs.map
6739
+ //# sourceMappingURL=useHighlights-fRWg-A_c.cjs.map