@lincyaw/aegis-ui 0.14.0 → 0.16.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/Breadcrumb.cjs +1 -1
- package/dist/components/ui/Breadcrumb.cjs.map +1 -1
- package/dist/components/ui/Breadcrumb.d.ts +11 -1
- package/dist/components/ui/Breadcrumb.js +26 -17
- package/dist/components/ui/Breadcrumb.js.map +1 -1
- 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.js","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","ReactFlow","Background","BackgroundVariant","Controls","MiniMap","ServiceMap","ReactFlowProvider"],"mappings":";;;;;;;;;;AAyKA,MAAMA,IAAa,KACbC,KAAc,IACdC,KAAiB,KAEjBC,KAAqB,IAErBC,KAAY,IAGZC,KAAY;AAAA,EAChB,8BAA8B,GAAG,OAAOL,CAAU,CAAC;AAAA,EACnD,8BAA8B,GAAG,OAAOC,EAAW,CAAC;AAAA,EACpD,kCAAkC,GAAG,OAAOC,EAAc,CAAC;AAAA,EAC3D,qCAAqC,GAAG,OAAOC,EAAkB,CAAC;AACpE,GAOMG,KAAqB,EAAE,OAAON,GAAY,QAAQC,GAAA;AAiBxD,SAASM,GACPC,GACAC,GACAC,GACAC,GACU;AACV,QAAMC,IAAMJ,EAAM,IAAI,CAACK,MAAMA,EAAE,EAAE,GAC3BC,IAAU,IAAI,IAAIF,CAAG;AAC3B,SAAO;AAAA,IACL,WAAAD;AAAA,IACA,KAAAC;AAAA,IACA,OAAOH,EACJ,OAAO,CAACM,MAAMD,EAAQ,IAAIC,EAAE,MAAM,KAAKD,EAAQ,IAAIC,EAAE,MAAM,CAAC,EAC5D,IAAI,CAACA,MAAM,CAACA,EAAE,QAAQA,EAAE,MAAM,CAAC;AAAA,IAClC,QAAAL;AAAA,EAAA;AAEJ;AAGA,SAASM,GAAQJ,GAAeF,GAAmC;AACjE,QAAMI,IAAU,IAAI,IAAIF,CAAG,GACrBK,wBAAc,IAAA,GACdC,IAAUR,EAAO,IAAI,CAACS,MAAU;AACpC,UAAMP,IAAM,CAAC,GAAG,IAAI,IAAIO,EAAM,OAAO,CAAC,EAAE;AAAA,MACtC,CAACC,MAAON,EAAQ,IAAIM,CAAE,KAAK,CAACH,EAAQ,IAAIG,CAAE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B,GAAGhF,GAAO,GAC9B;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ServiceMap.js","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":";;;;;;;;;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AA,YACf,aAAaX,IAAkBuB,KAAkB;AAAA,YACjD,aAAatB,IAAkBwB,KAAkB;AAAA,YACjD,WAAWC;AAAA,YACX,SAASJ;AAAA,YAET,UAAA;AAAA,cAAA,gBAAA5H,EAACmI,MAAW,SAASC,GAAkB,MAAM,KAAK,IAAI,MAAM,GAAG;AAAA,cAC/D,gBAAApI,EAACqI,IAAA,EAAS,iBAAiB,IAAO,UAAS,YAAW;AAAA,cACrD3F,KACC,gBAAA1C;AAAA,gBAACsI;AAAA,gBAAA;AAAA,kBACC,UAAQ;AAAA,kBACR,UAAQ;AAAA,kBACR,UAAS;AAAA,kBACT,OAAO,EAAE,OAAOrG,GAAA;AAAA,kBAChB,eAAeI;AAAA,gBAAA;AAAA,cAAA;AAAA,YACjB;AAAA,UAAA;AAAA,QAAA,GAGN;AAAA,QACCsC,MAAc,QAAQ+C,MAAY,UACjC,gBAAA1H;AAAA,UAACyE;AAAA,UAAA;AAAA,YACC,QAAQiD;AAAA,YACR,QAAA1D;AAAA,YACA,WAAAW;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,SAAS4D,GAAW5H,GAAqC;AAC9D,2BACG6H,IAAA,EACC,UAAA,gBAAAxI,EAAC2F,IAAA,EAAiB,GAAGhF,GAAO,GAC9B;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react"),I=require("../../agent/core/usePrimitiveSurface.cjs");;/* empty css */function R({items:i,variant:_="dot",density:b="comfortable",selectedId:o,onSelect:m,scrollable:h=!1,ariaLabel:j,className:x,style:v,surface:N}){const a=u.useRef(null),y=I.usePrimitiveSurface(N,i,"timeline",a),[k,g]=u.useState(void 0),d=_==="numbered",p=b==="compact",r=m!==void 0,w=["aegis-timeline",d?"aegis-timeline--numbered":"",p?"aegis-timeline--compact":"",r?"aegis-timeline--selectable":"",h?"aegis-timeline--scrollable":"",x??""].filter(Boolean).join(" "),S=i.findIndex(e=>e.id===o),f=i.findIndex(e=>e.id===k),T=f>=0?f:Math.max(S,0);u.useLayoutEffect(()=>{const e=a.current,t=e?.querySelector(":scope > .aegis-timeline__item--selected");if(!e||!t)return;const l=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop,n=l+t.offsetHeight;l<e.scrollTop?e.scrollTop=l:n>e.scrollTop+e.clientHeight&&(e.scrollTop=n-e.clientHeight)},[o]);const c=e=>{e<0||e>=i.length||(g(i[e].id),a.current?.querySelectorAll(':scope > [role="option"]')[e]?.focus())},q=(e,t)=>{switch(e.key){case"ArrowDown":c(t+1);break;case"ArrowUp":c(t-1);break;case"Home":c(0);break;case"End":c(i.length-1);break;case"Enter":case" ":m?.(i[t]);break;default:return}e.preventDefault()};return s.jsx("ol",{ref:a,className:w,style:v,role:r?"listbox":void 0,"aria-label":j,...y,children:i.map((e,t)=>{const l=["aegis-timeline__item",d?"aegis-timeline__item--numbered":"",r&&e.id===o?"aegis-timeline__item--selected":""].filter(Boolean).join(" "),n=s.jsxs(s.Fragment,{children:[d?s.jsx("span",{className:"aegis-timeline__marker",children:e.marker??String(t+1).padStart(2,"0")}):s.jsx("span",{className:"aegis-timeline__dot",style:e.dotColor?{background:e.dotColor}:void 0}),s.jsxs("div",{className:"aegis-timeline__body",children:[s.jsxs("div",{className:"aegis-timeline__row",children:[s.jsx("span",{className:"aegis-timeline__title",title:p&&typeof e.title=="string"?e.title:void 0,children:e.title}),e.meta?s.jsx("span",{className:"aegis-timeline__meta",children:e.meta}):null]}),e.description?s.jsx("div",{className:"aegis-timeline__desc",children:e.description}):null,e.timestamp?s.jsx("div",{className:"aegis-timeline__time",children:e.timestamp}):null]})]});return r?s.jsx("li",{className:l,role:"option","aria-selected":e.id===o,tabIndex:t===T?0:-1,onClick:()=>{m(e)},onKeyDown:C=>{q(C,t)},onFocus:()=>{g(e.id)},children:n},e.id):s.jsx("li",{className:l,children:n},e.id)})})}exports.Timeline=R;
|
|
2
2
|
//# sourceMappingURL=Timeline.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.cjs","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <ol ref={wrapRef} className={rootClass} style={style} {...agentAttrs}>\n {items.map((it, index) => (\n <li\n key={it.id}\n className={\n numbered\n ? 'aegis-timeline__item aegis-timeline__item--numbered'\n : 'aegis-timeline__item'\n }\n >\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string' ? it.title : undefined\n }\n >\n {it.title}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </li>\n ))}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","numbered","compact","rootClass","jsx","it","index","jsxs"],"mappings":"4NA+CO,SAASA,EAAS,CACvB,MAAAC,EACA,QAAAC,EAAU,MACV,QAAAC,EAAU,cACV,UAAAC,EACA,MAAAC,EACA,QAAAC,CACF,EAAkB,CAChB,MAAMC,EAAUC,EAAAA,OAAyB,IAAI,EACvCC,EAAaC,EAAAA,oBAAoBJ,EAASL,EAAO,WAAYM,CAAO,EACpEI,EAAWT,IAAY,WACvBU,EAAUT,IAAY,UACtBU,EAAY,CAChB,iBACAF,EAAW,2BAA6B,GACxCC,EAAU,0BAA4B,GACtCR,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EACX,OACEU,EAAAA,IAAC,KAAA,CAAG,IAAKP,EAAS,UAAWM,EAAW,MAAAR,EAAe,GAAGI,EACvD,SAAAR,EAAM,IAAI,CAACc,EAAIC,IACdC,EAAAA,KAAC,KAAA,CAEC,UACEN,EACI,sDACA,uBAGL,SAAA,CAAAA,EACCG,EAAAA,IAAC,OAAA,CAAK,UAAU,yBACb,WAAG,QAAU,OAAOE,EAAQ,CAAC,EAAE,SAAS,EAAG,GAAG,EACjD,EAEAF,EAAAA,IAAC,OAAA,CACC,UAAU,sBACV,MAAOC,EAAG,SAAW,CAAE,WAAYA,EAAG,UAAa,MAAA,CAAA,EAGvDE,EAAAA,KAAC,MAAA,CAAI,UAAU,uBACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACb,SAAA,CAAAH,EAAAA,IAAC,OAAA,CACC,UAAU,wBACV,MACEF,GAAW,OAAOG,EAAG,OAAU,SAAWA,EAAG,MAAQ,OAGtD,SAAAA,EAAG,KAAA,CAAA,EAELA,EAAG,KACFD,MAAC,OAAA,CAAK,UAAU,uBAAwB,SAAAC,EAAG,KAAK,EAC9C,IAAA,EACN,EACCA,EAAG,YACFD,MAAC,MAAA,CAAI,UAAU,uBAAwB,SAAAC,EAAG,YAAY,EACpD,KACHA,EAAG,UACFD,MAAC,MAAA,CAAI,UAAU,uBAAwB,SAAAC,EAAG,UAAU,EAClD,IAAA,CAAA,CACN,CAAA,CAAA,EArCKA,EAAG,EAAA,CAuCX,EACH,CAEJ"}
|
|
1
|
+
{"version":3,"file":"Timeline.cjs","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n /**\n * The selected item, drawn inverted when `onSelect` is set. With `onSelect` the list is a\n * listbox: each item is an option, clicked or chosen with Enter or Space,\n * and ↑ ↓ Home End move between them from one tab stop.\n */\n selectedId?: string;\n onSelect?: (item: TimelineItem) => void;\n /**\n * Bounds the list to `--timeline-scroll-max-height` and scrolls it. The\n * list scrolls itself, never the page, to keep the selected item in view\n * when it mounts and when `selectedId` changes.\n */\n scrollable?: boolean;\n /** The list's accessible name; name a selectable list. */\n ariaLabel?: string;\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n selectedId,\n onSelect,\n scrollable = false,\n ariaLabel,\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const selectable = onSelect !== undefined;\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n selectable ? 'aegis-timeline--selectable' : '',\n scrollable ? 'aegis-timeline--scrollable' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const selectedIndex = items.findIndex((it) => it.id === selectedId);\n const focusedIndex = items.findIndex((it) => it.id === focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(selectedIndex, 0);\n\n useLayoutEffect(() => {\n const list = wrapRef.current;\n const item = list?.querySelector<HTMLElement>(\n ':scope > .aegis-timeline__item--selected',\n );\n if (!list || !item) {\n return;\n }\n const top =\n item.getBoundingClientRect().top -\n list.getBoundingClientRect().top +\n list.scrollTop;\n const bottom = top + item.offsetHeight;\n if (top < list.scrollTop) {\n list.scrollTop = top;\n } else if (bottom > list.scrollTop + list.clientHeight) {\n list.scrollTop = bottom - list.clientHeight;\n }\n }, [selectedId]);\n\n const focusItem = (index: number): void => {\n if (index < 0 || index >= items.length) {\n return;\n }\n setFocusedId(items[index].id);\n wrapRef.current\n ?.querySelectorAll<HTMLElement>(':scope > [role=\"option\"]')\n [index]?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLLIElement>,\n index: number,\n ): void => {\n switch (event.key) {\n case 'ArrowDown':\n focusItem(index + 1);\n break;\n case 'ArrowUp':\n focusItem(index - 1);\n break;\n case 'Home':\n focusItem(0);\n break;\n case 'End':\n focusItem(items.length - 1);\n break;\n case 'Enter':\n case ' ':\n onSelect?.(items[index]);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n return (\n <ol\n ref={wrapRef}\n className={rootClass}\n style={style}\n role={selectable ? 'listbox' : undefined}\n aria-label={ariaLabel}\n {...agentAttrs}\n >\n {items.map((it, index) => {\n const className = [\n 'aegis-timeline__item',\n numbered ? 'aegis-timeline__item--numbered' : '',\n selectable && it.id === selectedId\n ? 'aegis-timeline__item--selected'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n const content = (\n <>\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string'\n ? it.title\n : undefined\n }\n >\n {it.title}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </>\n );\n if (!selectable) {\n return (\n <li key={it.id} className={className}>\n {content}\n </li>\n );\n }\n return (\n <li\n key={it.id}\n className={className}\n role=\"option\"\n aria-selected={it.id === selectedId}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n onSelect(it);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(it.id);\n }}\n >\n {content}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","selectedId","onSelect","scrollable","ariaLabel","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","focusedId","setFocusedId","useState","numbered","compact","selectable","rootClass","selectedIndex","it","focusedIndex","tabStopIndex","useLayoutEffect","list","item","top","bottom","focusItem","index","handleKeyDown","event","jsx","content","jsxs","Fragment"],"mappings":"4NAqEO,SAASA,EAAS,CACvB,MAAAC,EACA,QAAAC,EAAU,MACV,QAAAC,EAAU,cACV,WAAAC,EACA,SAAAC,EACA,WAAAC,EAAa,GACb,UAAAC,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,CACF,EAAkB,CAChB,MAAMC,EAAUC,EAAAA,OAAyB,IAAI,EACvCC,EAAaC,EAAAA,oBAAoBJ,EAAST,EAAO,WAAYU,CAAO,EACpE,CAACI,EAAWC,CAAY,EAAIC,EAAAA,SAA6B,MAAS,EAClEC,EAAWhB,IAAY,WACvBiB,EAAUhB,IAAY,UAC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AE,CACb,EACA,UAAYW,GAAU,CACpBD,EAAcC,EAAOF,CAAK,CAC5B,EACA,QAAS,IAAM,CACbhB,EAAaO,EAAG,EAAE,CACpB,EAEC,SAAAa,CAAA,EAfIb,EAAG,EAAA,QAPP,KAAA,CAAe,UAAWf,EACxB,SAAA4B,CAAA,EADMb,EAAG,EAEZ,CAuBN,CAAC,CAAA,CAAA,CAGP"}
|
|
@@ -32,9 +32,24 @@ interface TimelineProps {
|
|
|
32
32
|
* shows in full on hover) and tightens the rows.
|
|
33
33
|
*/
|
|
34
34
|
density?: 'comfortable' | 'compact';
|
|
35
|
+
/**
|
|
36
|
+
* The selected item, drawn inverted when `onSelect` is set. With `onSelect` the list is a
|
|
37
|
+
* listbox: each item is an option, clicked or chosen with Enter or Space,
|
|
38
|
+
* and ↑ ↓ Home End move between them from one tab stop.
|
|
39
|
+
*/
|
|
40
|
+
selectedId?: string;
|
|
41
|
+
onSelect?: (item: TimelineItem) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Bounds the list to `--timeline-scroll-max-height` and scrolls it. The
|
|
44
|
+
* list scrolls itself, never the page, to keep the selected item in view
|
|
45
|
+
* when it mounts and when `selectedId` changes.
|
|
46
|
+
*/
|
|
47
|
+
scrollable?: boolean;
|
|
48
|
+
/** The list's accessible name; name a selectable list. */
|
|
49
|
+
ariaLabel?: string;
|
|
35
50
|
className?: string;
|
|
36
51
|
style?: CSSProperties;
|
|
37
52
|
surface?: TimelineSurface;
|
|
38
53
|
}
|
|
39
|
-
export declare function Timeline({ items, variant, density, className, style, surface, }: TimelineProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare function Timeline({ items, variant, density, selectedId, onSelect, scrollable, ariaLabel, className, style, surface, }: TimelineProps): import("react/jsx-runtime").JSX.Element;
|
|
40
55
|
export {};
|
|
@@ -1,54 +1,124 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { usePrimitiveSurface as
|
|
1
|
+
import { jsx as i, jsxs as u, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as B, useState as D, useLayoutEffect as H } from "react";
|
|
3
|
+
import { usePrimitiveSurface as R } from "../../agent/core/usePrimitiveSurface.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
function
|
|
6
|
-
items:
|
|
7
|
-
variant:
|
|
8
|
-
density:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function L({
|
|
6
|
+
items: o,
|
|
7
|
+
variant: _ = "dot",
|
|
8
|
+
density: b = "comfortable",
|
|
9
|
+
selectedId: s,
|
|
10
|
+
onSelect: m,
|
|
11
|
+
scrollable: h = !1,
|
|
12
|
+
ariaLabel: N,
|
|
13
|
+
className: k,
|
|
14
|
+
style: v,
|
|
15
|
+
surface: y
|
|
12
16
|
}) {
|
|
13
|
-
const
|
|
17
|
+
const a = B(null), w = R(y, o, "timeline", a), [C, p] = D(void 0), d = _ === "numbered", g = b === "compact", r = m !== void 0, I = [
|
|
14
18
|
"aegis-timeline",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
d ? "aegis-timeline--numbered" : "",
|
|
20
|
+
g ? "aegis-timeline--compact" : "",
|
|
21
|
+
r ? "aegis-timeline--selectable" : "",
|
|
22
|
+
h ? "aegis-timeline--scrollable" : "",
|
|
23
|
+
k ?? ""
|
|
24
|
+
].filter(Boolean).join(" "), T = o.findIndex((e) => e.id === s), f = o.findIndex((e) => e.id === C), S = f >= 0 ? f : Math.max(T, 0);
|
|
25
|
+
H(() => {
|
|
26
|
+
const e = a.current, t = e?.querySelector(
|
|
27
|
+
":scope > .aegis-timeline__item--selected"
|
|
28
|
+
);
|
|
29
|
+
if (!e || !t)
|
|
30
|
+
return;
|
|
31
|
+
const l = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, n = l + t.offsetHeight;
|
|
32
|
+
l < e.scrollTop ? e.scrollTop = l : n > e.scrollTop + e.clientHeight && (e.scrollTop = n - e.clientHeight);
|
|
33
|
+
}, [s]);
|
|
34
|
+
const c = (e) => {
|
|
35
|
+
e < 0 || e >= o.length || (p(o[e].id), a.current?.querySelectorAll(':scope > [role="option"]')[e]?.focus());
|
|
36
|
+
}, j = (e, t) => {
|
|
37
|
+
switch (e.key) {
|
|
38
|
+
case "ArrowDown":
|
|
39
|
+
c(t + 1);
|
|
40
|
+
break;
|
|
41
|
+
case "ArrowUp":
|
|
42
|
+
c(t - 1);
|
|
43
|
+
break;
|
|
44
|
+
case "Home":
|
|
45
|
+
c(0);
|
|
46
|
+
break;
|
|
47
|
+
case "End":
|
|
48
|
+
c(o.length - 1);
|
|
49
|
+
break;
|
|
50
|
+
case "Enter":
|
|
51
|
+
case " ":
|
|
52
|
+
m?.(o[t]);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ i(
|
|
60
|
+
"ol",
|
|
21
61
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
62
|
+
ref: a,
|
|
63
|
+
className: I,
|
|
64
|
+
style: v,
|
|
65
|
+
role: r ? "listbox" : void 0,
|
|
66
|
+
"aria-label": N,
|
|
67
|
+
...w,
|
|
68
|
+
children: o.map((e, t) => {
|
|
69
|
+
const l = [
|
|
70
|
+
"aegis-timeline__item",
|
|
71
|
+
d ? "aegis-timeline__item--numbered" : "",
|
|
72
|
+
r && e.id === s ? "aegis-timeline__item--selected" : ""
|
|
73
|
+
].filter(Boolean).join(" "), n = /* @__PURE__ */ u(A, { children: [
|
|
74
|
+
d ? /* @__PURE__ */ i("span", { className: "aegis-timeline__marker", children: e.marker ?? String(t + 1).padStart(2, "0") }) : /* @__PURE__ */ i(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: "aegis-timeline__dot",
|
|
78
|
+
style: e.dotColor ? { background: e.dotColor } : void 0
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ u("div", { className: "aegis-timeline__body", children: [
|
|
82
|
+
/* @__PURE__ */ u("div", { className: "aegis-timeline__row", children: [
|
|
83
|
+
/* @__PURE__ */ i(
|
|
84
|
+
"span",
|
|
85
|
+
{
|
|
86
|
+
className: "aegis-timeline__title",
|
|
87
|
+
title: g && typeof e.title == "string" ? e.title : void 0,
|
|
88
|
+
children: e.title
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
e.meta ? /* @__PURE__ */ i("span", { className: "aegis-timeline__meta", children: e.meta }) : null
|
|
92
|
+
] }),
|
|
93
|
+
e.description ? /* @__PURE__ */ i("div", { className: "aegis-timeline__desc", children: e.description }) : null,
|
|
94
|
+
e.timestamp ? /* @__PURE__ */ i("div", { className: "aegis-timeline__time", children: e.timestamp }) : null
|
|
95
|
+
] })
|
|
96
|
+
] });
|
|
97
|
+
return r ? /* @__PURE__ */ i(
|
|
98
|
+
"li",
|
|
26
99
|
{
|
|
27
|
-
className:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
e.id
|
|
49
|
-
)) });
|
|
100
|
+
className: l,
|
|
101
|
+
role: "option",
|
|
102
|
+
"aria-selected": e.id === s,
|
|
103
|
+
tabIndex: t === S ? 0 : -1,
|
|
104
|
+
onClick: () => {
|
|
105
|
+
m(e);
|
|
106
|
+
},
|
|
107
|
+
onKeyDown: (x) => {
|
|
108
|
+
j(x, t);
|
|
109
|
+
},
|
|
110
|
+
onFocus: () => {
|
|
111
|
+
p(e.id);
|
|
112
|
+
},
|
|
113
|
+
children: n
|
|
114
|
+
},
|
|
115
|
+
e.id
|
|
116
|
+
) : /* @__PURE__ */ i("li", { className: l, children: n }, e.id);
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
);
|
|
50
120
|
}
|
|
51
121
|
export {
|
|
52
|
-
|
|
122
|
+
L as Timeline
|
|
53
123
|
};
|
|
54
124
|
//# sourceMappingURL=Timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.js","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <ol ref={wrapRef} className={rootClass} style={style} {...agentAttrs}>\n {items.map((it, index) => (\n <li\n key={it.id}\n className={\n numbered\n ? 'aegis-timeline__item aegis-timeline__item--numbered'\n : 'aegis-timeline__item'\n }\n >\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string' ? it.title : undefined\n }\n >\n {it.title}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </li>\n ))}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","numbered","compact","rootClass","jsx","it","index","jsxs"],"mappings":";;;;AA+CO,SAASA,EAAS;AAAA,EACvB,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,GAAkB;AAChB,QAAMC,IAAUC,EAAyB,IAAI,GACvCC,IAAaC,EAAoBJ,GAASL,GAAO,YAAYM,CAAO,GACpEI,IAAWT,MAAY,YACvBU,IAAUT,MAAY,WACtBU,IAAY;AAAA,IAChB;AAAA,IACAF,I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ACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Timeline.js","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n /**\n * The selected item, drawn inverted when `onSelect` is set. With `onSelect` the list is a\n * listbox: each item is an option, clicked or chosen with Enter or Space,\n * and ↑ ↓ Home End move between them from one tab stop.\n */\n selectedId?: string;\n onSelect?: (item: TimelineItem) => void;\n /**\n * Bounds the list to `--timeline-scroll-max-height` and scrolls it. The\n * list scrolls itself, never the page, to keep the selected item in view\n * when it mounts and when `selectedId` changes.\n */\n scrollable?: boolean;\n /** The list's accessible name; name a selectable list. */\n ariaLabel?: string;\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n selectedId,\n onSelect,\n scrollable = false,\n ariaLabel,\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const selectable = onSelect !== undefined;\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n selectable ? 'aegis-timeline--selectable' : '',\n scrollable ? 'aegis-timeline--scrollable' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const selectedIndex = items.findIndex((it) => it.id === selectedId);\n const focusedIndex = items.findIndex((it) => it.id === focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(selectedIndex, 0);\n\n useLayoutEffect(() => {\n const list = wrapRef.current;\n const item = list?.querySelector<HTMLElement>(\n ':scope > .aegis-timeline__item--selected',\n );\n if (!list || !item) {\n return;\n }\n const top =\n item.getBoundingClientRect().top -\n list.getBoundingClientRect().top +\n list.scrollTop;\n const bottom = top + item.offsetHeight;\n if (top < list.scrollTop) {\n list.scrollTop = top;\n } else if (bottom > list.scrollTop + list.clientHeight) {\n list.scrollTop = bottom - list.clientHeight;\n }\n }, [selectedId]);\n\n const focusItem = (index: number): void => {\n if (index < 0 || index >= items.length) {\n return;\n }\n setFocusedId(items[index].id);\n wrapRef.current\n ?.querySelectorAll<HTMLElement>(':scope > [role=\"option\"]')\n [index]?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLLIElement>,\n index: number,\n ): void => {\n switch (event.key) {\n case 'ArrowDown':\n focusItem(index + 1);\n break;\n case 'ArrowUp':\n focusItem(index - 1);\n break;\n case 'Home':\n focusItem(0);\n break;\n case 'End':\n focusItem(items.length - 1);\n break;\n case 'Enter':\n case ' ':\n onSelect?.(items[index]);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n return (\n <ol\n ref={wrapRef}\n className={rootClass}\n style={style}\n role={selectable ? 'listbox' : undefined}\n aria-label={ariaLabel}\n {...agentAttrs}\n >\n {items.map((it, index) => {\n const className = [\n 'aegis-timeline__item',\n numbered ? 'aegis-timeline__item--numbered' : '',\n selectable && it.id === selectedId\n ? 'aegis-timeline__item--selected'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n const content = (\n <>\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string'\n ? it.title\n : undefined\n }\n >\n {it.title}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </>\n );\n if (!selectable) {\n return (\n <li key={it.id} className={className}>\n {content}\n </li>\n );\n }\n return (\n <li\n key={it.id}\n className={className}\n role=\"option\"\n aria-selected={it.id === selectedId}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n onSelect(it);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(it.id);\n }}\n >\n {content}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","selectedId","onSelect","scrollable","ariaLabel","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","focusedId","setFocusedId","useState","numbered","compact","selectable","rootClass","selectedIndex","it","focusedIndex","tabStopIndex","useLayoutEffect","list","item","top","bottom","focusItem","index","handleKeyDown","event","jsx","content","jsx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