@lincyaw/aegis-ui 0.14.0 → 0.15.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/dist/components/ui/RegionMap.cjs +2 -0
- package/dist/components/ui/RegionMap.cjs.map +1 -0
- package/dist/components/ui/RegionMap.d.ts +53 -0
- package/dist/components/ui/RegionMap.js +173 -0
- package/dist/components/ui/RegionMap.js.map +1 -0
- package/dist/components/ui/RollingValue.cjs.map +1 -1
- package/dist/components/ui/RollingValue.d.ts +1 -2
- package/dist/components/ui/RollingValue.js.map +1 -1
- package/dist/components/ui/ServiceMap.cjs +1 -1
- package/dist/components/ui/ServiceMap.cjs.map +1 -1
- package/dist/components/ui/ServiceMap.d.ts +2 -1
- package/dist/components/ui/ServiceMap.js +48 -60
- package/dist/components/ui/ServiceMap.js.map +1 -1
- package/dist/components/ui/Timeline.cjs +1 -1
- package/dist/components/ui/Timeline.cjs.map +1 -1
- package/dist/components/ui/Timeline.d.ts +16 -1
- package/dist/components/ui/Timeline.js +115 -45
- package/dist/components/ui/Timeline.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +6 -0
- package/dist/components/ui/TraceTree.js +198 -175
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/index.d.ts +4 -0
- package/dist/components/ui/workStatus.cjs +2 -0
- package/dist/components/ui/workStatus.cjs.map +1 -0
- package/dist/components/ui/workStatus.d.ts +15 -0
- package/dist/components/ui/workStatus.js +18 -0
- package/dist/components/ui/workStatus.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +175 -171
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceMap.cjs","sources":["../../../src/components/ui/ServiceMap.tsx"],"sourcesContent":["// Service-map composition adapted from HyperDX (MIT, DeploySentinel Inc. 2023):\n// https://github.com/hyperdxio/hyperdx/blob/main/packages/app/src/components/ServiceMap/ServiceMap.tsx\nimport {\n type CSSProperties,\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport {\n type EdgeLabel,\n type GraphLabel,\n type NodeLabel,\n layout as dagreLayout,\n graphlib,\n} from '@dagrejs/dagre';\nimport {\n Background,\n BackgroundVariant,\n Controls,\n type Edge,\n type EdgeProps,\n Handle,\n MiniMap,\n type Node,\n type NodeChange,\n type NodeProps,\n Position,\n ReactFlow,\n ReactFlowProvider,\n type XYPosition,\n getViewportForBounds,\n useInternalNode,\n useReactFlow,\n useStore,\n useStoreApi,\n} from '@xyflow/react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useStrings } from '../../locale';\nimport './ServiceMap.css';\nimport { StatusDot } from './StatusDot';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\n\n/**\n * Drawn as a dot before the node's label. `active` is work in progress, e.g.\n * a running task: the ink dot pulses.\n */\nexport type ServiceMapStatus = 'ok' | 'active' | 'warn' | 'error' | 'muted';\nexport type ServiceMapDirection = 'LR' | 'TB';\n\nexport interface ServiceMapNode {\n id: string;\n label: string;\n sublabel?: string;\n status?: ServiceMapStatus;\n badge?: number | string;\n data?: Record<string, unknown>;\n}\n\n/**\n * A labelled box around some nodes, e.g. the tasks of one phase. Its id may\n * also be a node's id.\n */\nexport interface ServiceMapGroup {\n id: string;\n label: string;\n nodeIds: string[];\n}\n\n/** For assistive technology, named by its nodes' labels, e.g. \"checkout to payments\". */\nexport interface ServiceMapEdge {\n id: string;\n source: string;\n target: string;\n label?: string;\n /** `active` is a node's state only. */\n status?: Exclude<ServiceMapStatus, 'active'>;\n}\n\nexport interface ServiceMapProps {\n nodes: ServiceMapNode[];\n edges: ServiceMapEdge[];\n /**\n * Boxes drawn around groups of nodes, e.g. the phases of a pipeline. The\n * groups follow one another along `direction` in the order given, each\n * laid out on its own; nodes in no group come after the last group. A\n * node belongs to the first group that lists it.\n */\n groups?: ServiceMapGroup[];\n direction?: ServiceMapDirection;\n /** Height in px. Default: the container's height, at least `--service-map-min-height`. */\n height?: number;\n /**\n * Fill the viewport's height below the shell header\n * (`--service-map-viewport-height`), for a page whose main view is the\n * map. At 768 px and below the map keeps its default height, so a touch\n * can still scroll the page past it. `height` overrides it.\n */\n fillViewport?: boolean;\n /**\n * Called when a node is clicked, or gets Enter or Space while focused.\n * Without it nodes can be neither focused nor selected.\n */\n onNodeClick?: (node: ServiceMapNode) => void;\n /** The same for edges. */\n onEdgeClick?: (edge: ServiceMapEdge) => void;\n /** Drawn inverted, and `aria-current` for assistive technology. */\n selectedNodeId?: string;\n /**\n * Opens at actual size on this node instead of fitting the whole map, and\n * again whenever it changes: fitted to the node and the nodes it has a\n * direct edge to or from when they fit at actual size, otherwise centred\n * on the node alone. Large maps stay readable when they open. An id that\n * is not on the map is ignored.\n *\n * Without it the map opens fitted whole. At 768 px and below a map that\n * fits only below a readable size opens at the smallest readable zoom on\n * its start instead, the left edge for `LR` and the top for `TB`, to be\n * panned from there.\n */\n focusNodeId?: string;\n /**\n * Show the minimap in the bottom-right corner. A fit keeps its strip on\n * the right clear, so a map fitted whole opens with no node under it.\n * Default: shown unless `focusNodeId` is given, since a focused view runs\n * past every edge of the map and the minimap would cover nodes there. It\n * is not shown at 768 px and below.\n */\n minimap?: boolean;\n /**\n * The map's accessible name. Each node is a `group` named by its label\n * and, in a group, described by the group's label; a group's box is not\n * a `group`.\n */\n ariaLabel?: string;\n className?: string;\n}\n\ninterface ServiceNodeData extends Record<string, unknown> {\n node: ServiceMapNode;\n selected: boolean;\n}\n\ninterface ServiceGroupData extends Record<string, unknown> {\n label: string;\n /** The label's element id, which the group's nodes are described by. */\n labelId: string;\n}\n\ntype ServiceFlowNode =\n | Node<ServiceNodeData, 'service'>\n | Node<ServiceGroupData, 'serviceGroup'>;\n\ninterface ServiceEdgeData extends Record<string, unknown> {\n edge: ServiceMapEdge;\n}\n\n/** A node is at least this size; it widens with its label up to NODE_MAX_WIDTH, then wraps it. */\nconst NODE_WIDTH = 180;\nconst NODE_HEIGHT = 64;\nconst NODE_MAX_WIDTH = 320;\n/** Room above a group's nodes for its label. */\nconst GROUP_LABEL_HEIGHT = 28;\n/** Space between consecutive groups along the direction. */\nconst GROUP_GAP = 64;\n\n// The layout reads these sizes, so the CSS node and group boxes read them too.\nconst SIZE_VARS = {\n '--aegis-service-map-node-w': `${String(NODE_WIDTH)}px`,\n '--aegis-service-map-node-h': `${String(NODE_HEIGHT)}px`,\n '--aegis-service-map-node-max-w': `${String(NODE_MAX_WIDTH)}px`,\n '--aegis-service-map-group-label-h': `${String(GROUP_LABEL_HEIGHT)}px`,\n};\n\ninterface Size {\n width: number;\n height: number;\n}\n\nconst DEFAULT_SIZE: Size = { width: NODE_WIDTH, height: NODE_HEIGHT };\n\n/** A stretch of the map laid out on its own: a group's nodes, or the nodes in no group. */\ninterface Part {\n group?: ServiceMapGroup;\n ids: string[];\n}\n\n/** What the layout and the fit read: the map without its nodes' and edges' content. */\ninterface MapShape {\n direction: ServiceMapDirection;\n ids: string[];\n /** The endpoints of each edge between two nodes on the map. */\n links: Array<[string, string]>;\n groups: ServiceMapGroup[];\n}\n\nfunction shapeOf(\n nodes: ServiceMapNode[],\n edges: ServiceMapEdge[],\n groups: ServiceMapGroup[],\n direction: ServiceMapDirection,\n): MapShape {\n const ids = nodes.map((n) => n.id);\n const present = new Set(ids);\n return {\n direction,\n ids,\n links: edges\n .filter((e) => present.has(e.source) && present.has(e.target))\n .map((e) => [e.source, e.target]),\n groups,\n };\n}\n\n/** Each group with the nodes it claims, in the order given, then the nodes in no group. */\nfunction partsOf(ids: string[], groups: ServiceMapGroup[]): Part[] {\n const present = new Set(ids);\n const claimed = new Set<string>();\n const grouped = groups.map((group) => {\n const ids = [...new Set(group.nodeIds)].filter(\n (id) => present.has(id) && !claimed.has(id),\n );\n ids.forEach((id) => claimed.add(id));\n return { group, ids };\n });\n const rest = ids.filter((id) => !claimed.has(id));\n return [...grouped, { ids: rest }].filter((part) => part.ids.length > 0);\n}\n\n/** Lays out one part with dagre: its nodes and the edges between them. Positions are top-left corners. */\nfunction layoutPart(\n ids: string[],\n links: MapShape['links'],\n direction: ServiceMapDirection,\n sizeOf: (id: string) => Size,\n): { positions: Map<string, XYPosition>; width: number; height: number } {\n const g = new graphlib.Graph<GraphLabel, NodeLabel, EdgeLabel>();\n g.setDefaultEdgeLabel(() => ({}));\n g.setGraph({\n rankdir: direction,\n nodesep: 40,\n ranksep: 80,\n marginx: 16,\n marginy: 16,\n });\n for (const id of ids) {\n g.setNode(id, { ...sizeOf(id) });\n }\n for (const [source, target] of links) {\n if (g.hasNode(source) && g.hasNode(target)) {\n g.setEdge(source, target);\n }\n }\n dagreLayout(g);\n const positions = new Map(\n ids.map((id) => {\n const { x = 0, y = 0 } = g.node(id) as { x?: number; y?: number };\n const size = sizeOf(id);\n return [id, { x: x - size.width / 2, y: y - size.height / 2 }];\n }),\n );\n const { width = 0, height = 0 } = g.graph();\n return { positions, width, height };\n}\n\ninterface MapLayout {\n /** The group boxes. */\n groups: ServiceFlowNode[];\n /** Each node's top-left corner. */\n positions: Map<string, XYPosition>;\n /** The label id of the group each grouped node is in. */\n groupLabels: Map<string, string>;\n}\n\n/**\n * Lays the parts out one after another along the direction, each centred\n * across it, with dagre inside each part.\n */\nfunction computeLayout(\n shape: MapShape,\n sizes: ReadonlyMap<string, Size>,\n idPrefix: string,\n): MapLayout {\n const labelIdOf = (group: ServiceMapGroup): string =>\n `${idPrefix}-group-${String(shape.groups.indexOf(group))}`;\n const horizontal = shape.direction === 'LR';\n const parts = partsOf(shape.ids, shape.groups).map((part) => {\n const laid = layoutPart(part.ids, shape.links, shape.direction, (id) => {\n return sizes.get(id) ?? DEFAULT_SIZE;\n });\n const labelHeight = part.group === undefined ? 0 : GROUP_LABEL_HEIGHT;\n return {\n ...part,\n ...laid,\n labelHeight,\n boxHeight: laid.height + labelHeight,\n };\n });\n const across = Math.max(\n 0,\n ...parts.map((part) => (horizontal ? part.boxHeight : part.width)),\n );\n let along = 0;\n const placed = parts.map((part) => {\n const origin = horizontal\n ? { x: along, y: (across - part.boxHeight) / 2 }\n : { x: (across - part.width) / 2, y: along };\n along += (horizontal ? part.width : part.boxHeight) + GROUP_GAP;\n return { ...part, origin };\n });\n return {\n groups: placed.flatMap((part): ServiceFlowNode[] =>\n part.group === undefined\n ? []\n : [\n {\n // Prefixed, so a group may share an id with a node.\n id: `group:${part.group.id}`,\n type: 'serviceGroup',\n position: part.origin,\n width: part.width,\n height: part.boxHeight,\n data: {\n label: part.group.label,\n labelId: labelIdOf(part.group),\n },\n // Not a group for assistive technology: the box contains no\n // nodes in the DOM, so its label is plain text, which its\n // nodes are described by. It cannot be focused, so it has no\n // keyboard help either.\n domAttributes: {\n 'aria-roledescription': undefined,\n 'aria-describedby': undefined,\n },\n // Under the edges, and letting clicks through to them: React\n // Flow gives every node's wrapper pointer events once the map\n // has onNodeClick.\n zIndex: -1,\n style: { pointerEvents: 'none' },\n draggable: false,\n connectable: false,\n selectable: false,\n focusable: false,\n },\n ],\n ),\n positions: new Map(\n placed.flatMap((part) =>\n [...part.positions].map(([id, p]) => [\n id,\n {\n x: part.origin.x + p.x,\n y: part.origin.y + part.labelHeight + p.y,\n },\n ]),\n ),\n ),\n groupLabels: new Map(\n placed.flatMap((part) => {\n const { group } = part;\n return group === undefined\n ? []\n : part.ids.map((id) => [id, labelIdOf(group)] as const);\n }),\n ),\n };\n}\n\nfunction ServiceGroup({\n data,\n}: NodeProps<Node<ServiceGroupData, 'serviceGroup'>>): JSX.Element {\n return (\n <div className=\"aegis-service-map__group\">\n <span id={data.labelId} className=\"aegis-service-map__group-label\">\n {data.label}\n </span>\n </div>\n );\n}\n\nconst DOT_TONE: Record<\n ServiceMapStatus,\n NonNullable<ComponentProps<typeof StatusDot>['tone']>\n> = {\n ok: 'ink',\n active: 'ink',\n warn: 'caution',\n error: 'warning',\n muted: 'muted',\n};\n\nfunction ServiceNode({\n data,\n}: NodeProps<Node<ServiceNodeData, 'service'>>): JSX.Element {\n const { node, selected } = data;\n const status = node.status ?? 'ok';\n const tone = DOT_TONE[status];\n return (\n <div\n className={[\n 'aegis-service-map__node',\n `aegis-service-map__node--${status}`,\n selected ? 'aegis-service-map__node--selected' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <Handle\n type=\"target\"\n position={Position.Left}\n className=\"aegis-service-map__handle\"\n />\n <div className=\"aegis-service-map__node-body\">\n <div className=\"aegis-service-map__node-label\">\n <StatusDot\n pulse={status === 'active'}\n tone={selected && tone === 'ink' ? 'inverted' : tone}\n />\n <span className=\"aegis-service-map__node-label-text\">\n {node.label}\n </span>\n </div>\n {node.sublabel !== undefined && (\n <div className=\"aegis-service-map__node-sublabel\">\n {node.sublabel}\n </div>\n )}\n </div>\n {node.badge !== undefined && node.badge !== '' && (\n <span\n className={`aegis-service-map__node-badge aegis-service-map__node-badge--${status}`}\n >\n {node.badge}\n </span>\n )}\n <Handle\n type=\"source\"\n position={Position.Right}\n className=\"aegis-service-map__handle\"\n />\n </div>\n );\n}\n\nfunction ServiceEdge(props: EdgeProps<Edge<ServiceEdgeData>>): JSX.Element {\n const { sourceX, sourceY, targetX, targetY, label, markerEnd, style } = props;\n // The label follows the path by its id, which must be unique on the page,\n // also when two maps share edge ids.\n const pathId = useId();\n const midX = (sourceX + targetX) / 2;\n const path = `M${sourceX},${sourceY} C${midX},${sourceY} ${midX},${targetY} ${targetX},${targetY}`;\n return (\n <>\n {/* The focus ring, drawn along the path under it. */}\n <path d={path} className=\"aegis-service-map__edge-focus\" fill=\"none\" />\n <path\n id={pathId}\n d={path}\n className=\"aegis-service-map__edge-path\"\n markerEnd={markerEnd}\n style={style}\n fill=\"none\"\n />\n {label !== undefined && label !== '' && (\n <text className=\"aegis-service-map__edge-label\">\n <textPath href={`#${pathId}`} startOffset=\"50%\" textAnchor=\"middle\">\n {label}\n </textPath>\n </text>\n )}\n </>\n );\n}\n\nconst NODE_TYPES = { service: ServiceNode, serviceGroup: ServiceGroup };\nconst EDGE_TYPES = { service: ServiceEdge };\n\nconst NARROW_QUERY = '(max-width: 768px)';\n/** Space kept clear around fitted nodes, in px. */\nconst FIT_MARGIN = 24;\n/** Low enough that fitting the whole map fits it, so the minimap's strip stays clear. */\nconst MIN_ZOOM = 0.1;\n/** A focused map opens at this zoom, so its labels are readable. */\nconst FOCUS_ZOOM = 1;\n/** The smallest zoom a narrow map opens at: a node's 13 px label reads at 11 px. */\nconst READABLE_ZOOM = 11 / 13;\n// React Flow draws the controls and the minimap in panels inset by 15 px. A\n// control button is 26 px, 28 inside the controls' hairline border.\nconst PANEL_INSET = 15;\nconst CONTROLS_WIDTH = 28;\nconst MINIMAP_WIDTH = 200;\n\n/** A fit padding in px; React Flow reads a bare number as a fraction of the view. */\nconst px = (value: number): `${number}px` => `${value}px`;\n\n/** A node with the nodes it has a direct edge to or from. */\nfunction neighbourhood(id: string, links: MapShape['links']): string[] {\n return [\n ...new Set([\n id,\n ...links.filter(([source]) => source === id).map(([, target]) => target),\n ...links.filter(([, target]) => target === id).map(([source]) => source),\n ]),\n ];\n}\n\n/** The minimap draws groups as outlines, so the nodes inside them stay visible. */\nfunction minimapNodeClass(node: Node): string {\n return node.type === 'serviceGroup' ? 'aegis-service-map__minimap-group' : '';\n}\n\n/**\n * Fits the view once the layout uses every node's measured size, and again\n * when the layout or the focus changes. Nothing else moves the view, so a\n * new status or selection keeps the user's pan and zoom. Returns whether\n * the view has been fitted to the current focus.\n */\nfunction useFit(\n shape: MapShape,\n layout: MapLayout,\n laidOut: boolean,\n focusNodeId: string | undefined,\n showMinimap: boolean,\n narrow: boolean,\n): boolean {\n const { fitView, getNodes, getNodesBounds, setViewport } = useReactFlow();\n const store = useStoreApi();\n const paneSized = useStore((state) => state.width > 0 && state.height > 0);\n const focus = useMemo(\n () =>\n focusNodeId !== undefined && shape.ids.includes(focusNodeId)\n ? { id: focusNodeId, near: neighbourhood(focusNodeId, shape.links) }\n : undefined,\n [focusNodeId, shape],\n );\n const [fittedTo, setFittedTo] = useState<string | null>();\n useEffect(() => {\n if (paneSized && laidOut) {\n const settle = (): void => {\n setFittedTo(focus?.id ?? null);\n };\n const padding = {\n top: px(FIT_MARGIN),\n bottom: px(FIT_MARGIN),\n left: px(PANEL_INSET + CONTROLS_WIDTH + FIT_MARGIN),\n right: px(\n showMinimap ? PANEL_INSET + MINIMAP_WIDTH + FIT_MARGIN : FIT_MARGIN,\n ),\n };\n const { width, height } = store.getState();\n if (focus === undefined) {\n const all = getNodes();\n const bounds = getNodesBounds(all);\n const fitted = getViewportForBounds(\n bounds,\n width,\n height,\n MIN_ZOOM,\n 1,\n padding,\n );\n if (narrow && fitted.zoom < READABLE_ZOOM) {\n // A phone has no minimap and too little room for the whole map,\n // so it opens where the map starts, on its first node.\n const zoom = READABLE_ZOOM;\n const horizontal = shape.direction === 'LR';\n const along = (n: Node): number =>\n horizontal ? n.position.x : n.position.y;\n const first = all\n .filter((n) => n.type === 'service')\n .reduce((a, b) => (along(b) < along(a) ? b : a));\n const { width: w = NODE_WIDTH, height: h = NODE_HEIGHT } =\n first.measured ?? {};\n void setViewport(\n horizontal\n ? {\n x:\n PANEL_INSET + CONTROLS_WIDTH + FIT_MARGIN - bounds.x * zoom,\n y: height / 2 - (first.position.y + h / 2) * zoom,\n zoom,\n }\n : {\n x: width / 2 - (first.position.x + w / 2) * zoom,\n y: FIT_MARGIN - bounds.y * zoom,\n zoom,\n },\n ).then(settle);\n } else {\n void fitView({ maxZoom: 1, padding }).then(settle);\n }\n } else {\n const nearFits =\n getViewportForBounds(\n getNodesBounds(focus.near),\n width,\n height,\n MIN_ZOOM,\n FOCUS_ZOOM,\n padding,\n ).zoom >= FOCUS_ZOOM;\n void fitView({\n nodes: (nearFits ? focus.near : [focus.id]).map((id) => ({ id })),\n minZoom: FOCUS_ZOOM,\n maxZoom: FOCUS_ZOOM,\n padding,\n }).then(settle);\n }\n }\n }, [\n paneSized,\n laidOut,\n layout,\n focus,\n showMinimap,\n narrow,\n shape.direction,\n store,\n fitView,\n getNodes,\n getNodesBounds,\n setViewport,\n ]);\n return fittedTo === (focus?.id ?? null);\n}\n\n/**\n * The selected node of a map in a `DetailBeside`: once the view is fitted\n * it places the node's box, again whenever the map pans or zooms, and at\n * 768 px and below draws the detail right under the node, over the map,\n * which grows to hold it.\n */\nfunction ServiceMapSelection({\n nodeId,\n fitted,\n selection,\n}: {\n nodeId: string;\n fitted: boolean;\n selection: SelectedRowDetail;\n}): JSX.Element | null {\n const transform = useStore((state) => state.transform);\n const domNode = useStore((state) => state.domNode);\n const node = useInternalNode(nodeId);\n // The node goes only with this component, so a pan places the same node\n // again rather than a new one.\n useIsomorphicLayoutEffect(\n () => () => {\n selection.placeRow(null);\n },\n [selection],\n );\n useIsomorphicLayoutEffect(() => {\n const group = domNode?.querySelector(\n `.react-flow__node[data-id=\"${CSS.escape(nodeId)}\"]`,\n );\n if (fitted && group instanceof HTMLElement) {\n selection.placeRow(group);\n }\n }, [selection, domNode, nodeId, transform, fitted]);\n const height = node?.measured.height;\n if (selection.inline === null || node === undefined || height === undefined) {\n return null;\n }\n const [, y, zoom] = transform;\n const bottom = (node.internals.positionAbsolute.y + height) * zoom + y;\n return (\n <div\n className=\"aegis-service-map__detail\"\n style={{ marginTop: Math.max(bottom, 0) }}\n >\n {selection.inline}\n </div>\n );\n}\n\n/**\n * Pans a node or edge that gets keyboard focus fully into view, centred.\n * React Flow pans only to a node entirely outside the view, and never to\n * an edge.\n */\nfunction usePanToFocused(): (event: FocusEvent<HTMLDivElement>) => void {\n const { getViewport, setViewport } = useReactFlow();\n return useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n const target = event.target;\n if (\n !(target instanceof Element) ||\n !target.matches(\n '.react-flow__node:focus-visible, .react-flow__edge:focus-visible',\n )\n ) {\n return;\n }\n // The browser has already scrolled the pane to the element, and React\n // Flow scrolls it back, so the offset is added back to place it.\n const { scrollLeft, scrollTop } = event.currentTarget;\n const pane = event.currentTarget.getBoundingClientRect();\n const box = target.getBoundingClientRect();\n const left = box.left - pane.left + scrollLeft;\n const top = box.top - pane.top + scrollTop;\n if (\n left >= 0 &&\n top >= 0 &&\n left + box.width <= pane.width &&\n top + box.height <= pane.height\n ) {\n return;\n }\n const { x, y, zoom } = getViewport();\n void setViewport({\n x: x + pane.width / 2 - (left + box.width / 2),\n y: y + pane.height / 2 - (top + box.height / 2),\n zoom,\n });\n },\n [getViewport, setViewport],\n );\n}\n\nfunction ServiceMapInner({\n nodes,\n edges,\n groups = [],\n direction = 'LR',\n height,\n fillViewport = false,\n onNodeClick,\n onEdgeClick,\n selectedNodeId,\n focusNodeId,\n minimap = focusNodeId === undefined,\n ariaLabel,\n className,\n}: ServiceMapProps): JSX.Element {\n const strings = useStrings();\n const idPrefix = useId();\n // React Flow names its elements after this id ('1' when none is given),\n // so each map passes its own and a page can hold several.\n const flowId = `aegis-service-map${idPrefix.replace(/:/g, '-')}`;\n const nodesSelectable = onNodeClick !== undefined;\n const edgesSelectable = onEdgeClick !== undefined;\n // Node sizes as React Flow measured them; the layout reads them, so a\n // node can be as wide as its label.\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(\n () => new Map(),\n );\n const shapeJson = useMemo(\n () => JSON.stringify(shapeOf(nodes, edges, groups, direction)),\n [nodes, edges, groups, direction],\n );\n // Parsed back from its JSON, so the shape is a new object only when it\n // changes, not when the parent passes equal arrays again.\n const shape = useMemo(() => JSON.parse(shapeJson) as MapShape, [shapeJson]);\n const layout = useMemo(\n () => computeLayout(shape, measured, idPrefix),\n [shape, measured, idPrefix],\n );\n const isHorizontal = direction === 'LR';\n const flowNodes = useMemo(\n (): ServiceFlowNode[] => [\n ...layout.groups,\n ...nodes.map((n): ServiceFlowNode => {\n // A node in a group is described by the group's label. React Flow\n // describes a node by its keyboard help, the element it names\n // `react-flow__node-desc-<rfId>`; a node that cannot be selected\n // has none.\n const describedBy = [\n layout.groupLabels.get(n.id),\n nodesSelectable ? `react-flow__node-desc-${flowId}` : undefined,\n ]\n .filter(Boolean)\n .join(' ');\n return {\n id: n.id,\n type: 'service',\n position: layout.positions.get(n.id) ?? { x: 0, y: 0 },\n // Handed back as applyNodeChanges would, so React Flow keeps the\n // size it measured instead of measuring the node again.\n measured: measured.get(n.id),\n ariaLabel: n.label,\n // React Flow gives only a focusable node a role, and the role\n // description below needs one.\n ariaRole: 'group',\n domAttributes: {\n 'aria-roledescription': strings.serviceMapNodeRole,\n // A group takes no aria-selected.\n 'aria-current': selectedNodeId === n.id ? true : undefined,\n 'aria-describedby': describedBy === '' ? undefined : describedBy,\n },\n data: { node: n, selected: selectedNodeId === n.id },\n sourcePosition: isHorizontal ? Position.Right : Position.Bottom,\n targetPosition: isHorizontal ? Position.Left : Position.Top,\n draggable: false,\n connectable: false,\n selectable: nodesSelectable,\n focusable: nodesSelectable,\n };\n }),\n ],\n [\n layout,\n nodes,\n measured,\n selectedNodeId,\n isHorizontal,\n nodesSelectable,\n flowId,\n strings,\n ],\n );\n const flowEdges = useMemo((): Array<Edge<ServiceEdgeData>> => {\n const labelOf = new Map(nodes.map((n) => [n.id, n.label]));\n return edges.map((e) => ({\n id: e.id,\n source: e.source,\n target: e.target,\n ariaLabel: strings.serviceMapEdgeName(\n labelOf.get(e.source) ?? e.source,\n labelOf.get(e.target) ?? e.target,\n ),\n // React Flow makes an unfocusable edge an img; aria-roledescription needs a group.\n ariaRole: 'group',\n domAttributes: { 'aria-roledescription': strings.serviceMapEdgeRole },\n type: 'service',\n data: { edge: e },\n label: e.label,\n selectable: edgesSelectable,\n focusable: edgesSelectable,\n className: `aegis-service-map__edge aegis-service-map__edge--${e.status ?? 'ok'}`,\n }));\n }, [nodes, edges, edgesSelectable, strings]);\n\n const { getNode } = useReactFlow();\n const handleNodesChange = useCallback(\n (changes: Array<NodeChange<ServiceFlowNode>>) => {\n const resized = changes.flatMap((change) =>\n change.type === 'dimensions' &&\n change.dimensions !== undefined &&\n getNode(change.id)?.type === 'service'\n ? [[change.id, change.dimensions] as const]\n : [],\n );\n setMeasured((previous) =>\n resized.every(\n ([id, size]) =>\n previous.get(id)?.width === size.width &&\n previous.get(id)?.height === size.height,\n )\n ? previous\n : new Map([...previous, ...resized]),\n );\n },\n [getNode],\n );\n\n const narrow = useMediaQuery(NARROW_QUERY);\n const showMinimap = minimap && !narrow;\n const selection = useContext(SelectedRowDetailContext);\n const fitted = useFit(\n shape,\n layout,\n nodes.every((n) => measured.has(n.id)),\n focusNodeId,\n showMinimap,\n narrow,\n );\n const shownId =\n selectedNodeId !== undefined && shape.ids.includes(selectedNodeId)\n ? selectedNodeId\n : undefined;\n // While the view moves to a new focus, the detail stays under the node it\n // was drawn under, so the map keeps its height and the page its scroll.\n const [drawnId, setDrawnId] = useState<string>();\n if (fitted && drawnId !== shownId) {\n setDrawnId(shownId);\n }\n // A DetailBeside waits while the view is fitted to a newly selected node.\n useIsomorphicLayoutEffect(() => {\n if (selection === null || shownId === undefined || fitted) {\n return undefined;\n }\n selection.awaitRow();\n return () => {\n selection.placeRow(null);\n };\n }, [selection, shownId, fitted]);\n const handleFocus = usePanToFocused();\n\n const handleNodeClick = useCallback(\n (_: unknown, n: ServiceFlowNode) => {\n if (n.type === 'service') {\n onNodeClick?.(n.data.node);\n }\n },\n [onNodeClick],\n );\n const handleEdgeClick = useCallback(\n (_: unknown, e: Edge<ServiceEdgeData>) => {\n if (e.data) {\n onEdgeClick?.(e.data.edge);\n }\n },\n [onEdgeClick],\n );\n // React Flow's own Enter and Space only change its internal selection,\n // which never reaches the host, so a focused node or edge answers the\n // keys here, as a click would.\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if ((event.key !== 'Enter' && event.key !== ' ') || event.repeat) {\n return;\n }\n const target = event.target;\n if (!(target instanceof Element)) {\n return;\n }\n const id = target.getAttribute('data-id');\n if (target.classList.contains('react-flow__node')) {\n const node = nodes.find((n) => n.id === id);\n if (node && onNodeClick) {\n event.preventDefault();\n onNodeClick(node);\n }\n } else if (target.classList.contains('react-flow__edge')) {\n const edge = edges.find((e) => e.id === id);\n if (edge && onEdgeClick) {\n event.preventDefault();\n onEdgeClick(edge);\n }\n }\n },\n [nodes, edges, onNodeClick, onEdgeClick],\n );\n\n const style = {\n ...SIZE_VARS,\n height: height === undefined ? undefined : `${String(height)}px`,\n } as CSSProperties;\n\n return (\n <div\n className={[\n 'aegis-service-map',\n fillViewport ? 'aegis-service-map--fill-viewport' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={style}\n >\n {/* Positioned over the whole box, so React Flow has a definite height\n even when the box only has its min-height. */}\n <div className=\"aegis-service-map__pane\">\n <ReactFlow\n id={flowId}\n aria-label={ariaLabel}\n nodes={flowNodes}\n edges={flowEdges}\n nodeTypes={NODE_TYPES}\n edgeTypes={EDGE_TYPES}\n minZoom={MIN_ZOOM}\n nodesDraggable={false}\n nodesConnectable={false}\n autoPanOnNodeFocus={false}\n panOnDrag\n zoomOnScroll\n proOptions={{ hideAttribution: true }}\n ariaLabelConfig={strings.serviceMapAriaLabels}\n onNodesChange={handleNodesChange}\n onNodeClick={nodesSelectable ? handleNodeClick : undefined}\n onEdgeClick={edgesSelectable ? handleEdgeClick : undefined}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n >\n <Background variant={BackgroundVariant.Dots} gap={16} size={1} />\n <Controls showInteractive={false} position=\"top-left\" />\n {showMinimap && (\n <MiniMap\n pannable\n zoomable\n position=\"bottom-right\"\n style={{ width: MINIMAP_WIDTH }}\n nodeClassName={minimapNodeClass}\n />\n )}\n </ReactFlow>\n </div>\n {selection !== null && drawnId !== undefined && (\n <ServiceMapSelection\n nodeId={drawnId}\n fitted={fitted}\n selection={selection}\n />\n )}\n </div>\n );\n}\n\nexport function ServiceMap(props: ServiceMapProps): JSX.Element {\n return (\n <ReactFlowProvider>\n <ServiceMapInner {...props} />\n </ReactFlowProvider>\n );\n}\n"],"names":["NODE_WIDTH","NODE_HEIGHT","NODE_MAX_WIDTH","GROUP_LABEL_HEIGHT","GROUP_GAP","SIZE_VARS","DEFAULT_SIZE","shapeOf","nodes","edges","groups","direction","ids","n","present","e","partsOf","claimed","grouped","group","id","rest","part","layoutPart","links","sizeOf","g","graphlib","source","target","dagreLayout","positions","x","y","size","width","height","computeLayout","shape","sizes","idPrefix","labelIdOf","horizontal","parts","laid","labelHeight","across","along","placed","origin","p","ServiceGroup","data","jsx","DOT_TONE","ServiceNode","node","selected","status","tone","jsxs","Handle","Position","StatusDot","ServiceEdge","props","sourceX","sourceY","targetX","targetY","label","markerEnd","style","pathId","useId","midX","path","Fragment","NODE_TYPES","EDGE_TYPES","NARROW_QUERY","FIT_MARGIN","MIN_ZOOM","FOCUS_ZOOM","READABLE_ZOOM","PANEL_INSET","CONTROLS_WIDTH","MINIMAP_WIDTH","px","value","neighbourhood","minimapNodeClass","useFit","layout","laidOut","focusNodeId","showMinimap","narrow","fitView","getNodes","getNodesBounds","setViewport","useReactFlow","store","useStoreApi","paneSized","useStore","state","focus","useMemo","fittedTo","setFittedTo","useState","useEffect","settle","padding","all","bounds","fitted","getViewportForBounds","zoom","first","a","b","w","h","nearFits","ServiceMapSelection","nodeId","selection","transform","domNode","useInternalNode","useIsomorphicLayoutEffect","bottom","usePanToFocused","getViewport","useCallback","event","scrollLeft","scrollTop","pane","box","left","top","ServiceMapInner","fillViewport","onNodeClick","onEdgeClick","selectedNodeId","minimap","ariaLabel","className","strings","useStrings","flowId","nodesSelectable","edgesSelectable","measured","setMeasured","shapeJson","isHorizontal","flowNodes","describedBy","flowEdges","labelOf","getNode","handleNodesChange","changes","resized","change","previous","useMediaQuery","useContext","SelectedRowDetailContext","shownId","drawnId","setDrawnId","handleFocus","handleNodeClick","_","handleEdgeClick","handleKeyDown","edge","ReactF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OAAO,OAAO,EACd,KAAK,GAAG,EACX,MAAAhF,GAIA,SAAA,CAAAnB,EAAAA,IAAC,MAAA,CAAI,UAAU,0BACb,SAAAO,EAAAA,KAAC4H,EAAAA,UAAA,CACC,GAAI7B,EACJ,aAAYJ,EACZ,MAAOW,EACP,MAAOE,EACP,UAAWtF,GACX,UAAWC,GACX,QAASG,EACT,eAAgB,GAChB,iBAAkB,GAClB,mBAAoB,GACpB,UAAS,GACT,aAAY,GACZ,WAAY,CAAE,gBAAiB,EAAA,EAC/B,gBAAiBuE,EAAQ,qBACzB,cAAec,EACf,YAAaX,EAAkBuB,GAAkB,OACjD,YAAatB,EAAkBwB,GAAkB,OACjD,UAAWC,GACX,QAASJ,GAET,SAAA,CAAA7H,MAACoI,EAAAA,YAAW,QAASC,EAAAA,kBAAkB,KAAM,IAAK,GAAI,KAAM,EAAG,EAC/DrI,EAAAA,IAACsI,EAAAA,SAAA,CAAS,gBAAiB,GAAO,SAAS,WAAW,EACrD3F,GACC3C,EAAAA,IAACuI,EAAAA,QAAA,CACC,SAAQ,GACR,SAAQ,GACR,SAAS,eACT,MAAO,CAAE,MAAOrG,EAAA,EAChB,cAAeI,EAAA,CAAA,CACjB,CAAA,CAAA,EAGN,EACCsC,IAAc,MAAQ+C,IAAY,QACjC3H,EAAAA,IAAC0E,GAAA,CACC,OAAQiD,EACR,OAAA1D,EACA,UAAAW,CAAA,CAAA,CACF,CAAA,CAAA,CAIR,CAEO,SAAS4D,GAAW5H,EAAqC,CAC9D,aACG6H,oBAAA,CACC,SAAAzI,EAAAA,IAAC4F,GAAA,CAAiB,GAAGhF,EAAO,EAC9B,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ServiceMap.cjs","sources":["../../../src/components/ui/ServiceMap.tsx"],"sourcesContent":["// Service-map composition adapted from HyperDX (MIT, DeploySentinel Inc. 2023):\n// https://github.com/hyperdxio/hyperdx/blob/main/packages/app/src/components/ServiceMap/ServiceMap.tsx\nimport {\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport {\n type EdgeLabel,\n type GraphLabel,\n type NodeLabel,\n layout as dagreLayout,\n graphlib,\n} from '@dagrejs/dagre';\nimport {\n Background,\n BackgroundVariant,\n Controls,\n type Edge,\n type EdgeProps,\n Handle,\n MiniMap,\n type Node,\n type NodeChange,\n type NodeProps,\n Position,\n ReactFlow,\n ReactFlowProvider,\n type XYPosition,\n getViewportForBounds,\n useInternalNode,\n useReactFlow,\n useStore,\n useStoreApi,\n} from '@xyflow/react';\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useStrings } from '../../locale';\nimport './ServiceMap.css';\nimport { StatusDot } from './StatusDot';\nimport {\n type SelectedRowDetail,\n SelectedRowDetailContext,\n} from './selectedRowDetail';\nimport { type WorkStatus, workStatusDot } from './workStatus';\n\n/**\n * Drawn as a dot before the node's label. `active` is work in progress, e.g.\n * a running task: the ink dot pulses.\n */\nexport type ServiceMapStatus = WorkStatus;\nexport type ServiceMapDirection = 'LR' | 'TB';\n\nexport interface ServiceMapNode {\n id: string;\n label: string;\n sublabel?: string;\n status?: ServiceMapStatus;\n badge?: number | string;\n data?: Record<string, unknown>;\n}\n\n/**\n * A labelled box around some nodes, e.g. the tasks of one phase. Its id may\n * also be a node's id.\n */\nexport interface ServiceMapGroup {\n id: string;\n label: string;\n nodeIds: string[];\n}\n\n/** For assistive technology, named by its nodes' labels, e.g. \"checkout to payments\". */\nexport interface ServiceMapEdge {\n id: string;\n source: string;\n target: string;\n label?: string;\n /** `active` is a node's state only. */\n status?: Exclude<ServiceMapStatus, 'active'>;\n}\n\nexport interface ServiceMapProps {\n nodes: ServiceMapNode[];\n edges: ServiceMapEdge[];\n /**\n * Boxes drawn around groups of nodes, e.g. the phases of a pipeline. The\n * groups follow one another along `direction` in the order given, each\n * laid out on its own; nodes in no group come after the last group. A\n * node belongs to the first group that lists it.\n */\n groups?: ServiceMapGroup[];\n direction?: ServiceMapDirection;\n /** Height in px. Default: the container's height, at least `--service-map-min-height`. */\n height?: number;\n /**\n * Fill the viewport's height below the shell header\n * (`--service-map-viewport-height`), for a page whose main view is the\n * map. At 768 px and below the map keeps its default height, so a touch\n * can still scroll the page past it. `height` overrides it.\n */\n fillViewport?: boolean;\n /**\n * Called when a node is clicked, or gets Enter or Space while focused.\n * Without it nodes can be neither focused nor selected.\n */\n onNodeClick?: (node: ServiceMapNode) => void;\n /** The same for edges. */\n onEdgeClick?: (edge: ServiceMapEdge) => void;\n /** Drawn inverted, and `aria-current` for assistive technology. */\n selectedNodeId?: string;\n /**\n * Opens at actual size on this node instead of fitting the whole map, and\n * again whenever it changes: fitted to the node and the nodes it has a\n * direct edge to or from when they fit at actual size, otherwise centred\n * on the node alone. Large maps stay readable when they open. An id that\n * is not on the map is ignored.\n *\n * Without it the map opens fitted whole. At 768 px and below a map that\n * fits only below a readable size opens at the smallest readable zoom on\n * its start instead, the left edge for `LR` and the top for `TB`, to be\n * panned from there.\n */\n focusNodeId?: string;\n /**\n * Show the minimap in the bottom-right corner. A fit keeps its strip on\n * the right clear, so a map fitted whole opens with no node under it.\n * Default: shown unless `focusNodeId` is given, since a focused view runs\n * past every edge of the map and the minimap would cover nodes there. It\n * is not shown at 768 px and below.\n */\n minimap?: boolean;\n /**\n * The map's accessible name. Each node is a `group` named by its label\n * and, in a group, described by the group's label; a group's box is not\n * a `group`.\n */\n ariaLabel?: string;\n className?: string;\n}\n\ninterface ServiceNodeData extends Record<string, unknown> {\n node: ServiceMapNode;\n selected: boolean;\n}\n\ninterface ServiceGroupData extends Record<string, unknown> {\n label: string;\n /** The label's element id, which the group's nodes are described by. */\n labelId: string;\n}\n\ntype ServiceFlowNode =\n | Node<ServiceNodeData, 'service'>\n | Node<ServiceGroupData, 'serviceGroup'>;\n\ninterface ServiceEdgeData extends Record<string, unknown> {\n edge: ServiceMapEdge;\n}\n\n/** A node is at least this size; it widens with its label up to NODE_MAX_WIDTH, then wraps it. */\nconst NODE_WIDTH = 180;\nconst NODE_HEIGHT = 64;\nconst NODE_MAX_WIDTH = 320;\n/** Room above a group's nodes for its label. */\nconst GROUP_LABEL_HEIGHT = 28;\n/** Space between consecutive groups along the direction. */\nconst GROUP_GAP = 64;\n\n// The layout reads these sizes, so the CSS node and group boxes read them too.\nconst SIZE_VARS = {\n '--aegis-service-map-node-w': `${String(NODE_WIDTH)}px`,\n '--aegis-service-map-node-h': `${String(NODE_HEIGHT)}px`,\n '--aegis-service-map-node-max-w': `${String(NODE_MAX_WIDTH)}px`,\n '--aegis-service-map-group-label-h': `${String(GROUP_LABEL_HEIGHT)}px`,\n};\n\ninterface Size {\n width: number;\n height: number;\n}\n\nconst DEFAULT_SIZE: Size = { width: NODE_WIDTH, height: NODE_HEIGHT };\n\n/** A stretch of the map laid out on its own: a group's nodes, or the nodes in no group. */\ninterface Part {\n group?: ServiceMapGroup;\n ids: string[];\n}\n\n/** What the layout and the fit read: the map without its nodes' and edges' content. */\ninterface MapShape {\n direction: ServiceMapDirection;\n ids: string[];\n /** The endpoints of each edge between two nodes on the map. */\n links: Array<[string, string]>;\n groups: ServiceMapGroup[];\n}\n\nfunction shapeOf(\n nodes: ServiceMapNode[],\n edges: ServiceMapEdge[],\n groups: ServiceMapGroup[],\n direction: ServiceMapDirection,\n): MapShape {\n const ids = nodes.map((n) => n.id);\n const present = new Set(ids);\n return {\n direction,\n ids,\n links: edges\n .filter((e) => present.has(e.source) && present.has(e.target))\n .map((e) => [e.source, e.target]),\n groups,\n };\n}\n\n/** Each group with the nodes it claims, in the order given, then the nodes in no group. */\nfunction partsOf(ids: string[], groups: ServiceMapGroup[]): Part[] {\n const present = new Set(ids);\n const claimed = new Set<string>();\n const grouped = groups.map((group) => {\n const ids = [...new Set(group.nodeIds)].filter(\n (id) => present.has(id) && !claimed.has(id),\n );\n ids.forEach((id) => claimed.add(id));\n return { group, ids };\n });\n const rest = ids.filter((id) => !claimed.has(id));\n return [...grouped, { ids: rest }].filter((part) => part.ids.length > 0);\n}\n\n/** Lays out one part with dagre: its nodes and the edges between them. Positions are top-left corners. */\nfunction layoutPart(\n ids: string[],\n links: MapShape['links'],\n direction: ServiceMapDirection,\n sizeOf: (id: string) => Size,\n): { positions: Map<string, XYPosition>; width: number; height: number } {\n const g = new graphlib.Graph<GraphLabel, NodeLabel, EdgeLabel>();\n g.setDefaultEdgeLabel(() => ({}));\n g.setGraph({\n rankdir: direction,\n nodesep: 40,\n ranksep: 80,\n marginx: 16,\n marginy: 16,\n });\n for (const id of ids) {\n g.setNode(id, { ...sizeOf(id) });\n }\n for (const [source, target] of links) {\n if (g.hasNode(source) && g.hasNode(target)) {\n g.setEdge(source, target);\n }\n }\n dagreLayout(g);\n const positions = new Map(\n ids.map((id) => {\n const { x = 0, y = 0 } = g.node(id) as { x?: number; y?: number };\n const size = sizeOf(id);\n return [id, { x: x - size.width / 2, y: y - size.height / 2 }];\n }),\n );\n const { width = 0, height = 0 } = g.graph();\n return { positions, width, height };\n}\n\ninterface MapLayout {\n /** The group boxes. */\n groups: ServiceFlowNode[];\n /** Each node's top-left corner. */\n positions: Map<string, XYPosition>;\n /** The label id of the group each grouped node is in. */\n groupLabels: Map<string, string>;\n}\n\n/**\n * Lays the parts out one after another along the direction, each centred\n * across it, with dagre inside each part.\n */\nfunction computeLayout(\n shape: MapShape,\n sizes: ReadonlyMap<string, Size>,\n idPrefix: string,\n): MapLayout {\n const labelIdOf = (group: ServiceMapGroup): string =>\n `${idPrefix}-group-${String(shape.groups.indexOf(group))}`;\n const horizontal = shape.direction === 'LR';\n const parts = partsOf(shape.ids, shape.groups).map((part) => {\n const laid = layoutPart(part.ids, shape.links, shape.direction, (id) => {\n return sizes.get(id) ?? DEFAULT_SIZE;\n });\n const labelHeight = part.group === undefined ? 0 : GROUP_LABEL_HEIGHT;\n return {\n ...part,\n ...laid,\n labelHeight,\n boxHeight: laid.height + labelHeight,\n };\n });\n const across = Math.max(\n 0,\n ...parts.map((part) => (horizontal ? part.boxHeight : part.width)),\n );\n let along = 0;\n const placed = parts.map((part) => {\n const origin = horizontal\n ? { x: along, y: (across - part.boxHeight) / 2 }\n : { x: (across - part.width) / 2, y: along };\n along += (horizontal ? part.width : part.boxHeight) + GROUP_GAP;\n return { ...part, origin };\n });\n return {\n groups: placed.flatMap((part): ServiceFlowNode[] =>\n part.group === undefined\n ? []\n : [\n {\n // Prefixed, so a group may share an id with a node.\n id: `group:${part.group.id}`,\n type: 'serviceGroup',\n position: part.origin,\n width: part.width,\n height: part.boxHeight,\n data: {\n label: part.group.label,\n labelId: labelIdOf(part.group),\n },\n // Not a group for assistive technology: the box contains no\n // nodes in the DOM, so its label is plain text, which its\n // nodes are described by. It cannot be focused, so it has no\n // keyboard help either.\n domAttributes: {\n 'aria-roledescription': undefined,\n 'aria-describedby': undefined,\n },\n // Under the edges, and letting clicks through to them: React\n // Flow gives every node's wrapper pointer events once the map\n // has onNodeClick.\n zIndex: -1,\n style: { pointerEvents: 'none' },\n draggable: false,\n connectable: false,\n selectable: false,\n focusable: false,\n },\n ],\n ),\n positions: new Map(\n placed.flatMap((part) =>\n [...part.positions].map(([id, p]) => [\n id,\n {\n x: part.origin.x + p.x,\n y: part.origin.y + part.labelHeight + p.y,\n },\n ]),\n ),\n ),\n groupLabels: new Map(\n placed.flatMap((part) => {\n const { group } = part;\n return group === undefined\n ? []\n : part.ids.map((id) => [id, labelIdOf(group)] as const);\n }),\n ),\n };\n}\n\nfunction ServiceGroup({\n data,\n}: NodeProps<Node<ServiceGroupData, 'serviceGroup'>>): JSX.Element {\n return (\n <div className=\"aegis-service-map__group\">\n <span id={data.labelId} className=\"aegis-service-map__group-label\">\n {data.label}\n </span>\n </div>\n );\n}\n\nfunction ServiceNode({\n data,\n}: NodeProps<Node<ServiceNodeData, 'service'>>): JSX.Element {\n const { node, selected } = data;\n const status = node.status ?? 'ok';\n return (\n <div\n className={[\n 'aegis-service-map__node',\n `aegis-service-map__node--${status}`,\n selected ? 'aegis-service-map__node--selected' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <Handle\n type=\"target\"\n position={Position.Left}\n className=\"aegis-service-map__handle\"\n />\n <div className=\"aegis-service-map__node-body\">\n <div className=\"aegis-service-map__node-label\">\n <StatusDot {...workStatusDot(status, selected)} />\n <span className=\"aegis-service-map__node-label-text\">\n {node.label}\n </span>\n </div>\n {node.sublabel !== undefined && (\n <div className=\"aegis-service-map__node-sublabel\">\n {node.sublabel}\n </div>\n )}\n </div>\n {node.badge !== undefined && node.badge !== '' && (\n <span\n className={`aegis-service-map__node-badge aegis-service-map__node-badge--${status}`}\n >\n {node.badge}\n </span>\n )}\n <Handle\n type=\"source\"\n position={Position.Right}\n className=\"aegis-service-map__handle\"\n />\n </div>\n );\n}\n\nfunction ServiceEdge(props: EdgeProps<Edge<ServiceEdgeData>>): JSX.Element {\n const { sourceX, sourceY, targetX, targetY, label, markerEnd, style } = props;\n // The label follows the path by its id, which must be unique on the page,\n // also when two maps share edge ids.\n const pathId = useId();\n const midX = (sourceX + targetX) / 2;\n const path = `M${sourceX},${sourceY} C${midX},${sourceY} ${midX},${targetY} ${targetX},${targetY}`;\n return (\n <>\n {/* The focus ring, drawn along the path under it. */}\n <path d={path} className=\"aegis-service-map__edge-focus\" fill=\"none\" />\n <path\n id={pathId}\n d={path}\n className=\"aegis-service-map__edge-path\"\n markerEnd={markerEnd}\n style={style}\n fill=\"none\"\n />\n {label !== undefined && label !== '' && (\n <text className=\"aegis-service-map__edge-label\">\n <textPath href={`#${pathId}`} startOffset=\"50%\" textAnchor=\"middle\">\n {label}\n </textPath>\n </text>\n )}\n </>\n );\n}\n\nconst NODE_TYPES = { service: ServiceNode, serviceGroup: ServiceGroup };\nconst EDGE_TYPES = { service: ServiceEdge };\n\nconst NARROW_QUERY = '(max-width: 768px)';\n/** Space kept clear around fitted nodes, in px. */\nconst FIT_MARGIN = 24;\n/** Low enough that fitting the whole map fits it, so the minimap's strip stays clear. */\nconst MIN_ZOOM = 0.1;\n/** A focused map opens at this zoom, so its labels are readable. */\nconst FOCUS_ZOOM = 1;\n/** The smallest zoom a narrow map opens at: a node's 13 px label reads at 11 px. */\nconst READABLE_ZOOM = 11 / 13;\n// React Flow draws the controls and the minimap in panels inset by 15 px. A\n// control button is 26 px, 28 inside the controls' hairline border.\nconst PANEL_INSET = 15;\nconst CONTROLS_WIDTH = 28;\nconst MINIMAP_WIDTH = 200;\n\n/** A fit padding in px; React Flow reads a bare number as a fraction of the view. */\nconst px = (value: number): `${number}px` => `${value}px`;\n\n/** A node with the nodes it has a direct edge to or from. */\nfunction neighbourhood(id: string, links: MapShape['links']): string[] {\n return [\n ...new Set([\n id,\n ...links.filter(([source]) => source === id).map(([, target]) => target),\n ...links.filter(([, target]) => target === id).map(([source]) => source),\n ]),\n ];\n}\n\n/** The minimap draws groups as outlines, so the nodes inside them stay visible. */\nfunction minimapNodeClass(node: Node): string {\n return node.type === 'serviceGroup' ? 'aegis-service-map__minimap-group' : '';\n}\n\n/**\n * Fits the view once the layout uses every node's measured size, and again\n * when the layout or the focus changes. Nothing else moves the view, so a\n * new status or selection keeps the user's pan and zoom. Returns whether\n * the view has been fitted to the current focus.\n */\nfunction useFit(\n shape: MapShape,\n layout: MapLayout,\n laidOut: boolean,\n focusNodeId: string | undefined,\n showMinimap: boolean,\n narrow: boolean,\n): boolean {\n const { fitView, getNodes, getNodesBounds, setViewport } = useReactFlow();\n const store = useStoreApi();\n const paneSized = useStore((state) => state.width > 0 && state.height > 0);\n const focus = useMemo(\n () =>\n focusNodeId !== undefined && shape.ids.includes(focusNodeId)\n ? { id: focusNodeId, near: neighbourhood(focusNodeId, shape.links) }\n : undefined,\n [focusNodeId, shape],\n );\n const [fittedTo, setFittedTo] = useState<string | null>();\n useEffect(() => {\n if (paneSized && laidOut) {\n const settle = (): void => {\n setFittedTo(focus?.id ?? null);\n };\n const padding = {\n top: px(FIT_MARGIN),\n bottom: px(FIT_MARGIN),\n left: px(PANEL_INSET + CONTROLS_WIDTH + FIT_MARGIN),\n right: px(\n showMinimap ? PANEL_INSET + MINIMAP_WIDTH + FIT_MARGIN : FIT_MARGIN,\n ),\n };\n const { width, height } = store.getState();\n if (focus === undefined) {\n const all = getNodes();\n const bounds = getNodesBounds(all);\n const fitted = getViewportForBounds(\n bounds,\n width,\n height,\n MIN_ZOOM,\n 1,\n padding,\n );\n if (narrow && fitted.zoom < READABLE_ZOOM) {\n // A phone has no minimap and too little room for the whole map,\n // so it opens where the map starts, on its first node.\n const zoom = READABLE_ZOOM;\n const horizontal = shape.direction === 'LR';\n const along = (n: Node): number =>\n horizontal ? n.position.x : n.position.y;\n const first = all\n .filter((n) => n.type === 'service')\n .reduce((a, b) => (along(b) < along(a) ? b : a));\n const { width: w = NODE_WIDTH, height: h = NODE_HEIGHT } =\n first.measured ?? {};\n void setViewport(\n horizontal\n ? {\n x:\n PANEL_INSET + CONTROLS_WIDTH + FIT_MARGIN - bounds.x * zoom,\n y: height / 2 - (first.position.y + h / 2) * zoom,\n zoom,\n }\n : {\n x: width / 2 - (first.position.x + w / 2) * zoom,\n y: FIT_MARGIN - bounds.y * zoom,\n zoom,\n },\n ).then(settle);\n } else {\n void fitView({ maxZoom: 1, padding }).then(settle);\n }\n } else {\n const nearFits =\n getViewportForBounds(\n getNodesBounds(focus.near),\n width,\n height,\n MIN_ZOOM,\n FOCUS_ZOOM,\n padding,\n ).zoom >= FOCUS_ZOOM;\n void fitView({\n nodes: (nearFits ? focus.near : [focus.id]).map((id) => ({ id })),\n minZoom: FOCUS_ZOOM,\n maxZoom: FOCUS_ZOOM,\n padding,\n }).then(settle);\n }\n }\n }, [\n paneSized,\n laidOut,\n layout,\n focus,\n showMinimap,\n narrow,\n shape.direction,\n store,\n fitView,\n getNodes,\n getNodesBounds,\n setViewport,\n ]);\n return fittedTo === (focus?.id ?? null);\n}\n\n/**\n * The selected node of a map in a `DetailBeside`: once the view is fitted\n * it places the node's box, again whenever the map pans or zooms, and at\n * 768 px and below draws the detail right under the node, over the map,\n * which grows to hold it.\n */\nfunction ServiceMapSelection({\n nodeId,\n fitted,\n selection,\n}: {\n nodeId: string;\n fitted: boolean;\n selection: SelectedRowDetail;\n}): JSX.Element | null {\n const transform = useStore((state) => state.transform);\n const domNode = useStore((state) => state.domNode);\n const node = useInternalNode(nodeId);\n // The node goes only with this component, so a pan places the same node\n // again rather than a new one.\n useIsomorphicLayoutEffect(\n () => () => {\n selection.placeRow(null);\n },\n [selection],\n );\n useIsomorphicLayoutEffect(() => {\n const group = domNode?.querySelector(\n `.react-flow__node[data-id=\"${CSS.escape(nodeId)}\"]`,\n );\n if (fitted && group instanceof HTMLElement) {\n selection.placeRow(group);\n }\n }, [selection, domNode, nodeId, transform, fitted]);\n const height = node?.measured.height;\n if (selection.inline === null || node === undefined || height === undefined) {\n return null;\n }\n const [, y, zoom] = transform;\n const bottom = (node.internals.positionAbsolute.y + height) * zoom + y;\n return (\n <div\n className=\"aegis-service-map__detail\"\n style={{ marginTop: Math.max(bottom, 0) }}\n >\n {selection.inline}\n </div>\n );\n}\n\n/**\n * Pans a node or edge that gets keyboard focus fully into view, centred.\n * React Flow pans only to a node entirely outside the view, and never to\n * an edge.\n */\nfunction usePanToFocused(): (event: FocusEvent<HTMLDivElement>) => void {\n const { getViewport, setViewport } = useReactFlow();\n return useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n const target = event.target;\n if (\n !(target instanceof Element) ||\n !target.matches(\n '.react-flow__node:focus-visible, .react-flow__edge:focus-visible',\n )\n ) {\n return;\n }\n // The browser has already scrolled the pane to the element, and React\n // Flow scrolls it back, so the offset is added back to place it.\n const { scrollLeft, scrollTop } = event.currentTarget;\n const pane = event.currentTarget.getBoundingClientRect();\n const box = target.getBoundingClientRect();\n const left = box.left - pane.left + scrollLeft;\n const top = box.top - pane.top + scrollTop;\n if (\n left >= 0 &&\n top >= 0 &&\n left + box.width <= pane.width &&\n top + box.height <= pane.height\n ) {\n return;\n }\n const { x, y, zoom } = getViewport();\n void setViewport({\n x: x + pane.width / 2 - (left + box.width / 2),\n y: y + pane.height / 2 - (top + box.height / 2),\n zoom,\n });\n },\n [getViewport, setViewport],\n );\n}\n\nfunction ServiceMapInner({\n nodes,\n edges,\n groups = [],\n direction = 'LR',\n height,\n fillViewport = false,\n onNodeClick,\n onEdgeClick,\n selectedNodeId,\n focusNodeId,\n minimap = focusNodeId === undefined,\n ariaLabel,\n className,\n}: ServiceMapProps): JSX.Element {\n const strings = useStrings();\n const idPrefix = useId();\n // React Flow names its elements after this id ('1' when none is given),\n // so each map passes its own and a page can hold several.\n const flowId = `aegis-service-map${idPrefix.replace(/:/g, '-')}`;\n const nodesSelectable = onNodeClick !== undefined;\n const edgesSelectable = onEdgeClick !== undefined;\n // Node sizes as React Flow measured them; the layout reads them, so a\n // node can be as wide as its label.\n const [measured, setMeasured] = useState<ReadonlyMap<string, Size>>(\n () => new Map(),\n );\n const shapeJson = useMemo(\n () => JSON.stringify(shapeOf(nodes, edges, groups, direction)),\n [nodes, edges, groups, direction],\n );\n // Parsed back from its JSON, so the shape is a new object only when it\n // changes, not when the parent passes equal arrays again.\n const shape = useMemo(() => JSON.parse(shapeJson) as MapShape, [shapeJson]);\n const layout = useMemo(\n () => computeLayout(shape, measured, idPrefix),\n [shape, measured, idPrefix],\n );\n const isHorizontal = direction === 'LR';\n const flowNodes = useMemo(\n (): ServiceFlowNode[] => [\n ...layout.groups,\n ...nodes.map((n): ServiceFlowNode => {\n // A node in a group is described by the group's label. React Flow\n // describes a node by its keyboard help, the element it names\n // `react-flow__node-desc-<rfId>`; a node that cannot be selected\n // has none.\n const describedBy = [\n layout.groupLabels.get(n.id),\n nodesSelectable ? `react-flow__node-desc-${flowId}` : undefined,\n ]\n .filter(Boolean)\n .join(' ');\n return {\n id: n.id,\n type: 'service',\n position: layout.positions.get(n.id) ?? { x: 0, y: 0 },\n // Handed back as applyNodeChanges would, so React Flow keeps the\n // size it measured instead of measuring the node again.\n measured: measured.get(n.id),\n ariaLabel: n.label,\n // React Flow gives only a focusable node a role, and the role\n // description below needs one.\n ariaRole: 'group',\n domAttributes: {\n 'aria-roledescription': strings.serviceMapNodeRole,\n // A group takes no aria-selected.\n 'aria-current': selectedNodeId === n.id ? true : undefined,\n 'aria-describedby': describedBy === '' ? undefined : describedBy,\n },\n data: { node: n, selected: selectedNodeId === n.id },\n sourcePosition: isHorizontal ? Position.Right : Position.Bottom,\n targetPosition: isHorizontal ? Position.Left : Position.Top,\n draggable: false,\n connectable: false,\n selectable: nodesSelectable,\n focusable: nodesSelectable,\n };\n }),\n ],\n [\n layout,\n nodes,\n measured,\n selectedNodeId,\n isHorizontal,\n nodesSelectable,\n flowId,\n strings,\n ],\n );\n const flowEdges = useMemo((): Array<Edge<ServiceEdgeData>> => {\n const labelOf = new Map(nodes.map((n) => [n.id, n.label]));\n return edges.map((e) => ({\n id: e.id,\n source: e.source,\n target: e.target,\n ariaLabel: strings.serviceMapEdgeName(\n labelOf.get(e.source) ?? e.source,\n labelOf.get(e.target) ?? e.target,\n ),\n // React Flow makes an unfocusable edge an img; aria-roledescription needs a group.\n ariaRole: 'group',\n domAttributes: { 'aria-roledescription': strings.serviceMapEdgeRole },\n type: 'service',\n data: { edge: e },\n label: e.label,\n selectable: edgesSelectable,\n focusable: edgesSelectable,\n className: `aegis-service-map__edge aegis-service-map__edge--${e.status ?? 'ok'}`,\n }));\n }, [nodes, edges, edgesSelectable, strings]);\n\n const { getNode } = useReactFlow();\n const handleNodesChange = useCallback(\n (changes: Array<NodeChange<ServiceFlowNode>>) => {\n const resized = changes.flatMap((change) =>\n change.type === 'dimensions' &&\n change.dimensions !== undefined &&\n getNode(change.id)?.type === 'service'\n ? [[change.id, change.dimensions] as const]\n : [],\n );\n setMeasured((previous) =>\n resized.every(\n ([id, size]) =>\n previous.get(id)?.width === size.width &&\n previous.get(id)?.height === size.height,\n )\n ? previous\n : new Map([...previous, ...resized]),\n );\n },\n [getNode],\n );\n\n const narrow = useMediaQuery(NARROW_QUERY);\n const showMinimap = minimap && !narrow;\n const selection = useContext(SelectedRowDetailContext);\n const fitted = useFit(\n shape,\n layout,\n nodes.every((n) => measured.has(n.id)),\n focusNodeId,\n showMinimap,\n narrow,\n );\n const shownId =\n selectedNodeId !== undefined && shape.ids.includes(selectedNodeId)\n ? selectedNodeId\n : undefined;\n // While the view moves to a new focus, the detail stays under the node it\n // was drawn under, so the map keeps its height and the page its scroll.\n const [drawnId, setDrawnId] = useState<string>();\n if (fitted && drawnId !== shownId) {\n setDrawnId(shownId);\n }\n // A DetailBeside waits while the view is fitted to a newly selected node.\n useIsomorphicLayoutEffect(() => {\n if (selection === null || shownId === undefined || fitted) {\n return undefined;\n }\n selection.awaitRow();\n return () => {\n selection.placeRow(null);\n };\n }, [selection, shownId, fitted]);\n const handleFocus = usePanToFocused();\n\n const handleNodeClick = useCallback(\n (_: unknown, n: ServiceFlowNode) => {\n if (n.type === 'service') {\n onNodeClick?.(n.data.node);\n }\n },\n [onNodeClick],\n );\n const handleEdgeClick = useCallback(\n (_: unknown, e: Edge<ServiceEdgeData>) => {\n if (e.data) {\n onEdgeClick?.(e.data.edge);\n }\n },\n [onEdgeClick],\n );\n // React Flow's own Enter and Space only change its internal selection,\n // which never reaches the host, so a focused node or edge answers the\n // keys here, as a click would.\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if ((event.key !== 'Enter' && event.key !== ' ') || event.repeat) {\n return;\n }\n const target = event.target;\n if (!(target instanceof Element)) {\n return;\n }\n const id = target.getAttribute('data-id');\n if (target.classList.contains('react-flow__node')) {\n const node = nodes.find((n) => n.id === id);\n if (node && onNodeClick) {\n event.preventDefault();\n onNodeClick(node);\n }\n } else if (target.classList.contains('react-flow__edge')) {\n const edge = edges.find((e) => e.id === id);\n if (edge && onEdgeClick) {\n event.preventDefault();\n onEdgeClick(edge);\n }\n }\n },\n [nodes, edges, onNodeClick, onEdgeClick],\n );\n\n const style = {\n ...SIZE_VARS,\n height: height === undefined ? undefined : `${String(height)}px`,\n } as CSSProperties;\n\n return (\n <div\n className={[\n 'aegis-service-map',\n fillViewport ? 'aegis-service-map--fill-viewport' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={style}\n >\n {/* Positioned over the whole box, so React Flow has a definite height\n even when the box only has its min-height. */}\n <div className=\"aegis-service-map__pane\">\n <ReactFlow\n id={flowId}\n aria-label={ariaLabel}\n nodes={flowNodes}\n edges={flowEdges}\n nodeTypes={NODE_TYPES}\n edgeTypes={EDGE_TYPES}\n minZoom={MIN_ZOOM}\n nodesDraggable={false}\n nodesConnectable={false}\n autoPanOnNodeFocus={false}\n panOnDrag\n zoomOnScroll\n proOptions={{ hideAttribution: true }}\n ariaLabelConfig={strings.serviceMapAriaLabels}\n onNodesChange={handleNodesChange}\n onNodeClick={nodesSelectable ? handleNodeClick : undefined}\n onEdgeClick={edgesSelectable ? handleEdgeClick : undefined}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n >\n <Background variant={BackgroundVariant.Dots} gap={16} size={1} />\n <Controls showInteractive={false} position=\"top-left\" />\n {showMinimap && (\n <MiniMap\n pannable\n zoomable\n position=\"bottom-right\"\n style={{ width: MINIMAP_WIDTH }}\n nodeClassName={minimapNodeClass}\n />\n )}\n </ReactFlow>\n </div>\n {selection !== null && drawnId !== undefined && (\n <ServiceMapSelection\n nodeId={drawnId}\n fitted={fitted}\n selection={selection}\n />\n )}\n </div>\n );\n}\n\nexport function ServiceMap(props: ServiceMapProps): JSX.Element {\n return (\n <ReactFlowProvider>\n <ServiceMapInner {...props} />\n </ReactFlowProvider>\n );\n}\n"],"names":["NODE_WIDTH","NODE_HEIGHT","NODE_MAX_WIDTH","GROUP_LABEL_HEIGHT","GROUP_GAP","SIZE_VARS","DEFAULT_SIZE","shapeOf","nodes","edges","groups","direction","ids","n","present","e","partsOf","claimed","grouped","group","id","rest","part","layoutPart","links","sizeOf","g","graphlib","source","target","dagreLayout","positions","x","y","size","width","height","computeLayout","shape","sizes","idPrefix","labelIdOf","horizontal","parts","laid","labelHeight","across","along","placed","origin","p","ServiceGroup","data","jsx","ServiceNode","node","selected","status","jsxs","Handle","Position","StatusDot","workStatusDot","ServiceEdge","props","sourceX","sourceY","targetX","targetY","label","markerEnd","style","pathId","useId","midX","path","Fragment","NODE_TYPES","EDGE_TYPES","NARROW_QUERY","FIT_MARGIN","MIN_ZOOM","FOCUS_ZOOM","READABLE_ZOOM","PANEL_INSET","CONTROLS_WIDTH","MINIMAP_WIDTH","px","value","neighbourhood","minimapNodeClass","useFit","layout","laidOut","focusNodeId","showMinimap","narrow","fitView","getNodes","getNodesBounds","setViewport","useReactFlow","store","useStoreApi","paneSized","useStore","state","focus","useMemo","fittedTo","setFittedTo","useState","useEffect","settle","padding","all","bounds","fitted","getViewportForBounds","zoom","first","a","b","w","h","nearFits","ServiceMapSelection","nodeId","selection","transform","domNode","useInternalNode","useIsomorphicLayoutEffect","bottom","usePanToFocused","getViewport","useCallback","event","scrollLeft","scrollTop","pane","box","left","top","ServiceMapInner","fillViewport","onNodeClick","onEdgeClick","selectedNodeId","minimap","ariaLabel","className","strings","useStrings","flowId","nodesSelectable","edgesSelectable","measured","setMeasured","shapeJson","isHorizontal","flowNodes","describedBy","flowEdges","labelOf","getNode","handleNodesChange","changes","resized","change","previous","useMediaQuery","useContext","SelectedRowDetailContext","shownId","drawnId","setDrawnId","handleFocus","handleNodeClick","_","handleEdgeClick","handleKeyDown","edge","ReactFlow","Background","BackgroundVariant","Controls","MiniMap","ServiceMap","ReactFlowProvider"],"mappings":"qdAyKMA,EAAa,IACbC,EAAc,GACdC,GAAiB,IAEjBC,EAAqB,GAErBC,GAAY,GAGZC,GAAY,CAChB,6BAA8B,GAAG,OAAOL,CAAU,CAAC,KACnD,6BAA8B,GAAG,OAAOC,CAAW,CAAC,KACpD,iCAAkC,GAAG,OAAOC,EAAc,CAAC,KAC3D,oCAAqC,GAAG,OAAOC,CAAkB,CAAC,IACpE,EA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,QAASJ,GAET,SAAA,CAAA5H,MAACmI,EAAAA,YAAW,QAASC,EAAAA,kBAAkB,KAAM,IAAK,GAAI,KAAM,EAAG,EAC/DpI,EAAAA,IAACqI,EAAAA,SAAA,CAAS,gBAAiB,GAAO,SAAS,WAAW,EACrD3F,GACC1C,EAAAA,IAACsI,EAAAA,QAAA,CACC,SAAQ,GACR,SAAQ,GACR,SAAS,eACT,MAAO,CAAE,MAAOrG,EAAA,EAChB,cAAeI,EAAA,CAAA,CACjB,CAAA,CAAA,EAGN,EACCsC,IAAc,MAAQ+C,IAAY,QACjC1H,EAAAA,IAACyE,GAAA,CACC,OAAQiD,EACR,OAAA1D,EACA,UAAAW,CAAA,CAAA,CACF,CAAA,CAAA,CAIR,CAEO,SAAS4D,GAAW5H,EAAqC,CAC9D,aACG6H,oBAAA,CACC,SAAAxI,EAAAA,IAAC2F,GAAA,CAAiB,GAAGhF,EAAO,EAC9B,CAEJ"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { WorkStatus } from './workStatus';
|
|
1
2
|
/**
|
|
2
3
|
* Drawn as a dot before the node's label. `active` is work in progress, e.g.
|
|
3
4
|
* a running task: the ink dot pulses.
|
|
4
5
|
*/
|
|
5
|
-
export type ServiceMapStatus =
|
|
6
|
+
export type ServiceMapStatus = WorkStatus;
|
|
6
7
|
export type ServiceMapDirection = 'LR' | 'TB';
|
|
7
8
|
export interface ServiceMapNode {
|
|
8
9
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as u, jsxs as H, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { useId as ne, useState as Y, useMemo as
|
|
2
|
+
import { useId as ne, useState as Y, useMemo as T, useCallback as z, useContext as fe, useEffect as he } from "react";
|
|
3
3
|
import { graphlib as ve, layout as be } from "@dagrejs/dagre";
|
|
4
4
|
import { ReactFlowProvider as _e, Position as A, useReactFlow as Q, ReactFlow as we, Background as ye, BackgroundVariant as xe, Controls as Se, MiniMap as Ne, useStoreApi as Me, useStore as X, getViewportForBounds as te, Handle as oe, useInternalNode as Ee } from "@xyflow/react";
|
|
5
5
|
import { useIsomorphicLayoutEffect as J } from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
@@ -7,14 +7,15 @@ import { useMediaQuery as Re } from "../../hooks/useMediaQuery.js";
|
|
|
7
7
|
/* empty css */
|
|
8
8
|
import { StatusDot as Oe } from "./StatusDot.js";
|
|
9
9
|
import { SelectedRowDetailContext as Le } from "./selectedRowDetail.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import { workStatusDot as $e } from "./workStatus.js";
|
|
11
|
+
import { useStrings as De } from "../../locale/useStrings.js";
|
|
12
|
+
const q = 180, ee = 64, Te = 320, ae = 28, Ae = 64, He = {
|
|
12
13
|
"--aegis-service-map-node-w": `${String(q)}px`,
|
|
13
14
|
"--aegis-service-map-node-h": `${String(ee)}px`,
|
|
14
|
-
"--aegis-service-map-node-max-w": `${String(
|
|
15
|
+
"--aegis-service-map-node-max-w": `${String(Te)}px`,
|
|
15
16
|
"--aegis-service-map-group-label-h": `${String(ae)}px`
|
|
16
|
-
},
|
|
17
|
-
function
|
|
17
|
+
}, Ie = { width: q, height: ee };
|
|
18
|
+
function Pe(e, n, i, a) {
|
|
18
19
|
const r = e.map((o) => o.id), p = new Set(r);
|
|
19
20
|
return {
|
|
20
21
|
direction: a,
|
|
@@ -23,7 +24,7 @@ function Ie(e, n, i, a) {
|
|
|
23
24
|
groups: i
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function Fe(e, n) {
|
|
27
28
|
const i = new Set(e), a = /* @__PURE__ */ new Set(), r = n.map((o) => {
|
|
28
29
|
const l = [...new Set(o.nodeIds)].filter(
|
|
29
30
|
(s) => i.has(s) && !a.has(s)
|
|
@@ -32,7 +33,7 @@ function Pe(e, n) {
|
|
|
32
33
|
}), p = e.filter((o) => !a.has(o));
|
|
33
34
|
return [...r, { ids: p }].filter((o) => o.ids.length > 0);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function ze(e, n, i, a) {
|
|
36
37
|
const r = new ve.Graph();
|
|
37
38
|
r.setDefaultEdgeLabel(() => ({})), r.setGraph({
|
|
38
39
|
rankdir: i,
|
|
@@ -54,9 +55,9 @@ function Fe(e, n, i, a) {
|
|
|
54
55
|
), { width: o = 0, height: l = 0 } = r.graph();
|
|
55
56
|
return { positions: p, width: o, height: l };
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
const a = (t) => `${i}-group-${String(e.groups.indexOf(t))}`, r = e.direction === "LR", p =
|
|
59
|
-
const d =
|
|
58
|
+
function Be(e, n, i) {
|
|
59
|
+
const a = (t) => `${i}-group-${String(e.groups.indexOf(t))}`, r = e.direction === "LR", p = Fe(e.ids, e.groups).map((t) => {
|
|
60
|
+
const d = ze(t.ids, e.links, e.direction, (f) => n.get(f) ?? Ie), m = t.group === void 0 ? 0 : ae;
|
|
60
61
|
return {
|
|
61
62
|
...t,
|
|
62
63
|
...d,
|
|
@@ -70,7 +71,7 @@ function ze(e, n, i) {
|
|
|
70
71
|
let l = 0;
|
|
71
72
|
const s = p.map((t) => {
|
|
72
73
|
const d = r ? { x: l, y: (o - t.boxHeight) / 2 } : { x: (o - t.width) / 2, y: l };
|
|
73
|
-
return l += (r ? t.width : t.boxHeight) +
|
|
74
|
+
return l += (r ? t.width : t.boxHeight) + Ae, { ...t, origin: d };
|
|
74
75
|
});
|
|
75
76
|
return {
|
|
76
77
|
groups: s.flatMap(
|
|
@@ -125,22 +126,15 @@ function ze(e, n, i) {
|
|
|
125
126
|
)
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function Ge({
|
|
129
130
|
data: e
|
|
130
131
|
}) {
|
|
131
132
|
return /* @__PURE__ */ u("div", { className: "aegis-service-map__group", children: /* @__PURE__ */ u("span", { id: e.labelId, className: "aegis-service-map__group-label", children: e.label }) });
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
ok: "ink",
|
|
135
|
-
active: "ink",
|
|
136
|
-
warn: "caution",
|
|
137
|
-
error: "warning",
|
|
138
|
-
muted: "muted"
|
|
139
|
-
};
|
|
140
|
-
function ke({
|
|
134
|
+
function Ce({
|
|
141
135
|
data: e
|
|
142
136
|
}) {
|
|
143
|
-
const { node: n, selected: i } = e, a = n.status ?? "ok"
|
|
137
|
+
const { node: n, selected: i } = e, a = n.status ?? "ok";
|
|
144
138
|
return /* @__PURE__ */ H(
|
|
145
139
|
"div",
|
|
146
140
|
{
|
|
@@ -160,13 +154,7 @@ function ke({
|
|
|
160
154
|
),
|
|
161
155
|
/* @__PURE__ */ H("div", { className: "aegis-service-map__node-body", children: [
|
|
162
156
|
/* @__PURE__ */ H("div", { className: "aegis-service-map__node-label", children: [
|
|
163
|
-
/* @__PURE__ */ u(
|
|
164
|
-
Oe,
|
|
165
|
-
{
|
|
166
|
-
pulse: a === "active",
|
|
167
|
-
tone: i && r === "ink" ? "inverted" : r
|
|
168
|
-
}
|
|
169
|
-
),
|
|
157
|
+
/* @__PURE__ */ u(Oe, { ...$e(a, i) }),
|
|
170
158
|
/* @__PURE__ */ u("span", { className: "aegis-service-map__node-label-text", children: n.label })
|
|
171
159
|
] }),
|
|
172
160
|
n.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: n.sublabel })
|
|
@@ -190,7 +178,7 @@ function ke({
|
|
|
190
178
|
}
|
|
191
179
|
);
|
|
192
180
|
}
|
|
193
|
-
function
|
|
181
|
+
function Ze(e) {
|
|
194
182
|
const { sourceX: n, sourceY: i, targetX: a, targetY: r, label: p, markerEnd: o, style: l } = e, s = ne(), t = (n + a) / 2, d = `M${n},${i} C${t},${i} ${t},${r} ${a},${r}`;
|
|
195
183
|
return /* @__PURE__ */ H(me, { children: [
|
|
196
184
|
/* @__PURE__ */ u("path", { d, className: "aegis-service-map__edge-focus", fill: "none" }),
|
|
@@ -208,7 +196,7 @@ function Ce(e) {
|
|
|
208
196
|
p !== void 0 && p !== "" && /* @__PURE__ */ u("text", { className: "aegis-service-map__edge-label", children: /* @__PURE__ */ u("textPath", { href: `#${s}`, startOffset: "50%", textAnchor: "middle", children: p }) })
|
|
209
197
|
] });
|
|
210
198
|
}
|
|
211
|
-
const
|
|
199
|
+
const ke = { service: Ce, serviceGroup: Ge }, Ve = { service: Ze }, je = "(max-width: 768px)", E = 24, K = 0.1, k = 1, ie = 11 / 13, W = 15, se = 28, re = 200, V = (e) => `${e}px`;
|
|
212
200
|
function Ue(e, n) {
|
|
213
201
|
return [
|
|
214
202
|
.../* @__PURE__ */ new Set([
|
|
@@ -222,7 +210,7 @@ function We(e) {
|
|
|
222
210
|
return e.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
|
|
223
211
|
}
|
|
224
212
|
function Ye(e, n, i, a, r, p) {
|
|
225
|
-
const { fitView: o, getNodes: l, getNodesBounds: s, setViewport: t } = Q(), d = Me(), m = X((b) => b.width > 0 && b.height > 0), f =
|
|
213
|
+
const { fitView: o, getNodes: l, getNodesBounds: s, setViewport: t } = Q(), d = Me(), m = X((b) => b.width > 0 && b.height > 0), f = T(
|
|
226
214
|
() => a !== void 0 && e.ids.includes(a) ? { id: a, near: Ue(a, e.links) } : void 0,
|
|
227
215
|
[a, e]
|
|
228
216
|
), [x, I] = Y();
|
|
@@ -268,13 +256,13 @@ function Ye(e, n, i, a, r, p) {
|
|
|
268
256
|
S,
|
|
269
257
|
y,
|
|
270
258
|
K,
|
|
271
|
-
|
|
259
|
+
k,
|
|
272
260
|
_
|
|
273
|
-
).zoom >=
|
|
261
|
+
).zoom >= k;
|
|
274
262
|
o({
|
|
275
263
|
nodes: (R ? f.near : [f.id]).map((N) => ({ id: N })),
|
|
276
|
-
minZoom:
|
|
277
|
-
maxZoom:
|
|
264
|
+
minZoom: k,
|
|
265
|
+
maxZoom: k,
|
|
278
266
|
padding: _
|
|
279
267
|
}).then(b);
|
|
280
268
|
}
|
|
@@ -361,15 +349,15 @@ function Ke({
|
|
|
361
349
|
ariaLabel: m,
|
|
362
350
|
className: f
|
|
363
351
|
}) {
|
|
364
|
-
const x =
|
|
352
|
+
const x = De(), I = ne(), b = `aegis-service-map${I.replace(/:/g, "-")}`, _ = o !== void 0, S = l !== void 0, [y, R] = Y(
|
|
365
353
|
() => /* @__PURE__ */ new Map()
|
|
366
|
-
), N =
|
|
367
|
-
() => JSON.stringify(
|
|
354
|
+
), N = T(
|
|
355
|
+
() => JSON.stringify(Pe(e, n, i, a)),
|
|
368
356
|
[e, n, i, a]
|
|
369
|
-
), O =
|
|
370
|
-
() =>
|
|
357
|
+
), O = T(() => JSON.parse(N), [N]), v = T(
|
|
358
|
+
() => Be(O, y, I),
|
|
371
359
|
[O, y, I]
|
|
372
|
-
), L = a === "LR", B =
|
|
360
|
+
), L = a === "LR", B = T(
|
|
373
361
|
() => [
|
|
374
362
|
...v.groups,
|
|
375
363
|
...e.map((g) => {
|
|
@@ -414,7 +402,7 @@ function Ke({
|
|
|
414
402
|
b,
|
|
415
403
|
x
|
|
416
404
|
]
|
|
417
|
-
), P =
|
|
405
|
+
), P = T(() => {
|
|
418
406
|
const g = new Map(e.map((c) => [c.id, c.label]));
|
|
419
407
|
return n.map((c) => ({
|
|
420
408
|
id: c.id,
|
|
@@ -441,25 +429,25 @@ function Ke({
|
|
|
441
429
|
);
|
|
442
430
|
R(
|
|
443
431
|
(h) => c.every(
|
|
444
|
-
([M,
|
|
432
|
+
([M, D]) => h.get(M)?.width === D.width && h.get(M)?.height === D.height
|
|
445
433
|
) ? h : new Map([...h, ...c])
|
|
446
434
|
);
|
|
447
435
|
},
|
|
448
436
|
[G]
|
|
449
|
-
), w = Re(je), F = d && !w,
|
|
437
|
+
), w = Re(je), F = d && !w, $ = fe(Le), C = Ye(
|
|
450
438
|
O,
|
|
451
439
|
v,
|
|
452
440
|
e.every((g) => y.has(g.id)),
|
|
453
441
|
t,
|
|
454
442
|
F,
|
|
455
443
|
w
|
|
456
|
-
),
|
|
457
|
-
|
|
458
|
-
if (!(
|
|
459
|
-
return
|
|
460
|
-
|
|
444
|
+
), Z = s !== void 0 && O.ids.includes(s) ? s : void 0, [U, ce] = Y();
|
|
445
|
+
C && U !== Z && ce(Z), J(() => {
|
|
446
|
+
if (!($ === null || Z === void 0 || C))
|
|
447
|
+
return $.awaitRow(), () => {
|
|
448
|
+
$.placeRow(null);
|
|
461
449
|
};
|
|
462
|
-
}, [
|
|
450
|
+
}, [$, Z, C]);
|
|
463
451
|
const le = Je(), de = z(
|
|
464
452
|
(g, c) => {
|
|
465
453
|
c.type === "service" && o?.(c.data.node);
|
|
@@ -479,16 +467,16 @@ function Ke({
|
|
|
479
467
|
return;
|
|
480
468
|
const h = c.getAttribute("data-id");
|
|
481
469
|
if (c.classList.contains("react-flow__node")) {
|
|
482
|
-
const M = e.find((
|
|
470
|
+
const M = e.find((D) => D.id === h);
|
|
483
471
|
M && o && (g.preventDefault(), o(M));
|
|
484
472
|
} else if (c.classList.contains("react-flow__edge")) {
|
|
485
|
-
const M = n.find((
|
|
473
|
+
const M = n.find((D) => D.id === h);
|
|
486
474
|
M && l && (g.preventDefault(), l(M));
|
|
487
475
|
}
|
|
488
476
|
},
|
|
489
477
|
[e, n, o, l]
|
|
490
478
|
), ue = {
|
|
491
|
-
...
|
|
479
|
+
...He,
|
|
492
480
|
height: r === void 0 ? void 0 : `${String(r)}px`
|
|
493
481
|
};
|
|
494
482
|
return /* @__PURE__ */ H(
|
|
@@ -508,7 +496,7 @@ function Ke({
|
|
|
508
496
|
"aria-label": m,
|
|
509
497
|
nodes: B,
|
|
510
498
|
edges: P,
|
|
511
|
-
nodeTypes:
|
|
499
|
+
nodeTypes: ke,
|
|
512
500
|
edgeTypes: Ve,
|
|
513
501
|
minZoom: K,
|
|
514
502
|
nodesDraggable: !1,
|
|
@@ -539,22 +527,22 @@ function Ke({
|
|
|
539
527
|
]
|
|
540
528
|
}
|
|
541
529
|
) }),
|
|
542
|
-
|
|
530
|
+
$ !== null && U !== void 0 && /* @__PURE__ */ u(
|
|
543
531
|
Xe,
|
|
544
532
|
{
|
|
545
533
|
nodeId: U,
|
|
546
|
-
fitted:
|
|
547
|
-
selection:
|
|
534
|
+
fitted: C,
|
|
535
|
+
selection: $
|
|
548
536
|
}
|
|
549
537
|
)
|
|
550
538
|
]
|
|
551
539
|
}
|
|
552
540
|
);
|
|
553
541
|
}
|
|
554
|
-
function
|
|
542
|
+
function lt(e) {
|
|
555
543
|
return /* @__PURE__ */ u(_e, { children: /* @__PURE__ */ u(Ke, { ...e }) });
|
|
556
544
|
}
|
|
557
545
|
export {
|
|
558
|
-
|
|
546
|
+
lt as ServiceMap
|
|
559
547
|
};
|
|
560
548
|
//# sourceMappingURL=ServiceMap.js.map
|