@ltm-blueverse/alpha-semantic-hub 0.7.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.
- package/LICENSE +21 -0
- package/README.md +1674 -0
- package/explorer/README.md +282 -0
- package/explorer/src/App.css +0 -0
- package/explorer/src/App.tsx +2035 -0
- package/explorer/src/ErrorBoundary.tsx +112 -0
- package/explorer/src/ExploreWorkspaceTabs.tsx +29 -0
- package/explorer/src/assets/hero.png +0 -0
- package/explorer/src/assets/react.svg +1 -0
- package/explorer/src/assets/vite.svg +1 -0
- package/explorer/src/explorerCapabilities.ts +24 -0
- package/explorer/src/index.css +71 -0
- package/explorer/src/main.tsx +7 -0
- package/explorer/src/store/edgePairKeys.d.ts +2 -0
- package/explorer/src/store/edgePairKeys.js +7 -0
- package/explorer/src/store/graphStore.ts +183 -0
- package/explorer/src/store/registryStore.ts +78 -0
- package/explorer/src/types.d.ts +16 -0
- package/explorer/src/ui/primitives.css +414 -0
- package/explorer/src/ui/primitives.tsx +170 -0
- package/explorer/src/workspaces/DecisionWorkspace/DecisionWorkspace.tsx +279 -0
- package/explorer/src/workspaces/DiffMergeWorkspace/DiffMergeWorkspace.tsx +121 -0
- package/explorer/src/workspaces/EnrichWorkspace/EntityResolutionTab.tsx +454 -0
- package/explorer/src/workspaces/EnrichWorkspace/RegistryTab.tsx +285 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphCanvas.tsx +2673 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphInspectorPanel.tsx +771 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx +410 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx +3584 -0
- package/explorer/src/workspaces/GraphWorkspace/MarkdownContentViewer.tsx +705 -0
- package/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx +55 -0
- package/explorer/src/workspaces/GraphWorkspace/TimelinePanel.tsx +193 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/clickSelectionBehavior.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/fitViewBehavior.ts +15 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts +25 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/hoverActivationBehavior.ts +15 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/pathHighlightBehavior.ts +52 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts +36 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts +41 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/graphAnalytics.ts +779 -0
- package/explorer/src/workspaces/GraphWorkspace/graphColorLegend.ts +36 -0
- package/explorer/src/workspaces/GraphWorkspace/graphConfig.ts +102 -0
- package/explorer/src/workspaces/GraphWorkspace/graphEntityShape.ts +34 -0
- package/explorer/src/workspaces/GraphWorkspace/graphLoading.ts +84 -0
- package/explorer/src/workspaces/GraphWorkspace/graphSceneLayers.ts +775 -0
- package/explorer/src/workspaces/GraphWorkspace/graphSceneState.ts +2753 -0
- package/explorer/src/workspaces/GraphWorkspace/graphStructureLayer.ts +335 -0
- package/explorer/src/workspaces/GraphWorkspace/graphTheme.ts +1078 -0
- package/explorer/src/workspaces/GraphWorkspace/graphViewCopy.ts +41 -0
- package/explorer/src/workspaces/GraphWorkspace/localGraphTransition.ts +9 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownEditorState.ts +114 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownResourceClient.ts +103 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownUrlSafety.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/nodeMarkdownSync.ts +81 -0
- package/explorer/src/workspaces/GraphWorkspace/pluginRegistryPredicates.ts +24 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPlugin.tsx +353 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPluginPhaseC.tsx +522 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/index.ts +16 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/legendPlugin.tsx +120 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/neighborhoodPanelPlugin.tsx +231 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx +142 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/types.ts +106 -0
- package/explorer/src/workspaces/GraphWorkspace/realtimeGraphAttributes.ts +50 -0
- package/explorer/src/workspaces/GraphWorkspace/scene.ts +79 -0
- package/explorer/src/workspaces/GraphWorkspace/sigmaNativeRendering.ts +421 -0
- package/explorer/src/workspaces/GraphWorkspace/smallGraphLayout.ts +135 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalLifecyclePredicates.ts +31 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalScrubberBounds.ts +46 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalSnapshotGuards.ts +113 -0
- package/explorer/src/workspaces/GraphWorkspace/types.ts +395 -0
- package/explorer/src/workspaces/GraphWorkspace/useLoadGraph.ts +746 -0
- package/explorer/src/workspaces/GraphWorkspace/useMarkdownEditor.ts +177 -0
- package/explorer/src/workspaces/ImportExportWorkspace/ImportExportWorkspace.tsx +196 -0
- package/explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsx +177 -0
- package/explorer/src/workspaces/ManageWorkspace/KGOverviewTab.tsx +291 -0
- package/explorer/src/workspaces/ManageWorkspace/OntologySummaryTab.tsx +346 -0
- package/explorer/src/workspaces/MemoryWorkspace.tsx +464 -0
- package/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx +437 -0
- package/explorer/src/workspaces/OntologyWorkspace/HealthTab.tsx +214 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyEditor.tsx +770 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyLoader.tsx +913 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx +930 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsx +590 -0
- package/explorer/src/workspaces/OntologyWorkspace/ProposalReview.tsx +429 -0
- package/explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsx +696 -0
- package/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx +363 -0
- package/explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsx +546 -0
- package/explorer/src/workspaces/OntologyWorkspace/api.ts +164 -0
- package/explorer/src/workspaces/OntologyWorkspace/index.tsx +101 -0
- package/explorer/src/workspaces/OntologyWorkspace/ontologyEditorModel.ts +87 -0
- package/explorer/src/workspaces/OntologyWorkspace/ontologyUrlState.ts +94 -0
- package/explorer/src/workspaces/OntologyWorkspace/types.ts +119 -0
- package/explorer/src/workspaces/ReasoningWorkspace.tsx +243 -0
- package/explorer/src/workspaces/SparqlWorkspace/SparqlWorkspace.tsx +271 -0
- package/explorer/src/workspaces/VocabularyWorkspace/ConceptTree.tsx +97 -0
- package/explorer/src/workspaces/VocabularyWorkspace/ImportDropzone.tsx +95 -0
- package/explorer/src/workspaces/VocabularyWorkspace/PropertyPanel.tsx +116 -0
- package/explorer/src/workspaces/VocabularyWorkspace/Sidebar.tsx +112 -0
- package/explorer/src/workspaces/VocabularyWorkspace/VocabularyWorkspace.tsx +70 -0
- package/explorer/src/workspaces/VocabularyWorkspace/queries.ts +52 -0
- package/explorer/src/workspaces/VocabularyWorkspace/types.ts +24 -0
- package/package.json +31 -0
- package/plugins/.claude-plugin/README.md +262 -0
- package/plugins/.claude-plugin/marketplace.json +20 -0
- package/plugins/.claude-plugin/plugin.json +33 -0
- package/plugins/.cline-plugin/README.md +32 -0
- package/plugins/.cline-plugin/marketplace.json +17 -0
- package/plugins/.cline-plugin/plugin.json +35 -0
- package/plugins/.codex-plugin/marketplace.json +21 -0
- package/plugins/.codex-plugin/plugin.json +35 -0
- package/plugins/.continue-plugin/README.md +34 -0
- package/plugins/.continue-plugin/marketplace.json +17 -0
- package/plugins/.continue-plugin/plugin.json +33 -0
- package/plugins/.cursor-plugin/marketplace.json +18 -0
- package/plugins/.cursor-plugin/plugin.json +32 -0
- package/plugins/.openclaw-plugin/README.md +62 -0
- package/plugins/.openclaw-plugin/marketplace.json +18 -0
- package/plugins/.openclaw-plugin/plugin.json +46 -0
- package/plugins/.pi-plugin/README.md +35 -0
- package/plugins/.vscode-plugin/README.md +48 -0
- package/plugins/.vscode-plugin/marketplace.json +17 -0
- package/plugins/.vscode-plugin/plugin.json +35 -0
- package/plugins/.windsurf-plugin/README.md +39 -0
- package/plugins/.windsurf-plugin/marketplace.json +17 -0
- package/plugins/.windsurf-plugin/plugin.json +35 -0
- package/plugins/agents/decision-advisor.md +126 -0
- package/plugins/agents/explainability.md +129 -0
- package/plugins/agents/kg-assistant.md +73 -0
- package/plugins/hooks/hooks.json +12 -0
- package/plugins/skills/causal/SKILL.md +74 -0
- package/plugins/skills/change/SKILL.md +80 -0
- package/plugins/skills/decision/SKILL.md +197 -0
- package/plugins/skills/deduplicate/SKILL.md +41 -0
- package/plugins/skills/embed/SKILL.md +230 -0
- package/plugins/skills/explain/SKILL.md +44 -0
- package/plugins/skills/export/SKILL.md +67 -0
- package/plugins/skills/extract/SKILL.md +93 -0
- package/plugins/skills/ingest/SKILL.md +38 -0
- package/plugins/skills/ontology/SKILL.md +89 -0
- package/plugins/skills/policy/SKILL.md +66 -0
- package/plugins/skills/provenance/SKILL.md +70 -0
- package/plugins/skills/query/SKILL.md +84 -0
- package/plugins/skills/reason/SKILL.md +201 -0
- package/plugins/skills/temporal/SKILL.md +164 -0
- package/plugins/skills/validate/SKILL.md +228 -0
- package/plugins/skills/visualize/SKILL.md +249 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { GraphCanvas, type GraphCanvasHandle } from "./GraphCanvas";
|
|
4
|
+
import type { GraphSceneAdapter, GraphSceneHandle, GraphSceneProps, GraphSceneRuntime } from "./scene";
|
|
5
|
+
|
|
6
|
+
export const SigmaSceneAdapter = forwardRef<GraphSceneHandle, GraphSceneProps>(
|
|
7
|
+
function SigmaSceneAdapter(
|
|
8
|
+
{
|
|
9
|
+
onNodeSelect,
|
|
10
|
+
onEdgeSelect,
|
|
11
|
+
onInteractionStateChange,
|
|
12
|
+
onCameraStateChange,
|
|
13
|
+
onDiagnosticsChange,
|
|
14
|
+
onAnalyticsChange,
|
|
15
|
+
onRuntimeChange,
|
|
16
|
+
onLayoutRunningChange,
|
|
17
|
+
...sceneProps
|
|
18
|
+
},
|
|
19
|
+
ref,
|
|
20
|
+
) {
|
|
21
|
+
const canvasRef = useRef<GraphCanvasHandle>(null);
|
|
22
|
+
const runtimeRef = useRef<GraphSceneRuntime | null>(null);
|
|
23
|
+
|
|
24
|
+
useImperativeHandle(ref, () => ({
|
|
25
|
+
fitView: () => canvasRef.current?.fitView(),
|
|
26
|
+
focusNode: (nodeId: string) => canvasRef.current?.focusNode(nodeId),
|
|
27
|
+
zoomIn: () => canvasRef.current?.zoomIn(),
|
|
28
|
+
zoomOut: () => canvasRef.current?.zoomOut(),
|
|
29
|
+
getRuntime: () => runtimeRef.current,
|
|
30
|
+
setLayoutRunning: onLayoutRunningChange
|
|
31
|
+
? (running: boolean) => {
|
|
32
|
+
onLayoutRunningChange(running);
|
|
33
|
+
}
|
|
34
|
+
: undefined,
|
|
35
|
+
}), [onLayoutRunningChange]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<GraphCanvas
|
|
39
|
+
ref={canvasRef}
|
|
40
|
+
onNodeClick={onNodeSelect ?? (() => {})}
|
|
41
|
+
onEdgeClick={onEdgeSelect}
|
|
42
|
+
onInteractionStateChange={onInteractionStateChange}
|
|
43
|
+
onCameraStateChange={onCameraStateChange}
|
|
44
|
+
onDiagnosticsChange={onDiagnosticsChange}
|
|
45
|
+
onAnalyticsChange={onAnalyticsChange}
|
|
46
|
+
onSceneRuntimeChange={(runtime) => {
|
|
47
|
+
runtimeRef.current = runtime;
|
|
48
|
+
onRuntimeChange?.(runtime);
|
|
49
|
+
}}
|
|
50
|
+
onLayoutRunningChange={onLayoutRunningChange}
|
|
51
|
+
{...sceneProps}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
) as GraphSceneAdapter;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, useCallback, useMemo } from "react";
|
|
2
|
+
import { DataSet } from "vis-data";
|
|
3
|
+
import { Timeline } from "vis-timeline";
|
|
4
|
+
import type { TimelineOptions } from "vis-timeline";
|
|
5
|
+
import "vis-timeline/styles/vis-timeline-graph2d.css";
|
|
6
|
+
import { GRAPH_THEME } from "./graphTheme";
|
|
7
|
+
import { DEFAULT_MIN_DATE, resolvePlayStepMs, resolveScrubberBounds } from "./temporalScrubberBounds";
|
|
8
|
+
|
|
9
|
+
export interface TimelinePanelProps {
|
|
10
|
+
onTimeChange: (time: Date) => void;
|
|
11
|
+
minDate?: string;
|
|
12
|
+
maxDate?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const PLAYHEAD_ID = "playhead";
|
|
16
|
+
const PLAY_INTERVAL_MS = 500;
|
|
17
|
+
const ONE_DAY_MS = 1000 * 60 * 60 * 24;
|
|
18
|
+
|
|
19
|
+
const VIS_OVERRIDE_CSS = `
|
|
20
|
+
.sem-timeline-wrap .vis-timeline { border: none !important; background: transparent !important; overflow: visible !important; }
|
|
21
|
+
.sem-timeline-wrap .vis-panel.vis-background, .sem-timeline-wrap .vis-panel.vis-center { background: transparent !important; }
|
|
22
|
+
.sem-timeline-wrap .vis-panel { border-color: ${GRAPH_THEME.ui.timeline.border} !important; }
|
|
23
|
+
.sem-timeline-wrap .vis-time-axis .vis-text {
|
|
24
|
+
color: ${GRAPH_THEME.ui.timeline.text} !important;
|
|
25
|
+
font-size: 11px !important;
|
|
26
|
+
font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
|
|
27
|
+
padding-top: 3px !important;
|
|
28
|
+
}
|
|
29
|
+
.sem-timeline-wrap .vis-time-axis .vis-text.vis-major {
|
|
30
|
+
color: ${GRAPH_THEME.ui.timeline.textStrong} !important;
|
|
31
|
+
font-weight: 700 !important;
|
|
32
|
+
font-size: 12px !important;
|
|
33
|
+
}
|
|
34
|
+
.sem-timeline-wrap .vis-time-axis .vis-grid.vis-minor { border-color: ${GRAPH_THEME.ui.timeline.gridMinor} !important; }
|
|
35
|
+
.sem-timeline-wrap .vis-time-axis .vis-grid.vis-major { border-color: ${GRAPH_THEME.ui.timeline.gridMajor} !important; }
|
|
36
|
+
.sem-timeline-wrap .vis-custom-time.${PLAYHEAD_ID} {
|
|
37
|
+
background: ${GRAPH_THEME.ui.timeline.playheadSoft} !important;
|
|
38
|
+
width: 2px !important;
|
|
39
|
+
cursor: ew-resize !important;
|
|
40
|
+
z-index: 5 !important;
|
|
41
|
+
}
|
|
42
|
+
.sem-timeline-wrap .vis-custom-time.${PLAYHEAD_ID} > .vis-custom-time-marker {
|
|
43
|
+
background: ${GRAPH_THEME.ui.timeline.playhead} !important;
|
|
44
|
+
color: ${GRAPH_THEME.ui.text.inverse} !important;
|
|
45
|
+
font-size: 10px !important;
|
|
46
|
+
font-weight: 700 !important;
|
|
47
|
+
border-radius: 3px !important;
|
|
48
|
+
padding: 1px 5px !important;
|
|
49
|
+
white-space: nowrap !important;
|
|
50
|
+
box-shadow: 0 0 8px rgba(98, 226, 205, 0.45) !important;
|
|
51
|
+
}
|
|
52
|
+
.sem-timeline-wrap .vis-current-time { display: none !important; }
|
|
53
|
+
.sem-timeline-wrap .vis-panel.vis-left { display: none !important; }
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
function formatPlayheadLabel(value: Date): string {
|
|
57
|
+
return `${value.getFullYear()}/${String(value.getMonth() + 1).padStart(2, "0")}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function TimelinePanel({ onTimeChange, minDate, maxDate }: TimelinePanelProps) {
|
|
61
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
62
|
+
const timelineRef = useRef<Timeline | null>(null);
|
|
63
|
+
const playheadRef = useRef<Date>(DEFAULT_MIN_DATE);
|
|
64
|
+
const playIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
65
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
66
|
+
const [displayDate, setDisplayDate] = useState(formatPlayheadLabel(DEFAULT_MIN_DATE));
|
|
67
|
+
|
|
68
|
+
// Captured once per mount so re-renders keep the same reference and do not
|
|
69
|
+
// retrigger the timeline effect below.
|
|
70
|
+
const now = useMemo(() => new Date(), []);
|
|
71
|
+
const { minBound, maxBound, defaultTime } = useMemo(
|
|
72
|
+
() => resolveScrubberBounds({ minDate, maxDate, now }),
|
|
73
|
+
[maxDate, minDate, now],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!containerRef.current) return;
|
|
78
|
+
|
|
79
|
+
const timeline = timelineRef.current;
|
|
80
|
+
if (!timeline) {
|
|
81
|
+
const items = new DataSet([]);
|
|
82
|
+
const options: TimelineOptions = {
|
|
83
|
+
height: "100%",
|
|
84
|
+
min: minBound,
|
|
85
|
+
max: maxBound,
|
|
86
|
+
start: minBound,
|
|
87
|
+
end: maxBound,
|
|
88
|
+
showCurrentTime: false,
|
|
89
|
+
zoomable: true,
|
|
90
|
+
moveable: true,
|
|
91
|
+
zoomMin: ONE_DAY_MS,
|
|
92
|
+
zoomMax: 1000 * 60 * 60 * 24 * 365 * 80,
|
|
93
|
+
showMajorLabels: true,
|
|
94
|
+
showMinorLabels: true,
|
|
95
|
+
orientation: { axis: "bottom" },
|
|
96
|
+
margin: { item: 0, axis: 0 },
|
|
97
|
+
selectable: false,
|
|
98
|
+
stack: false,
|
|
99
|
+
} as TimelineOptions;
|
|
100
|
+
|
|
101
|
+
const nextTimeline = new Timeline(containerRef.current, items, options);
|
|
102
|
+
timelineRef.current = nextTimeline;
|
|
103
|
+
playheadRef.current = defaultTime;
|
|
104
|
+
nextTimeline.addCustomTime(defaultTime, PLAYHEAD_ID);
|
|
105
|
+
nextTimeline.on("timechange", (props: { id: string; time: Date }) => {
|
|
106
|
+
if (props.id !== PLAYHEAD_ID) return;
|
|
107
|
+
playheadRef.current = props.time;
|
|
108
|
+
nextTimeline.setCustomTime(props.time, PLAYHEAD_ID);
|
|
109
|
+
onTimeChange(props.time);
|
|
110
|
+
setDisplayDate(formatPlayheadLabel(props.time));
|
|
111
|
+
});
|
|
112
|
+
onTimeChange(defaultTime);
|
|
113
|
+
setDisplayDate(formatPlayheadLabel(defaultTime));
|
|
114
|
+
return () => {
|
|
115
|
+
nextTimeline.destroy();
|
|
116
|
+
timelineRef.current = null;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
timeline.setOptions({ min: minBound, max: maxBound, start: minBound, end: maxBound });
|
|
121
|
+
playheadRef.current = defaultTime;
|
|
122
|
+
timeline.setCustomTime(defaultTime, PLAYHEAD_ID);
|
|
123
|
+
onTimeChange(defaultTime);
|
|
124
|
+
setDisplayDate(formatPlayheadLabel(defaultTime));
|
|
125
|
+
}, [defaultTime, maxBound, minBound, onTimeChange]);
|
|
126
|
+
|
|
127
|
+
const startPlay = useCallback(() => {
|
|
128
|
+
if (playIntervalRef.current) return;
|
|
129
|
+
playIntervalRef.current = setInterval(() => {
|
|
130
|
+
const timeline = timelineRef.current;
|
|
131
|
+
if (!timeline) return;
|
|
132
|
+
const next = new Date(playheadRef.current.getTime() + resolvePlayStepMs(minBound, maxBound));
|
|
133
|
+
if (next >= maxBound) {
|
|
134
|
+
next.setTime(minBound.getTime());
|
|
135
|
+
}
|
|
136
|
+
playheadRef.current = next;
|
|
137
|
+
timeline.setCustomTime(next, PLAYHEAD_ID);
|
|
138
|
+
onTimeChange(next);
|
|
139
|
+
setDisplayDate(formatPlayheadLabel(next));
|
|
140
|
+
}, PLAY_INTERVAL_MS);
|
|
141
|
+
}, [maxBound, minBound, onTimeChange]);
|
|
142
|
+
|
|
143
|
+
const stopPlay = useCallback(() => {
|
|
144
|
+
if (playIntervalRef.current) {
|
|
145
|
+
clearInterval(playIntervalRef.current);
|
|
146
|
+
playIntervalRef.current = null;
|
|
147
|
+
}
|
|
148
|
+
}, []);
|
|
149
|
+
|
|
150
|
+
const togglePlay = useCallback(() => {
|
|
151
|
+
setIsPlaying((previous) => {
|
|
152
|
+
if (previous) {
|
|
153
|
+
stopPlay();
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
startPlay();
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
}, [startPlay, stopPlay]);
|
|
160
|
+
|
|
161
|
+
useEffect(() => () => stopPlay(), [stopPlay]);
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<div style={{ position: "relative", width: "100%", height: "90px", borderTop: `1px solid ${GRAPH_THEME.ui.timeline.border}`, background: GRAPH_THEME.ui.timeline.background, backdropFilter: "blur(16px)", WebkitBackdropFilter: "blur(16px)", display: "flex", alignItems: "stretch", flexShrink: 0 }}>
|
|
165
|
+
<style>{VIS_OVERRIDE_CSS}</style>
|
|
166
|
+
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 4, padding: "0 16px", borderRight: `1px solid ${GRAPH_THEME.ui.timeline.border}`, minWidth: 80, flexShrink: 0 }}>
|
|
167
|
+
<button
|
|
168
|
+
id="temporal-play-btn"
|
|
169
|
+
onClick={togglePlay}
|
|
170
|
+
title={isPlaying ? "Pause Evolution" : "Play Evolution"}
|
|
171
|
+
style={{ width: 34, height: 34, borderRadius: "50%", border: `1.5px solid ${isPlaying ? GRAPH_THEME.ui.control.activeBorder : GRAPH_THEME.ui.control.defaultBorder}`, background: isPlaying ? GRAPH_THEME.ui.timeline.playheadSoft : GRAPH_THEME.ui.control.defaultBg, color: GRAPH_THEME.ui.timeline.playhead, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", transition: "all 0.2s", boxShadow: isPlaying ? "0 0 10px rgba(98, 226, 205, 0.32)" : "none" }}
|
|
172
|
+
>
|
|
173
|
+
{isPlaying ? (
|
|
174
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="4" width="4" height="16" /><rect x="14" y="4" width="4" height="16" /></svg>
|
|
175
|
+
) : (
|
|
176
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><polygon points="5,3 19,12 5,21" /></svg>
|
|
177
|
+
)}
|
|
178
|
+
</button>
|
|
179
|
+
<span style={{ fontSize: 10, color: isPlaying ? GRAPH_THEME.ui.timeline.playhead : GRAPH_THEME.ui.timeline.text, fontFamily: "monospace", letterSpacing: "0.04em", transition: "color 0.2s" }}>
|
|
180
|
+
{displayDate}
|
|
181
|
+
</span>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<div style={{ position: "absolute", top: 5, left: 100, fontSize: 10, fontWeight: 600, letterSpacing: "0.1em", color: GRAPH_THEME.ui.text.subtle, textTransform: "uppercase", pointerEvents: "none", zIndex: 2 }}>
|
|
185
|
+
Temporal Scrubber · {minBound.getFullYear()}-{maxBound.getFullYear()}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div className="sem-timeline-wrap" style={{ flex: 1, overflow: "hidden", position: "relative" }}>
|
|
189
|
+
<div ref={containerRef} style={{ width: "100%", height: "100%", position: "relative" }} />
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
export const clickSelectionBehavior: GraphBehavior = {
|
|
4
|
+
id: "click-selection",
|
|
5
|
+
attach: () => {},
|
|
6
|
+
detach: () => {},
|
|
7
|
+
onNodeClick: (context, nodeId) => {
|
|
8
|
+
context.setHoveredNodeId(nodeId);
|
|
9
|
+
context.onEdgeSelectionChange("");
|
|
10
|
+
if (context.getInteractionState().selectedNodeId === nodeId) {
|
|
11
|
+
context.onNodeSelectionChange("");
|
|
12
|
+
} else {
|
|
13
|
+
context.onNodeSelectionChange(nodeId);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
onEdgeClick: (context, edgeId) => {
|
|
17
|
+
context.setHoveredNodeId(null);
|
|
18
|
+
if (context.getInteractionState().selectedEdgeId === edgeId) {
|
|
19
|
+
context.onEdgeSelectionChange("");
|
|
20
|
+
} else {
|
|
21
|
+
context.onEdgeSelectionChange(edgeId);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
onStageClick: (context) => {
|
|
25
|
+
context.setHoveredNodeId(null);
|
|
26
|
+
context.onEdgeSelectionChange("");
|
|
27
|
+
context.onNodeSelectionChange("");
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
export const fitViewBehavior: GraphBehavior = {
|
|
4
|
+
id: "fit-view",
|
|
5
|
+
attach: () => {},
|
|
6
|
+
detach: () => {},
|
|
7
|
+
performAction: (context, action) => {
|
|
8
|
+
if (action.type !== "fitView") {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
context.fitCurrentView();
|
|
13
|
+
return true;
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
export const focusCameraBehavior: GraphBehavior = {
|
|
4
|
+
id: "focus-camera",
|
|
5
|
+
attach: () => {},
|
|
6
|
+
detach: () => {},
|
|
7
|
+
performAction: (context, action) => {
|
|
8
|
+
if (action.type === "focusNode") {
|
|
9
|
+
context.focusNodeInView(action.nodeId);
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (action.type === "centerSelection") {
|
|
14
|
+
context.centerSelectionInView(action.nodeId);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (action.type === "centerGroupedSelection") {
|
|
19
|
+
context.centerGroupedSelectionInView(action.nodeId);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return false;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
export const hoverActivationBehavior: GraphBehavior = {
|
|
4
|
+
id: "hover-activation",
|
|
5
|
+
attach: () => {},
|
|
6
|
+
detach: () => {},
|
|
7
|
+
onNodeEnter: (context, nodeId) => {
|
|
8
|
+
context.setHoveredNodeId(nodeId);
|
|
9
|
+
},
|
|
10
|
+
onNodeLeave: (context, nodeId) => {
|
|
11
|
+
if (context.getInteractionState().hoveredNodeId === nodeId) {
|
|
12
|
+
context.setHoveredNodeId(null);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
const SWEEP_TICKS = 6;
|
|
4
|
+
const SWEEP_INTERVAL_MS = 60;
|
|
5
|
+
|
|
6
|
+
export function createPathHighlightBehavior(): GraphBehavior {
|
|
7
|
+
let lastPathSignature = "";
|
|
8
|
+
let sweepTimer: ReturnType<typeof setTimeout> | null = null;
|
|
9
|
+
let sweepGeneration = 0;
|
|
10
|
+
|
|
11
|
+
function cancelSweep() {
|
|
12
|
+
sweepGeneration++;
|
|
13
|
+
if (sweepTimer !== null) {
|
|
14
|
+
clearTimeout(sweepTimer);
|
|
15
|
+
sweepTimer = null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function scheduleSweep(sigma: { refresh: () => void }, tick: number, gen: number) {
|
|
20
|
+
if (tick >= SWEEP_TICKS) return;
|
|
21
|
+
sweepTimer = setTimeout(() => {
|
|
22
|
+
if (gen !== sweepGeneration) return;
|
|
23
|
+
sigma.refresh();
|
|
24
|
+
scheduleSweep(sigma, tick + 1, gen);
|
|
25
|
+
}, SWEEP_INTERVAL_MS);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
id: "path-highlight",
|
|
30
|
+
attach: () => {},
|
|
31
|
+
detach: (context) => {
|
|
32
|
+
cancelSweep();
|
|
33
|
+
lastPathSignature = "";
|
|
34
|
+
context.sigma.refresh();
|
|
35
|
+
},
|
|
36
|
+
onStateChange: (context, interactionState) => {
|
|
37
|
+
const nextPathSignature = interactionState.activePath.join("::");
|
|
38
|
+
if (nextPathSignature === lastPathSignature) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
lastPathSignature = nextPathSignature;
|
|
43
|
+
cancelSweep();
|
|
44
|
+
context.sigma.refresh();
|
|
45
|
+
|
|
46
|
+
// Animate intermediate nodes lighting up sequentially
|
|
47
|
+
if (interactionState.activePath.length > 2) {
|
|
48
|
+
scheduleSweep(context.sigma, 0, sweepGeneration);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
|
|
3
|
+
export function createSearchFocusBehavior(): GraphBehavior {
|
|
4
|
+
let lastSelectedNodeId = "";
|
|
5
|
+
let lastViewMode = "";
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
id: "search-focus",
|
|
9
|
+
attach: () => {},
|
|
10
|
+
detach: () => {
|
|
11
|
+
lastSelectedNodeId = "";
|
|
12
|
+
lastViewMode = "";
|
|
13
|
+
},
|
|
14
|
+
onStateChange: (context, interactionState) => {
|
|
15
|
+
const nextSelectedNodeId = interactionState.selectedNodeId;
|
|
16
|
+
const nextViewMode = interactionState.viewMode;
|
|
17
|
+
if (nextViewMode !== lastViewMode) {
|
|
18
|
+
lastViewMode = nextViewMode;
|
|
19
|
+
lastSelectedNodeId = nextSelectedNodeId;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!nextSelectedNodeId || nextSelectedNodeId === lastSelectedNodeId) {
|
|
23
|
+
lastSelectedNodeId = nextSelectedNodeId;
|
|
24
|
+
lastViewMode = nextViewMode;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
lastSelectedNodeId = nextSelectedNodeId;
|
|
29
|
+
lastViewMode = nextViewMode;
|
|
30
|
+
context.dispatchAction({
|
|
31
|
+
type: nextViewMode === "grouped" ? "centerGroupedSelection" : "centerSelection",
|
|
32
|
+
nodeId: nextSelectedNodeId,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type Graph from "graphology";
|
|
2
|
+
import type Sigma from "sigma";
|
|
3
|
+
|
|
4
|
+
import { graph, type EdgeAttributes, type NodeAttributes } from "../../../store/graphStore";
|
|
5
|
+
import type { GraphCameraState, GraphInteractionState } from "../types";
|
|
6
|
+
|
|
7
|
+
export type GraphBehaviorActionRequest =
|
|
8
|
+
| { type: "fitView" }
|
|
9
|
+
| { type: "focusNode"; nodeId: string }
|
|
10
|
+
| { type: "centerSelection"; nodeId: string }
|
|
11
|
+
| { type: "centerGroupedSelection"; nodeId: string };
|
|
12
|
+
|
|
13
|
+
export interface GraphBehaviorContext {
|
|
14
|
+
sigma: Sigma;
|
|
15
|
+
graph: typeof graph | Graph<NodeAttributes, EdgeAttributes>;
|
|
16
|
+
displayGraph: typeof graph | Graph<NodeAttributes, EdgeAttributes>;
|
|
17
|
+
getInteractionState: () => GraphInteractionState;
|
|
18
|
+
setHoveredNodeId: (nodeId: string | null) => void;
|
|
19
|
+
onNodeSelectionChange: (nodeId: string) => void;
|
|
20
|
+
onEdgeSelectionChange: (edgeId: string) => void;
|
|
21
|
+
focusNodeInView: (nodeId: string) => void;
|
|
22
|
+
centerSelectionInView: (nodeId: string) => void;
|
|
23
|
+
centerGroupedSelectionInView: (nodeId: string) => void;
|
|
24
|
+
fitCurrentView: () => void;
|
|
25
|
+
dispatchAction: (action: GraphBehaviorActionRequest) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GraphBehavior {
|
|
29
|
+
id: string;
|
|
30
|
+
attach: (context: GraphBehaviorContext) => void;
|
|
31
|
+
detach: (context: GraphBehaviorContext) => void;
|
|
32
|
+
onNodeEnter?: (context: GraphBehaviorContext, nodeId: string) => void;
|
|
33
|
+
onNodeLeave?: (context: GraphBehaviorContext, nodeId: string) => void;
|
|
34
|
+
onNodeClick?: (context: GraphBehaviorContext, nodeId: string) => void;
|
|
35
|
+
onEdgeClick?: (context: GraphBehaviorContext, edgeId: string) => void;
|
|
36
|
+
onStageClick?: (context: GraphBehaviorContext) => void;
|
|
37
|
+
onCameraChange?: (context: GraphBehaviorContext, cameraState: GraphCameraState) => void;
|
|
38
|
+
onStateChange?: (context: GraphBehaviorContext, interactionState: GraphInteractionState) => void;
|
|
39
|
+
apply?: (context: GraphBehaviorContext, interactionState: GraphInteractionState) => void;
|
|
40
|
+
performAction?: (context: GraphBehaviorContext, action: GraphBehaviorActionRequest) => boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GraphBehavior } from "./types";
|
|
2
|
+
import type { GraphViewMode } from "../types";
|
|
3
|
+
|
|
4
|
+
export function createViewModeSwitchBehavior(): GraphBehavior {
|
|
5
|
+
let lastViewMode: GraphViewMode | null = null;
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
id: "view-mode-switch",
|
|
9
|
+
attach: () => {},
|
|
10
|
+
detach: () => {
|
|
11
|
+
lastViewMode = null;
|
|
12
|
+
},
|
|
13
|
+
onStateChange: (context, interactionState) => {
|
|
14
|
+
if (interactionState.viewMode === lastViewMode) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
lastViewMode = interactionState.viewMode;
|
|
19
|
+
const nextFocusedNodeId = interactionState.focusedNodeId;
|
|
20
|
+
|
|
21
|
+
if (interactionState.viewMode === "focused" && nextFocusedNodeId) {
|
|
22
|
+
context.dispatchAction({ type: "focusNode", nodeId: nextFocusedNodeId });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
context.dispatchAction({ type: "fitView" });
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|