@atolis-hq/corum 0.1.48 → 0.1.50
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/LICENSE +0 -9
- package/README.md +10 -0
- package/package.json +1 -1
- package/web/graph.jsx +25 -14
package/LICENSE
CHANGED
|
@@ -199,12 +199,3 @@
|
|
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
200
|
See the License for the specific language governing permissions and
|
|
201
201
|
limitations under the License.
|
|
202
|
-
|
|
203
|
-
## Issues & Feature Requests
|
|
204
|
-
|
|
205
|
-
Found a bug or have an idea for Corum? [Open an issue](https://github.com/atolis-hq/corum/issues/new) —
|
|
206
|
-
bug reports and feature requests are both welcome.
|
|
207
|
-
|
|
208
|
-
## License
|
|
209
|
-
|
|
210
|
-
Corum is licensed under the [Apache License 2.0](LICENSE).
|
package/README.md
CHANGED
|
@@ -481,3 +481,13 @@ The server also exposes a discoverable MCP prompt:
|
|
|
481
481
|
## Contributing
|
|
482
482
|
|
|
483
483
|
See [DEVELOPMENT.md](DEVELOPMENT.md) for build, test, and local development instructions.
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
## Issues & Feature Requests
|
|
487
|
+
|
|
488
|
+
Found a bug or have an idea for Corum? [Open an issue](https://github.com/atolis-hq/corum/issues/new) —
|
|
489
|
+
bug reports and feature requests are both welcome.
|
|
490
|
+
|
|
491
|
+
## License
|
|
492
|
+
|
|
493
|
+
Corum is licensed under the [Apache License 2.0](LICENSE).
|
package/package.json
CHANGED
package/web/graph.jsx
CHANGED
|
@@ -31,7 +31,7 @@ const EDGE_PILL_STYLES = {
|
|
|
31
31
|
'derived-from': { background: '#f3f4f6', color: '#6b7280' },
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const LEGACY_EDGE_TYPES = ['triggers', 'produces', 'reads', 'uses-type', 'calls', 'implements', 'maps-to', 'derived-from'];
|
|
35
35
|
const DEPTH_STEPS = [1, 2, 3, 4, 5, Infinity];
|
|
36
36
|
|
|
37
37
|
const NODE_W = 210;
|
|
@@ -39,16 +39,21 @@ const NODE_H = 100;
|
|
|
39
39
|
const COMP_W = 180;
|
|
40
40
|
const COMP_H = 72;
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function loadHiddenEdgeTypes() {
|
|
43
43
|
try {
|
|
44
44
|
const stored = localStorage.getItem('corum:graphEdgeTypes');
|
|
45
|
-
if (stored) return new Set(
|
|
45
|
+
if (!stored) return new Set();
|
|
46
|
+
const parsed = JSON.parse(stored);
|
|
47
|
+
if (Array.isArray(parsed)) {
|
|
48
|
+
return new Set(LEGACY_EDGE_TYPES.filter(type => !parsed.includes(type)));
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(parsed?.hiddenTypes)) return new Set(parsed.hiddenTypes);
|
|
46
51
|
} catch {}
|
|
47
|
-
return new Set(
|
|
52
|
+
return new Set();
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
function
|
|
51
|
-
try { localStorage.setItem('corum:graphEdgeTypes', JSON.stringify([...types])); } catch {}
|
|
55
|
+
function saveHiddenEdgeTypes(types) {
|
|
56
|
+
try { localStorage.setItem('corum:graphEdgeTypes', JSON.stringify({ version: 2, hiddenTypes: [...types].sort() })); } catch {}
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
function loadLayoutMode() {
|
|
@@ -505,7 +510,7 @@ function describeScope(scope, scopeOptions) {
|
|
|
505
510
|
return parts.join(' · ');
|
|
506
511
|
}
|
|
507
512
|
|
|
508
|
-
function GraphToolbar({ visibleEdgeTypes, onToggleEdgeType, showMinimap, onToggleMinimap, onResetLayout, level, depth, onDepth, allNodes, focalNodeId, onFocalNode, layoutMode, onLayoutMode, scope, onScope, scopeOptions, scopeInfo }) {
|
|
513
|
+
function GraphToolbar({ edgeTypes, visibleEdgeTypes, onToggleEdgeType, showMinimap, onToggleMinimap, onResetLayout, level, depth, onDepth, allNodes, focalNodeId, onFocalNode, layoutMode, onLayoutMode, scope, onScope, scopeOptions, scopeInfo }) {
|
|
509
514
|
const [searchQuery, setSearchQuery] = useState('');
|
|
510
515
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
511
516
|
const [scopeOpen, setScopeOpen] = useState(false);
|
|
@@ -540,9 +545,9 @@ function GraphToolbar({ visibleEdgeTypes, onToggleEdgeType, showMinimap, onToggl
|
|
|
540
545
|
|
|
541
546
|
return (
|
|
542
547
|
<div className="graph-toolbar">
|
|
543
|
-
{
|
|
548
|
+
{edgeTypes.map(type => {
|
|
544
549
|
const active = visibleEdgeTypes.has(type);
|
|
545
|
-
const pill = EDGE_PILL_STYLES[type] || {};
|
|
550
|
+
const pill = EDGE_PILL_STYLES[type] || { background: '#f3f4f6', color: '#6b7280' };
|
|
546
551
|
return (
|
|
547
552
|
<span
|
|
548
553
|
key={type}
|
|
@@ -645,7 +650,7 @@ function GraphToolbar({ visibleEdgeTypes, onToggleEdgeType, showMinimap, onToggl
|
|
|
645
650
|
function GraphView({ route, viewingRef, templates }) {
|
|
646
651
|
const [graphData, setGraphData] = useState(null);
|
|
647
652
|
const [error, setError] = useState(null);
|
|
648
|
-
const [
|
|
653
|
+
const [hiddenEdgeTypes, setHiddenEdgeTypes] = useState(loadHiddenEdgeTypes);
|
|
649
654
|
const [showMinimap, setShowMinimap] = useState(false);
|
|
650
655
|
const [depth, setDepth] = useState(2);
|
|
651
656
|
const [layoutKey, setLayoutKey] = useState(0);
|
|
@@ -712,6 +717,11 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
712
717
|
}, [focalNodeId, depth, viewingRef]);
|
|
713
718
|
|
|
714
719
|
const templateMap = useMemo(() => new Map((templates ?? []).map(t => [t.name, t])), [templates]);
|
|
720
|
+
const availableEdgeTypes = useMemo(() => [...new Set((graphData?.edges ?? []).map(edge => edge.type))].sort(), [graphData]);
|
|
721
|
+
const visibleEdgeTypes = useMemo(
|
|
722
|
+
() => new Set(availableEdgeTypes.filter(type => !hiddenEdgeTypes.has(type))),
|
|
723
|
+
[availableEdgeTypes, hiddenEdgeTypes],
|
|
724
|
+
);
|
|
715
725
|
|
|
716
726
|
const templateColour = useCallback(templateName => {
|
|
717
727
|
return templateMap.get(templateName)?.ui?.colour ?? 'var(--ink-4)';
|
|
@@ -776,7 +786,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
776
786
|
parentCounts.set(n.parentId, (parentCounts.get(n.parentId) ?? 0) + 1);
|
|
777
787
|
}
|
|
778
788
|
const scopeOptions = {
|
|
779
|
-
edgeTypes:
|
|
789
|
+
edgeTypes: availableEdgeTypes.filter(t => visibleEdgeTypes.has(t) && typedEdges.some(e => e.type === t)),
|
|
780
790
|
templates: [...new Set(allVisibleNodes.map(n => n.template))].sort()
|
|
781
791
|
.map(name => ({ name, label: templateMap.get(name)?.ui?.displayName ?? name })),
|
|
782
792
|
owners: [...parentCounts.entries()].filter(([, c]) => c >= 2).map(([pid]) => pid).sort()
|
|
@@ -812,7 +822,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
812
822
|
return isCross ? { ...e, style: { ...e.style, opacity: 0.45 }, labelStyle: { ...e.labelStyle, opacity: 0.45 } } : e;
|
|
813
823
|
});
|
|
814
824
|
return { rfN, rfE, scopeOptions, scopeInfo };
|
|
815
|
-
}, [graphData, selectedComponent, visibleEdgeTypes, templateMap, layoutKey, navToFocus, scope]);
|
|
825
|
+
}, [graphData, selectedComponent, availableEdgeTypes, visibleEdgeTypes, templateMap, layoutKey, navToFocus, scope]);
|
|
816
826
|
|
|
817
827
|
useEffect(() => {
|
|
818
828
|
if (level !== 'interior' || !level2) return;
|
|
@@ -903,10 +913,10 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
903
913
|
}, [setRfNodes]);
|
|
904
914
|
|
|
905
915
|
function handleToggleEdgeType(type) {
|
|
906
|
-
|
|
916
|
+
setHiddenEdgeTypes(prev => {
|
|
907
917
|
const next = new Set(prev);
|
|
908
918
|
next.has(type) ? next.delete(type) : next.add(type);
|
|
909
|
-
|
|
919
|
+
saveHiddenEdgeTypes(next);
|
|
910
920
|
return next;
|
|
911
921
|
});
|
|
912
922
|
}
|
|
@@ -924,6 +934,7 @@ function GraphView({ route, viewingRef, templates }) {
|
|
|
924
934
|
onNavigateToComponent={navToComponent}
|
|
925
935
|
/>
|
|
926
936
|
<GraphToolbar
|
|
937
|
+
edgeTypes={availableEdgeTypes}
|
|
927
938
|
visibleEdgeTypes={visibleEdgeTypes}
|
|
928
939
|
onToggleEdgeType={handleToggleEdgeType}
|
|
929
940
|
showMinimap={showMinimap}
|