@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.
- package/dist/opentrace-components.cjs +159 -47
- package/dist/opentrace-components.cjs.map +1 -1
- package/dist/opentrace-components.js +160 -48
- package/dist/opentrace-components.js.map +1 -1
- package/dist/src/GraphCanvas.d.ts +22 -1
- package/dist/src/GraphCanvas.d.ts.map +1 -1
- package/dist/src/colors/linkColors.d.ts.map +1 -1
- package/dist/src/colors/nodeColors.d.ts.map +1 -1
- package/dist/src/config/graphLayout.d.ts +3 -2
- package/dist/src/config/graphLayout.d.ts.map +1 -1
- package/dist/src/graph/LayoutPipeline.d.ts.map +1 -1
- package/dist/src/graph/__tests__/optimizeWorker.test.d.ts +2 -0
- package/dist/src/graph/__tests__/optimizeWorker.test.d.ts.map +1 -0
- package/dist/src/graph/__tests__/spacingWorker.test.d.ts +2 -0
- package/dist/src/graph/__tests__/spacingWorker.test.d.ts.map +1 -0
- package/dist/src/graph/__tests__/useCommunities.test.d.ts +2 -0
- package/dist/src/graph/__tests__/useCommunities.test.d.ts.map +1 -0
- package/dist/src/graph/__tests__/useGraphFilters.test.d.ts +2 -0
- package/dist/src/graph/__tests__/useGraphFilters.test.d.ts.map +1 -0
- package/dist/src/graph/__tests__/useHighlights.test.d.ts +2 -0
- package/dist/src/graph/__tests__/useHighlights.test.d.ts.map +1 -0
- package/dist/src/graph/types.d.ts +2 -0
- package/dist/src/graph/types.d.ts.map +1 -1
- package/dist/src/graph/useGraphFilters.d.ts.map +1 -1
- package/dist/src/graph/useGraphInstance.d.ts.map +1 -1
- package/dist/src/graph/useGraphVisuals.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/sigma/zoomToNodes.d.ts +7 -2
- package/dist/src/sigma/zoomToNodes.d.ts.map +1 -1
- package/dist/{useHighlights-BHlafcBH.js → useHighlights-DbMfb0-p.js} +122 -74
- package/dist/useHighlights-DbMfb0-p.js.map +1 -0
- package/dist/{useHighlights-D6Jl6Woe.cjs → useHighlights-fRWg-A_c.cjs} +122 -74
- package/dist/useHighlights-fRWg-A_c.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/useHighlights-BHlafcBH.js.map +0 -1
- package/dist/useHighlights-D6Jl6Woe.cjs.map +0 -1
|
@@ -4614,37 +4614,38 @@ function requireIsGraph() {
|
|
|
4614
4614
|
};
|
|
4615
4615
|
return isGraph;
|
|
4616
4616
|
}
|
|
4617
|
-
const
|
|
4618
|
-
|
|
4617
|
+
const PALETTE_SIZE$1 = 12;
|
|
4618
|
+
const FALLBACK_PALETTE$1 = [
|
|
4619
|
+
"#818cf8",
|
|
4619
4620
|
// Indigo
|
|
4620
|
-
"#
|
|
4621
|
+
"#fbbf24",
|
|
4621
4622
|
// Amber
|
|
4622
|
-
"#
|
|
4623
|
-
//
|
|
4624
|
-
"#
|
|
4623
|
+
"#4ade80",
|
|
4624
|
+
// Green
|
|
4625
|
+
"#c084fc",
|
|
4625
4626
|
// Violet
|
|
4626
|
-
"#
|
|
4627
|
-
//
|
|
4628
|
-
"#
|
|
4627
|
+
"#fb7185",
|
|
4628
|
+
// Rose
|
|
4629
|
+
"#60a5fa",
|
|
4629
4630
|
// Blue
|
|
4630
|
-
"#
|
|
4631
|
+
"#f472b6",
|
|
4631
4632
|
// Pink
|
|
4632
|
-
"#
|
|
4633
|
+
"#2dd4bf",
|
|
4633
4634
|
// Teal
|
|
4634
|
-
"#
|
|
4635
|
+
"#fb923c",
|
|
4635
4636
|
// Orange
|
|
4636
|
-
"#
|
|
4637
|
+
"#a3e635",
|
|
4637
4638
|
// Lime
|
|
4638
|
-
"#
|
|
4639
|
-
//
|
|
4640
|
-
"#
|
|
4639
|
+
"#e879f9",
|
|
4640
|
+
// Fuchsia
|
|
4641
|
+
"#22d3ee"
|
|
4641
4642
|
// Cyan
|
|
4642
4643
|
];
|
|
4643
|
-
const
|
|
4644
|
-
Repository: "#
|
|
4645
|
-
Class: "#
|
|
4646
|
-
Function: "#
|
|
4647
|
-
File: "#
|
|
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
|
-
|
|
4686
|
+
const { known, palette } = resolveColors$1();
|
|
4687
|
+
return known.get(type) ?? palette[djb2$1(type) % palette.length];
|
|
4659
4688
|
}
|
|
4660
|
-
const
|
|
4661
|
-
|
|
4689
|
+
const PALETTE_SIZE = 12;
|
|
4690
|
+
const FALLBACK_PALETTE = [
|
|
4691
|
+
"#f9a8d4",
|
|
4662
4692
|
// Pink
|
|
4663
|
-
"#
|
|
4693
|
+
"#93c5fd",
|
|
4664
4694
|
// Blue
|
|
4665
|
-
"#
|
|
4695
|
+
"#6ee7b7",
|
|
4666
4696
|
// Emerald
|
|
4667
|
-
"#
|
|
4697
|
+
"#fde68a",
|
|
4668
4698
|
// Amber
|
|
4669
|
-
"#
|
|
4699
|
+
"#c4b5fd",
|
|
4670
4700
|
// Violet
|
|
4671
|
-
"#
|
|
4701
|
+
"#fdba74",
|
|
4672
4702
|
// Orange
|
|
4673
|
-
"#
|
|
4703
|
+
"#5eead4",
|
|
4674
4704
|
// Teal
|
|
4675
|
-
"#
|
|
4705
|
+
"#fca5a5",
|
|
4676
4706
|
// Red
|
|
4677
|
-
"#
|
|
4707
|
+
"#7dd3fc",
|
|
4678
4708
|
// Sky
|
|
4679
|
-
"#
|
|
4709
|
+
"#bef264",
|
|
4680
4710
|
// Lime
|
|
4681
|
-
"#
|
|
4711
|
+
"#d8b4fe",
|
|
4682
4712
|
// Purple
|
|
4683
|
-
"#
|
|
4713
|
+
"#67e8f9"
|
|
4684
4714
|
// Cyan
|
|
4685
4715
|
];
|
|
4686
|
-
const
|
|
4687
|
-
CALLS: "#
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
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
|
-
|
|
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(
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
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
|
-
|
|
4950
|
-
|
|
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-
|
|
6739
|
+
//# sourceMappingURL=useHighlights-fRWg-A_c.cjs.map
|