import * as react_jsx_runtime from 'react/jsx-runtime'; import { Entity, CompoundEntityRef } from '@backstage/catalog-model'; import { DependencyGraphTypes } from '@backstage/core-components'; import * as react from 'react'; import { MouseEventHandler, MouseEvent } from 'react'; import { JsonObject } from '@backstage/types'; import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api'; import * as _backstage_core_plugin_api from '@backstage/core-plugin-api'; /** * A pair of two relations that describe the opposite of each other. The first * relation is considered as the primary relation. * * @public */ type RelationPairs = [string, string][]; /** * A list of built-in relations * * @public */ declare const ALL_RELATIONS: string[]; /** * A list of pairs of entity relations, used to define which relations are * merged together and which the primary relation is. * * @public */ declare const ALL_RELATION_PAIRS: RelationPairs; /** * Additional Data for entities. * * @public */ type EntityEdgeData = { /** * Up to two relations that are connecting an entity. */ relations: string[]; /** * Whether the entity is visible or not. */ label: 'visible'; }; /** * Edge between two entities. * * @public */ type EntityEdge = DependencyGraphTypes.DependencyEdge; /** * Additional data for Entity Node * * @public */ type EntityNodeData = { /** * The Entity */ entity: Entity; /** * Whether the entity is focused, optional, defaults to false. Focused * entities are highlighted in the graph. */ focused?: boolean; /** * Optional color of the entity, defaults to 'default'. */ color?: 'primary' | 'secondary' | 'default'; /** * Optional click handler. */ onClick?: MouseEventHandler; /** * Name of the entity. * @deprecated use {@link EntityNodeData#entity} instead */ name: string; /** * Optional kind of the entity. * @deprecated use {@link EntityNodeData#entity} instead */ kind?: string; /** * Optional title of the entity. * @deprecated use {@link EntityNodeData#entity} instead */ title?: string; /** * Namespace of the entity. * @deprecated use {@link EntityNodeData#entity} instead * The Entity */ namespace: string; /** * Optional spec of the entity. * @deprecated use {@link EntityNodeData#entity} instead */ spec?: JsonObject; }; /** * Node representing an entity. * * @public */ type EntityNode = DependencyGraphTypes.DependencyNode; /** * Render direction of the graph. * * @public */ declare const Direction: { /** * Top to bottom. */ readonly TOP_BOTTOM: "TB"; /** * Bottom to top. */ readonly BOTTOM_TOP: "BT"; /** * Left to right. */ readonly LEFT_RIGHT: "LR"; /** * Right to left. */ readonly RIGHT_LEFT: "RL"; }; /** * @public */ type Direction = (typeof Direction)[keyof typeof Direction]; /** * @public */ declare namespace Direction { type TOP_BOTTOM = typeof Direction.TOP_BOTTOM; type BOTTOM_TOP = typeof Direction.BOTTOM_TOP; type LEFT_RIGHT = typeof Direction.LEFT_RIGHT; type RIGHT_LEFT = typeof Direction.RIGHT_LEFT; } /** @public */ type EntityRelationsGraphClassKey = 'progress' | 'container' | 'graph'; /** * @public */ type EntityRelationsGraphProps = { rootEntityNames: CompoundEntityRef | CompoundEntityRef[]; maxDepth?: number; unidirectional?: boolean; mergeRelations?: boolean; kinds?: string[]; relations?: string[]; entityFilter?: (entity: Entity) => boolean; direction?: Direction; onNodeClick?: (value: EntityNode, event: MouseEvent) => void; relationPairs?: RelationPairs; className?: string; zoom?: 'enabled' | 'disabled' | 'enable-on-click'; renderNode?: DependencyGraphTypes.RenderNodeFunction; renderLabel?: DependencyGraphTypes.RenderLabelFunction; renderEdge?: DependencyGraphTypes.RenderEdgeFunction; curve?: 'curveStepBefore' | 'curveMonotoneX'; showArrowHeads?: boolean; allowFullscreen?: boolean; }; /** * Core building block for custom entity relations diagrams. * * @public */ declare const EntityRelationsGraph: (props: EntityRelationsGraphProps) => react_jsx_runtime.JSX.Element; /** @public */ type CustomLabelClassKey = 'text' | 'secondary'; /** @public */ type CustomNodeClassKey = 'node' | 'text' | 'clickable'; /** * A card that displays the directly related entities to the current entity. * * @public */ declare const EntityCatalogGraphCard: (props: Partial & { height?: number; title?: string; action?: react.ReactNode; }) => react_jsx_runtime.JSX.Element; /** * A standalone page that can be added to your application providing a viewer * for your entities and their relations. * * @public */ declare const CatalogGraphPage: (props: { initialState?: { selectedRelations?: string[]; selectedKinds?: string[]; rootEntityRefs?: string[]; maxDepth?: number; unidirectional?: boolean; mergeRelations?: boolean; direction?: Direction; showFilters?: boolean; curve?: "curveStepBefore" | "curveMonotoneX"; }; } & Partial) => react_jsx_runtime.JSX.Element; /** * Utility API reference for the {@link CatalogGraphApi}. * * @public */ declare const catalogGraphApiRef: _backstage_frontend_plugin_api.ApiRef; /** @public */ type DefaultRelationsInclude = { include: string[]; }; /** @public */ type DefaultRelationsExclude = { exclude: string[]; }; /** * Default relations. Can either be a list of relations to use by default, or * a list of relations to _not_ use, i.e. include all other relations. * * @public */ type DefaultRelations = DefaultRelationsInclude | DefaultRelationsExclude; /** * API for driving catalog imports. * * @public */ interface CatalogGraphApi { /** All known relations */ readonly knownRelations: string[]; /** All known relation pairs */ readonly knownRelationPairs: [string, string][]; /** The default relations to show in the graph */ readonly defaultRelations: string[]; } /** * Options for the {@link DefaultCatalogGraphApi}. * * @public */ interface DefaultCatalogGraphApiOptions { readonly knownRelations?: string[]; readonly knownRelationPairs?: RelationPairs; readonly defaultRelationTypes?: DefaultRelations; } /** * The default implementation of the {@link CatalogGraphApi}. * * @public */ declare class DefaultCatalogGraphApi implements CatalogGraphApi { readonly knownRelations: string[]; readonly knownRelationPairs: [string, string][]; readonly defaultRelations: string[]; constructor(options?: DefaultCatalogGraphApiOptions); } /** * Catalog Graph Plugin instance. * @public */ declare const catalogGraphPlugin: _backstage_core_plugin_api.BackstagePlugin<{ catalogGraph: _backstage_core_plugin_api.RouteRef; }, { catalogEntity: _backstage_core_plugin_api.ExternalRouteRef<{ name: string; kind: string; namespace: string; }, true>; }>; /** * Route pointing to the standalone catalog graph page. * * @public */ declare const catalogGraphRouteRef: _backstage_core_plugin_api.RouteRef; /** * Contextual information for a graph transformation. * * @public */ interface TransformationContext { /** * The distance from an entity node to a root entity * * NOTE: This is empty until the 'set-distances' transformation is applied */ nodeDistances: Map; edges: EntityEdge[]; nodes: EntityNode[]; rootEntityRefs: string[]; unidirectional: boolean; maxDepth: number; } /** @public */ declare const catalogGraphTranslationRef: _backstage_frontend_plugin_api.TranslationRef<"catalog-graph", { readonly "catalogGraphCard.title": "Relations"; readonly "catalogGraphCard.deepLinkTitle": "View graph"; readonly "catalogGraphPage.title": "Catalog Graph"; readonly "catalogGraphPage.filterToggleButtonTitle": "Filters"; readonly "catalogGraphPage.supportButtonDescription": "Start tracking your component in by adding it to the software catalog."; readonly "catalogGraphPage.simplifiedSwitchLabel": "Simplified"; readonly "catalogGraphPage.mergeRelationsSwitchLabel": "Merge relations"; readonly "catalogGraphPage.zoomOutDescription": "Use pinch & zoom to move around the diagram. Click to change active node, shift click to navigate to entity."; readonly "catalogGraphPage.curveFilter.title": "Curve"; readonly "catalogGraphPage.curveFilter.curveStepBefore": "Step Before"; readonly "catalogGraphPage.curveFilter.curveMonotoneX": "Monotone X"; readonly "catalogGraphPage.directionFilter.title": "Direction"; readonly "catalogGraphPage.directionFilter.leftToRight": "Left to right"; readonly "catalogGraphPage.directionFilter.rightToLeft": "Right to left"; readonly "catalogGraphPage.directionFilter.topToBottom": "Top to bottom"; readonly "catalogGraphPage.directionFilter.bottomToTop": "Bottom to top"; readonly "catalogGraphPage.maxDepthFilter.title": "Max depth"; readonly "catalogGraphPage.maxDepthFilter.inputPlaceholder": "∞ Infinite"; readonly "catalogGraphPage.maxDepthFilter.clearButtonAriaLabel": "clear max depth"; readonly "catalogGraphPage.selectedKindsFilter.title": "Kinds"; readonly "catalogGraphPage.selectedRelationsFilter.title": "Relations"; }>; export { ALL_RELATIONS, ALL_RELATION_PAIRS, CatalogGraphPage, DefaultCatalogGraphApi, Direction, EntityCatalogGraphCard, EntityRelationsGraph, catalogGraphApiRef, catalogGraphPlugin, catalogGraphRouteRef, catalogGraphTranslationRef }; export type { CatalogGraphApi, CustomLabelClassKey, CustomNodeClassKey, DefaultCatalogGraphApiOptions, DefaultRelations, DefaultRelationsExclude, DefaultRelationsInclude, EntityEdge, EntityEdgeData, EntityNode, EntityNodeData, EntityRelationsGraphClassKey, EntityRelationsGraphProps, RelationPairs, TransformationContext };