@backstage/core-components 0.18.3-next.0 → 0.18.3-next.2
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/CHANGELOG.md +14 -0
- package/dist/components/DependencyGraph/DependencyGraph.esm.js.map +1 -1
- package/dist/components/DependencyGraph/types.esm.js +59 -22
- package/dist/components/DependencyGraph/types.esm.js.map +1 -1
- package/dist/components/LogViewer/styles.esm.js +2 -1
- package/dist/components/LogViewer/styles.esm.js.map +1 -1
- package/dist/index.d.ts +72 -22
- package/dist/layout/Sidebar/Bar.esm.js +18 -11
- package/dist/layout/Sidebar/Bar.esm.js.map +1 -1
- package/dist/layout/Sidebar/localStorage.esm.js +5 -2
- package/dist/layout/Sidebar/localStorage.esm.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.18.3-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 96ad674: Line numbers in LogViewer will not be selectable in UI anymore
|
|
8
|
+
|
|
9
|
+
## 0.18.3-next.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b2bef92: Convert all enums to erasable-syntax compliant patterns
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/core-plugin-api@1.11.2-next.1
|
|
16
|
+
|
|
3
17
|
## 0.18.3-next.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyGraph.esm.js","sources":["../../../src/components/DependencyGraph/DependencyGraph.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport useMeasure from 'react-use/esm/useMeasure';\nimport classNames from 'classnames';\nimport { once } from 'lodash';\nimport * as d3Zoom from 'd3-zoom';\nimport * as d3Selection from 'd3-selection';\nimport useTheme from '@material-ui/core/styles/useTheme';\nimport dagre from '@dagrejs/dagre';\nimport debounce from 'lodash/debounce';\nimport { DependencyGraphTypes as Types } from './types';\nimport { Node } from './Node';\nimport { Edge, GraphEdge } from './Edge';\nimport { ARROW_MARKER_ID } from './constants';\nimport IconButton from '@material-ui/core/IconButton';\nimport FullscreenIcon from '@material-ui/icons/Fullscreen';\nimport FullscreenExitIcon from '@material-ui/icons/FullscreenExit';\nimport { FullScreen, useFullScreenHandle } from 'react-full-screen';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n fullscreenButton: {\n position: 'absolute',\n right: 0,\n },\n root: {\n overflow: 'hidden',\n minHeight: '100%',\n minWidth: '100%',\n },\n fixedHeight: {\n maxHeight: '100%',\n },\n fullscreen: {\n backgroundColor: theme.palette.background.paper,\n },\n}));\n\n/**\n * Properties of {@link DependencyGraph}\n *\n * @public\n * @remarks\n * `<NodeData>` and `<EdgeData>` are useful when rendering custom or edge labels\n */\nexport interface DependencyGraphProps<NodeData, EdgeData>\n extends SVGProps<SVGSVGElement> {\n /**\n * Edges of graph\n */\n edges: Types.DependencyEdge<EdgeData>[];\n /**\n * Nodes of Graph\n */\n nodes: Types.DependencyNode<NodeData>[];\n /**\n * Graph {@link DependencyGraphTypes.Direction | direction}\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Direction.TOP_BOTTOM`\n */\n direction?: Types.Direction;\n /**\n * Node {@link DependencyGraphTypes.Alignment | alignment}\n */\n align?: Types.Alignment;\n /**\n * Margin between nodes on each rank\n *\n * @remarks\n *\n * Default: 50\n */\n nodeMargin?: number;\n /**\n * Margin between edges\n *\n * @remarks\n *\n * Default: 10\n */\n edgeMargin?: number;\n /**\n * Margin between each rank\n *\n * @remarks\n *\n * Default: 50\n */\n rankMargin?: number;\n /**\n * Margin on left and right of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingX?: number;\n /**\n * Margin on top and bottom of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingY?: number;\n /**\n * Heuristic used to find set of edges that will make graph acyclic\n */\n acyclicer?: 'greedy';\n /**\n * {@link DependencyGraphTypes.Ranker | Algorithm} used to rank nodes\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Ranker.NETWORK_SIMPLEX`\n */\n ranker?: Types.Ranker;\n /**\n * {@link DependencyGraphTypes.LabelPosition | Position} of label in relation to edge\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelPosition?: Types.LabelPosition;\n /**\n * How much to move label away from edge\n *\n * @remarks\n *\n * Applies only when {@link DependencyGraphProps.labelPosition} is `DependencyGraphTypes.LabelPosition.LEFT` or\n * `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelOffset?: number;\n /**\n * Minimum number of ranks to keep between connected nodes\n */\n edgeRanks?: number;\n /**\n * Weight applied to edges in graph\n */\n edgeWeight?: number;\n /**\n * Custom edge rendering component\n */\n renderEdge?: Types.RenderEdgeFunction<EdgeData>;\n /**\n * Custom node rendering component\n */\n renderNode?: Types.RenderNodeFunction<NodeData>;\n /**\n * Custom label rendering component\n */\n renderLabel?: Types.RenderLabelFunction<EdgeData>;\n /**\n * {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs | Defs} shared by rendered SVG to be used by\n * {@link DependencyGraphProps.renderNode} and/or {@link DependencyGraphProps.renderLabel}\n */\n defs?: JSX.Element | JSX.Element[];\n /**\n * Controls zoom behavior of graph\n *\n * @remarks\n *\n * Default: `enabled`\n */\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n /**\n * A factory for curve generators addressing both lines and areas.\n *\n * @remarks\n *\n * Default: 'curveMonotoneX'\n */\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n /**\n * Controls if the arrow heads should be rendered or not.\n *\n * Default: false\n */\n showArrowHeads?: boolean;\n /**\n * Controls if the graph should be contained or grow\n *\n * @remarks\n *\n * Default: 'grow'\n */\n fit?: 'grow' | 'contain';\n /**\n * Controls if user can toggle fullscreen mode\n *\n * @remarks\n *\n * Default: true\n */\n allowFullscreen?: boolean;\n}\n\nconst WORKSPACE_ID = 'workspace';\nconst DEPENDENCY_GRAPH_SVG = 'dependency-graph';\n\n/**\n * Graph component used to visualize relations between entities\n *\n * @public\n */\nexport function DependencyGraph<NodeData, EdgeData>(\n props: DependencyGraphProps<NodeData, EdgeData>,\n) {\n const {\n edges,\n nodes,\n renderNode,\n direction = Types.Direction.TOP_BOTTOM,\n align,\n nodeMargin = 50,\n edgeMargin = 10,\n rankMargin = 50,\n paddingX = 0,\n paddingY = 0,\n acyclicer,\n ranker = Types.Ranker.NETWORK_SIMPLEX,\n labelPosition = Types.LabelPosition.RIGHT,\n labelOffset = 10,\n edgeRanks = 1,\n edgeWeight = 1,\n renderEdge,\n renderLabel,\n defs,\n zoom = 'enabled',\n curve = 'curveMonotoneX',\n showArrowHeads = false,\n fit = 'grow',\n allowFullscreen = true,\n ...svgProps\n } = props;\n const theme = useTheme();\n const [containerWidth, setContainerWidth] = useState<number>(100);\n const [containerHeight, setContainerHeight] = useState<number>(100);\n const fullScreenHandle = useFullScreenHandle();\n const styles = useStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const graph = useRef<dagre.graphlib.Graph<Types.DependencyNode<NodeData>>>(\n new dagre.graphlib.Graph(),\n );\n const [graphWidth, setGraphWidth] = useState<number>(\n graph.current.graph()?.width || 0,\n );\n const [graphHeight, setGraphHeight] = useState<number>(\n graph.current.graph()?.height || 0,\n );\n const [graphNodes, setGraphNodes] = useState<string[]>([]);\n const [graphEdges, setGraphEdges] = useState<dagre.Edge[]>([]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const [_measureRef] = useMeasure();\n const measureRef = once(_measureRef);\n\n const scalableHeight =\n fit === 'grow' && !fullScreenHandle.active ? maxHeight : '100%';\n\n const containerRef = useMemo(\n () =>\n debounce((root: HTMLDivElement) => {\n if (!root) {\n return;\n }\n measureRef(root);\n\n // Set up zooming + panning\n const node: SVGSVGElement = root.querySelector(\n `svg#${DEPENDENCY_GRAPH_SVG}`,\n ) as SVGSVGElement;\n if (!node) {\n return;\n }\n const container = d3Selection.select<SVGSVGElement, null>(node);\n const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));\n\n function enableZoom() {\n container.call(\n d3Zoom\n .zoom<SVGSVGElement, null>()\n .scaleExtent([1, Infinity])\n .on('zoom', event => {\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n maxWidth - maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n maxHeight - maxHeight * event.transform.k,\n ),\n );\n workspace.attr('transform', event.transform);\n }),\n );\n }\n\n if (zoom === 'enabled') {\n enableZoom();\n } else if (zoom === 'enable-on-click') {\n container.on('click', () => enableZoom());\n }\n\n const { width: newContainerWidth, height: newContainerHeight } =\n root.getBoundingClientRect();\n if (\n containerWidth !== newContainerWidth &&\n newContainerWidth <= maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n containerHeight !== newContainerHeight &&\n newContainerHeight <= maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom],\n );\n\n const setNodesAndEdges = useCallback(() => {\n // Cleaning up lingering nodes and edges\n const currentGraphNodes = graph.current.nodes();\n const currentGraphEdges = graph.current.edges();\n\n currentGraphNodes.forEach(nodeId => {\n const remainingNode = nodes.some(node => node.id === nodeId);\n if (!remainingNode) {\n graph.current.removeNode(nodeId);\n }\n });\n\n currentGraphEdges.forEach(e => {\n const remainingEdge = edges.some(\n edge => edge.from === e.v && edge.to === e.w,\n );\n if (!remainingEdge) {\n graph.current.removeEdge(e.v, e.w);\n }\n });\n\n // Adding/updating nodes and edges\n nodes.forEach(node => {\n const existingNode = graph.current\n .nodes()\n .find(nodeId => node.id === nodeId);\n\n if (existingNode && graph.current.node(existingNode)) {\n const { width, height, x, y } = graph.current.node(existingNode);\n graph.current.setNode(existingNode, { ...node, width, height, x, y });\n } else {\n graph.current.setNode(node.id, { ...node, width: 0, height: 0 });\n }\n });\n\n edges.forEach(e => {\n graph.current.setEdge(e.from, e.to, {\n ...e,\n label: e.label,\n width: 0,\n height: 0,\n labelpos: labelPosition,\n labeloffset: labelOffset,\n weight: edgeWeight,\n minlen: edgeRanks,\n });\n });\n }, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);\n\n const updateGraph = useMemo(\n () =>\n debounce(\n () => {\n dagre.layout(graph.current);\n const { height, width } = graph.current.graph();\n const newHeight = Math.max(0, height || 0);\n const newWidth = Math.max(0, width || 0);\n setGraphWidth(newWidth);\n setGraphHeight(newHeight);\n\n setGraphNodes(graph.current.nodes());\n setGraphEdges(graph.current.edges());\n },\n 250,\n { leading: true },\n ),\n [],\n );\n\n useEffect(() => {\n graph.current.setGraph({\n rankdir: direction,\n align,\n nodesep: nodeMargin,\n edgesep: edgeMargin,\n ranksep: rankMargin,\n marginx: paddingX,\n marginy: paddingY,\n acyclicer,\n ranker,\n });\n\n setNodesAndEdges();\n updateGraph();\n\n return updateGraph.cancel;\n }, [\n acyclicer,\n align,\n direction,\n edgeMargin,\n paddingX,\n paddingY,\n nodeMargin,\n rankMargin,\n ranker,\n setNodesAndEdges,\n updateGraph,\n ]);\n\n const setNode = useCallback(\n (id: string, node: Types.DependencyNode<NodeData>) => {\n graph.current.setNode(id, node);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n const setEdge = useCallback(\n (id: dagre.Edge, edge: Types.DependencyEdge<EdgeData>) => {\n graph.current.setEdge(id, edge);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n return (\n <FullScreen\n handle={fullScreenHandle}\n className={classNames(\n fullScreenHandle.active ? styles.fullscreen : styles.root,\n )}\n >\n {allowFullscreen && (\n <Tooltip title={t('dependencyGraph.fullscreenTooltip')}>\n <IconButton\n className={styles.fullscreenButton}\n onClick={\n fullScreenHandle.active\n ? fullScreenHandle.exit\n : fullScreenHandle.enter\n }\n >\n {fullScreenHandle.active ? (\n <FullscreenExitIcon />\n ) : (\n <FullscreenIcon />\n )}\n </IconButton>\n </Tooltip>\n )}\n\n <div ref={containerRef} style={{ width: '100%', height: '100%' }}>\n <svg\n {...svgProps}\n width=\"100%\"\n height={scalableHeight}\n viewBox={`0 0 ${maxWidth} ${maxHeight}`}\n id={DEPENDENCY_GRAPH_SVG}\n >\n <defs>\n <marker\n id={ARROW_MARKER_ID}\n viewBox=\"0 0 24 24\"\n markerWidth=\"14\"\n markerHeight=\"14\"\n refX=\"16\"\n refY=\"12\"\n orient=\"auto\"\n markerUnits=\"strokeWidth\"\n >\n <path\n fill={theme.palette.textSubtle}\n d=\"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z\"\n />\n </marker>\n {defs}\n </defs>\n <g id={WORKSPACE_ID}>\n <svg\n width={graphWidth}\n height={graphHeight}\n y={maxHeight / 2 - graphHeight / 2}\n x={maxWidth / 2 - graphWidth / 2}\n viewBox={`-25 -25 ${graphWidth + 50} ${graphHeight + 50}`}\n >\n {graphEdges.map(e => {\n const edge = graph.current.edge(e) as GraphEdge<EdgeData>;\n if (!edge) return null;\n if (renderEdge) return renderEdge({ edge, id: e });\n\n return (\n <Edge\n key={`${e.v}-${e.w}`}\n id={e}\n setEdge={setEdge}\n render={renderLabel}\n edge={edge}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n );\n })}\n {graphNodes.map((id: string) => {\n const node = graph.current.node(id);\n if (!node) return null;\n return (\n <Node\n key={id}\n setNode={setNode}\n render={renderNode}\n node={node}\n />\n );\n })}\n </svg>\n </g>\n </svg>\n </div>\n </FullScreen>\n );\n}\n"],"names":["Types"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAA,GAAY,UAAA,CAAW,CAAC,KAAA,MAAkB;AAAA,EAC9C,gBAAA,EAAkB;AAAA,IAChB,QAAA,EAAU,UAAA;AAAA,IACV,KAAA,EAAO;AAAA,GACT;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,QAAA;AAAA,IACV,SAAA,EAAW,MAAA;AAAA,IACX,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,WAAA,EAAa;AAAA,IACX,SAAA,EAAW;AAAA,GACb;AAAA,EACA,UAAA,EAAY;AAAA,IACV,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA;AAE9C,CAAA,CAAE,CAAA;AAqKF,MAAM,YAAA,GAAe,WAAA;AACrB,MAAM,oBAAA,GAAuB,kBAAA;AAOtB,SAAS,gBACd,KAAA,EACA;AACA,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA,GAAYA,qBAAM,SAAA,CAAU,UAAA;AAAA,IAC5B,KAAA;AAAA,IACA,UAAA,GAAa,EAAA;AAAA,IACb,UAAA,GAAa,EAAA;AAAA,IACb,UAAA,GAAa,EAAA;AAAA,IACb,QAAA,GAAW,CAAA;AAAA,IACX,QAAA,GAAW,CAAA;AAAA,IACX,SAAA;AAAA,IACA,MAAA,GAASA,qBAAM,MAAA,CAAO,e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,0BACR,IAAA;AAAA,0BACA,KAAA;AAAA,0BACA;AAAA,yBAAA;AAAA,wBANK,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,CAAA,EAAI,EAAE,CAAC,CAAA;AAAA,uBAOpB;AAAA,oBAEJ,CAAC,CAAA;AAAA,oBACA,UAAA,CAAW,GAAA,CAAI,CAAC,EAAA,KAAe;AAC9B,sBAAA,MAAM,IAAA,GAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,CAAA;AAClC,sBAAA,IAAI,CAAC,MAAM,OAAO,IAAA;AAClB,sBAAA,uBACE,GAAA;AAAA,wBAAC,IAAA;AAAA,wBAAA;AAAA,0BAEC,OAAA;AAAA,0BACA,MAAA,EAAQ,UAAA;AAAA,0BACR;AAAA,yBAAA;AAAA,wBAHK;AAAA,uBAIP;AAAA,oBAEJ,CAAC;AAAA;AAAA;AAAA,eACH,EACF;AAAA;AAAA;AAAA,SACF,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DependencyGraph.esm.js","sources":["../../../src/components/DependencyGraph/DependencyGraph.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n SVGProps,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport useMeasure from 'react-use/esm/useMeasure';\nimport classNames from 'classnames';\nimport { once } from 'lodash';\nimport * as d3Zoom from 'd3-zoom';\nimport * as d3Selection from 'd3-selection';\nimport useTheme from '@material-ui/core/styles/useTheme';\nimport dagre from '@dagrejs/dagre';\nimport debounce from 'lodash/debounce';\nimport { DependencyGraphTypes as Types } from './types';\nimport { Node } from './Node';\nimport { Edge, GraphEdge } from './Edge';\nimport { ARROW_MARKER_ID } from './constants';\nimport IconButton from '@material-ui/core/IconButton';\nimport FullscreenIcon from '@material-ui/icons/Fullscreen';\nimport FullscreenExitIcon from '@material-ui/icons/FullscreenExit';\nimport { FullScreen, useFullScreenHandle } from 'react-full-screen';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n fullscreenButton: {\n position: 'absolute',\n right: 0,\n },\n root: {\n overflow: 'hidden',\n minHeight: '100%',\n minWidth: '100%',\n },\n fixedHeight: {\n maxHeight: '100%',\n },\n fullscreen: {\n backgroundColor: theme.palette.background.paper,\n },\n}));\n\n/**\n * Properties of {@link DependencyGraph}\n *\n * @public\n * @remarks\n * `<NodeData>` and `<EdgeData>` are useful when rendering custom or edge labels\n */\nexport interface DependencyGraphProps<NodeData, EdgeData>\n extends SVGProps<SVGSVGElement> {\n /**\n * Edges of graph\n */\n edges: Types.DependencyEdge<EdgeData>[];\n /**\n * Nodes of Graph\n */\n nodes: Types.DependencyNode<NodeData>[];\n /**\n * Graph {@link DependencyGraphTypes.(Direction:namespace) | direction}\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Direction.TOP_BOTTOM`\n */\n direction?: Types.Direction;\n /**\n * Node {@link DependencyGraphTypes.(Alignment:namespace) | alignment}\n */\n align?: Types.Alignment;\n /**\n * Margin between nodes on each rank\n *\n * @remarks\n *\n * Default: 50\n */\n nodeMargin?: number;\n /**\n * Margin between edges\n *\n * @remarks\n *\n * Default: 10\n */\n edgeMargin?: number;\n /**\n * Margin between each rank\n *\n * @remarks\n *\n * Default: 50\n */\n rankMargin?: number;\n /**\n * Margin on left and right of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingX?: number;\n /**\n * Margin on top and bottom of whole graph\n *\n * @remarks\n *\n * Default: 0\n */\n paddingY?: number;\n /**\n * Heuristic used to find set of edges that will make graph acyclic\n */\n acyclicer?: 'greedy';\n /**\n * {@link DependencyGraphTypes.(Ranker:namespace) | Algorithm} used to rank nodes\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.Ranker.NETWORK_SIMPLEX`\n */\n ranker?: Types.Ranker;\n /**\n * {@link DependencyGraphTypes.(LabelPosition:namespace) | Position} of label in relation to edge\n *\n * @remarks\n *\n * Default: `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelPosition?: Types.LabelPosition;\n /**\n * How much to move label away from edge\n *\n * @remarks\n *\n * Applies only when {@link DependencyGraphProps.labelPosition} is `DependencyGraphTypes.LabelPosition.LEFT` or\n * `DependencyGraphTypes.LabelPosition.RIGHT`\n */\n labelOffset?: number;\n /**\n * Minimum number of ranks to keep between connected nodes\n */\n edgeRanks?: number;\n /**\n * Weight applied to edges in graph\n */\n edgeWeight?: number;\n /**\n * Custom edge rendering component\n */\n renderEdge?: Types.RenderEdgeFunction<EdgeData>;\n /**\n * Custom node rendering component\n */\n renderNode?: Types.RenderNodeFunction<NodeData>;\n /**\n * Custom label rendering component\n */\n renderLabel?: Types.RenderLabelFunction<EdgeData>;\n /**\n * {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs | Defs} shared by rendered SVG to be used by\n * {@link DependencyGraphProps.renderNode} and/or {@link DependencyGraphProps.renderLabel}\n */\n defs?: JSX.Element | JSX.Element[];\n /**\n * Controls zoom behavior of graph\n *\n * @remarks\n *\n * Default: `enabled`\n */\n zoom?: 'enabled' | 'disabled' | 'enable-on-click';\n /**\n * A factory for curve generators addressing both lines and areas.\n *\n * @remarks\n *\n * Default: 'curveMonotoneX'\n */\n curve?: 'curveStepBefore' | 'curveMonotoneX';\n /**\n * Controls if the arrow heads should be rendered or not.\n *\n * Default: false\n */\n showArrowHeads?: boolean;\n /**\n * Controls if the graph should be contained or grow\n *\n * @remarks\n *\n * Default: 'grow'\n */\n fit?: 'grow' | 'contain';\n /**\n * Controls if user can toggle fullscreen mode\n *\n * @remarks\n *\n * Default: true\n */\n allowFullscreen?: boolean;\n}\n\nconst WORKSPACE_ID = 'workspace';\nconst DEPENDENCY_GRAPH_SVG = 'dependency-graph';\n\n/**\n * Graph component used to visualize relations between entities\n *\n * @public\n */\nexport function DependencyGraph<NodeData, EdgeData>(\n props: DependencyGraphProps<NodeData, EdgeData>,\n) {\n const {\n edges,\n nodes,\n renderNode,\n direction = Types.Direction.TOP_BOTTOM,\n align,\n nodeMargin = 50,\n edgeMargin = 10,\n rankMargin = 50,\n paddingX = 0,\n paddingY = 0,\n acyclicer,\n ranker = Types.Ranker.NETWORK_SIMPLEX,\n labelPosition = Types.LabelPosition.RIGHT,\n labelOffset = 10,\n edgeRanks = 1,\n edgeWeight = 1,\n renderEdge,\n renderLabel,\n defs,\n zoom = 'enabled',\n curve = 'curveMonotoneX',\n showArrowHeads = false,\n fit = 'grow',\n allowFullscreen = true,\n ...svgProps\n } = props;\n const theme = useTheme();\n const [containerWidth, setContainerWidth] = useState<number>(100);\n const [containerHeight, setContainerHeight] = useState<number>(100);\n const fullScreenHandle = useFullScreenHandle();\n const styles = useStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const graph = useRef<dagre.graphlib.Graph<Types.DependencyNode<NodeData>>>(\n new dagre.graphlib.Graph(),\n );\n const [graphWidth, setGraphWidth] = useState<number>(\n graph.current.graph()?.width || 0,\n );\n const [graphHeight, setGraphHeight] = useState<number>(\n graph.current.graph()?.height || 0,\n );\n const [graphNodes, setGraphNodes] = useState<string[]>([]);\n const [graphEdges, setGraphEdges] = useState<dagre.Edge[]>([]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const [_measureRef] = useMeasure();\n const measureRef = once(_measureRef);\n\n const scalableHeight =\n fit === 'grow' && !fullScreenHandle.active ? maxHeight : '100%';\n\n const containerRef = useMemo(\n () =>\n debounce((root: HTMLDivElement) => {\n if (!root) {\n return;\n }\n measureRef(root);\n\n // Set up zooming + panning\n const node: SVGSVGElement = root.querySelector(\n `svg#${DEPENDENCY_GRAPH_SVG}`,\n ) as SVGSVGElement;\n if (!node) {\n return;\n }\n const container = d3Selection.select<SVGSVGElement, null>(node);\n const workspace = d3Selection.select(node.getElementById(WORKSPACE_ID));\n\n function enableZoom() {\n container.call(\n d3Zoom\n .zoom<SVGSVGElement, null>()\n .scaleExtent([1, Infinity])\n .on('zoom', event => {\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n maxWidth - maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n maxHeight - maxHeight * event.transform.k,\n ),\n );\n workspace.attr('transform', event.transform);\n }),\n );\n }\n\n if (zoom === 'enabled') {\n enableZoom();\n } else if (zoom === 'enable-on-click') {\n container.on('click', () => enableZoom());\n }\n\n const { width: newContainerWidth, height: newContainerHeight } =\n root.getBoundingClientRect();\n if (\n containerWidth !== newContainerWidth &&\n newContainerWidth <= maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n containerHeight !== newContainerHeight &&\n newContainerHeight <= maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, containerHeight, containerWidth, maxWidth, maxHeight, zoom],\n );\n\n const setNodesAndEdges = useCallback(() => {\n // Cleaning up lingering nodes and edges\n const currentGraphNodes = graph.current.nodes();\n const currentGraphEdges = graph.current.edges();\n\n currentGraphNodes.forEach(nodeId => {\n const remainingNode = nodes.some(node => node.id === nodeId);\n if (!remainingNode) {\n graph.current.removeNode(nodeId);\n }\n });\n\n currentGraphEdges.forEach(e => {\n const remainingEdge = edges.some(\n edge => edge.from === e.v && edge.to === e.w,\n );\n if (!remainingEdge) {\n graph.current.removeEdge(e.v, e.w);\n }\n });\n\n // Adding/updating nodes and edges\n nodes.forEach(node => {\n const existingNode = graph.current\n .nodes()\n .find(nodeId => node.id === nodeId);\n\n if (existingNode && graph.current.node(existingNode)) {\n const { width, height, x, y } = graph.current.node(existingNode);\n graph.current.setNode(existingNode, { ...node, width, height, x, y });\n } else {\n graph.current.setNode(node.id, { ...node, width: 0, height: 0 });\n }\n });\n\n edges.forEach(e => {\n graph.current.setEdge(e.from, e.to, {\n ...e,\n label: e.label,\n width: 0,\n height: 0,\n labelpos: labelPosition,\n labeloffset: labelOffset,\n weight: edgeWeight,\n minlen: edgeRanks,\n });\n });\n }, [edges, nodes, labelPosition, labelOffset, edgeWeight, edgeRanks]);\n\n const updateGraph = useMemo(\n () =>\n debounce(\n () => {\n dagre.layout(graph.current);\n const { height, width } = graph.current.graph();\n const newHeight = Math.max(0, height || 0);\n const newWidth = Math.max(0, width || 0);\n setGraphWidth(newWidth);\n setGraphHeight(newHeight);\n\n setGraphNodes(graph.current.nodes());\n setGraphEdges(graph.current.edges());\n },\n 250,\n { leading: true },\n ),\n [],\n );\n\n useEffect(() => {\n graph.current.setGraph({\n rankdir: direction,\n align,\n nodesep: nodeMargin,\n edgesep: edgeMargin,\n ranksep: rankMargin,\n marginx: paddingX,\n marginy: paddingY,\n acyclicer,\n ranker,\n });\n\n setNodesAndEdges();\n updateGraph();\n\n return updateGraph.cancel;\n }, [\n acyclicer,\n align,\n direction,\n edgeMargin,\n paddingX,\n paddingY,\n nodeMargin,\n rankMargin,\n ranker,\n setNodesAndEdges,\n updateGraph,\n ]);\n\n const setNode = useCallback(\n (id: string, node: Types.DependencyNode<NodeData>) => {\n graph.current.setNode(id, node);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n const setEdge = useCallback(\n (id: dagre.Edge, edge: Types.DependencyEdge<EdgeData>) => {\n graph.current.setEdge(id, edge);\n updateGraph();\n return graph.current;\n },\n [updateGraph],\n );\n\n return (\n <FullScreen\n handle={fullScreenHandle}\n className={classNames(\n fullScreenHandle.active ? styles.fullscreen : styles.root,\n )}\n >\n {allowFullscreen && (\n <Tooltip title={t('dependencyGraph.fullscreenTooltip')}>\n <IconButton\n className={styles.fullscreenButton}\n onClick={\n fullScreenHandle.active\n ? fullScreenHandle.exit\n : fullScreenHandle.enter\n }\n >\n {fullScreenHandle.active ? (\n <FullscreenExitIcon />\n ) : (\n <FullscreenIcon />\n )}\n </IconButton>\n </Tooltip>\n )}\n\n <div ref={containerRef} style={{ width: '100%', height: '100%' }}>\n <svg\n {...svgProps}\n width=\"100%\"\n height={scalableHeight}\n viewBox={`0 0 ${maxWidth} ${maxHeight}`}\n id={DEPENDENCY_GRAPH_SVG}\n >\n <defs>\n <marker\n id={ARROW_MARKER_ID}\n viewBox=\"0 0 24 24\"\n markerWidth=\"14\"\n markerHeight=\"14\"\n refX=\"16\"\n refY=\"12\"\n orient=\"auto\"\n markerUnits=\"strokeWidth\"\n >\n <path\n fill={theme.palette.textSubtle}\n d=\"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z\"\n />\n </marker>\n {defs}\n </defs>\n <g id={WORKSPACE_ID}>\n <svg\n width={graphWidth}\n height={graphHeight}\n y={maxHeight / 2 - graphHeight / 2}\n x={maxWidth / 2 - graphWidth / 2}\n viewBox={`-25 -25 ${graphWidth + 50} ${graphHeight + 50}`}\n >\n {graphEdges.map(e => {\n const edge = graph.current.edge(e) as GraphEdge<EdgeData>;\n if (!edge) return null;\n if (renderEdge) return renderEdge({ edge, id: e });\n\n return (\n <Edge\n key={`${e.v}-${e.w}`}\n id={e}\n setEdge={setEdge}\n render={renderLabel}\n edge={edge}\n curve={curve}\n showArrowHeads={showArrowHeads}\n />\n );\n })}\n {graphNodes.map((id: string) => {\n const node = graph.current.node(id);\n if (!node) return null;\n return (\n <Node\n key={id}\n setNode={setNode}\n render={renderNode}\n node={node}\n />\n );\n })}\n </svg>\n </g>\n </svg>\n </div>\n </FullScreen>\n );\n}\n"],"names":["Types"],"mappings":";;;;;;;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AM,OAAO,IAAA;AAClB,sBAAA,uBACE,GAAA;AAAA,wBAAC,IAAA;AAAA,wBAAA;AAAA,0BAEC,OAAA;AAAA,0BACA,MAAA,EAAQ,UAAA;AAAA,0BACR;AAAA,yBAAA;AAAA,wBAHK;AAAA,uBAIP;AAAA,oBAEJ,CAAC;AAAA;AAAA;AAAA,eACH,EACF;AAAA;AAAA;AAAA,SACF,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,27 +1,64 @@
|
|
|
1
1
|
var DependencyGraphTypes;
|
|
2
2
|
((DependencyGraphTypes2) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
DependencyGraphTypes2.Direction = {
|
|
4
|
+
/**
|
|
5
|
+
* Top to Bottom
|
|
6
|
+
*/
|
|
7
|
+
TOP_BOTTOM: "TB",
|
|
8
|
+
/**
|
|
9
|
+
* Bottom to Top
|
|
10
|
+
*/
|
|
11
|
+
BOTTOM_TOP: "BT",
|
|
12
|
+
/**
|
|
13
|
+
* Left to Right
|
|
14
|
+
*/
|
|
15
|
+
LEFT_RIGHT: "LR",
|
|
16
|
+
/**
|
|
17
|
+
* Right to Left
|
|
18
|
+
*/
|
|
19
|
+
RIGHT_LEFT: "RL"
|
|
20
|
+
};
|
|
21
|
+
DependencyGraphTypes2.Alignment = {
|
|
22
|
+
/**
|
|
23
|
+
* Up Left
|
|
24
|
+
*/
|
|
25
|
+
UP_LEFT: "UL",
|
|
26
|
+
/**
|
|
27
|
+
* Up Right
|
|
28
|
+
*/
|
|
29
|
+
UP_RIGHT: "UR",
|
|
30
|
+
/**
|
|
31
|
+
* Down Left
|
|
32
|
+
*/
|
|
33
|
+
DOWN_LEFT: "DL",
|
|
34
|
+
/**
|
|
35
|
+
* Down Right
|
|
36
|
+
*/
|
|
37
|
+
DOWN_RIGHT: "DR"
|
|
38
|
+
};
|
|
39
|
+
DependencyGraphTypes2.Ranker = {
|
|
40
|
+
/**
|
|
41
|
+
* {@link https://en.wikipedia.org/wiki/Network_simplex_algorithm | Network Simplex} algorithm
|
|
42
|
+
*/
|
|
43
|
+
NETWORK_SIMPLEX: "network-simplex",
|
|
44
|
+
/**
|
|
45
|
+
* Tight Tree algorithm
|
|
46
|
+
*/
|
|
47
|
+
TIGHT_TREE: "tight-tree",
|
|
48
|
+
/**
|
|
49
|
+
* Longest path algorithm
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
*
|
|
53
|
+
* Simplest and fastest
|
|
54
|
+
*/
|
|
55
|
+
LONGEST_PATH: "longest-path"
|
|
56
|
+
};
|
|
57
|
+
DependencyGraphTypes2.LabelPosition = {
|
|
58
|
+
LEFT: "l",
|
|
59
|
+
RIGHT: "r",
|
|
60
|
+
CENTER: "c"
|
|
61
|
+
};
|
|
25
62
|
})(DependencyGraphTypes || (DependencyGraphTypes = {}));
|
|
26
63
|
|
|
27
64
|
export { DependencyGraphTypes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../../../src/components/DependencyGraph/types.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Types used to customize and provide data to {@link DependencyGraph}\n *\n * @packageDocumentation\n */\n\nimport { ReactNode } from 'react';\n\n/**\n * Types for the {@link DependencyGraph} component.\n *\n * @public\n */\nexport namespace DependencyGraphTypes {\n /**\n * Edge of {@link DependencyGraph}\n *\n * @public\n */\n export type DependencyEdge<T = {}> = T & {\n /**\n * ID of {@link DependencyNode} from where the Edge start\n */\n from: string;\n /**\n * ID of {@link DependencyNode} to where the Edge goes to\n */\n to: string;\n /**\n * Label assigned and rendered with the Edge\n */\n label?: string;\n /**\n * Distance to a root entity\n */\n distance?: number;\n };\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderLabelFunction} for {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderLabelProps<T = unknown> = { edge: DependencyEdge<T> };\n\n /**\n * Custom React component for edge labels\n *\n * @public\n */\n export type RenderLabelFunction<T = {}> = (\n props: RenderLabelProps<T>,\n ) => ReactNode;\n\n /**\n * Node of {@link DependencyGraph}\n *\n * @public\n */\n export type DependencyNode<T = {}> = T & {\n id: string;\n };\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderNodeFunction} for {@link DependencyGraphTypes.DependencyNode}\n *\n * @public\n */\n export type RenderNodeProps<T = unknown> = { node: DependencyNode<T> };\n\n /**\n * Custom React component for graph {@link DependencyGraphTypes.DependencyNode}\n *\n * @public\n */\n export type RenderNodeFunction<T = {}> = (\n props: RenderNodeProps<T>,\n ) => ReactNode;\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderEdgeFunction} for {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderEdgeProps<T = {}> = {\n edge: T & {\n points: { x: number; y: number }[];\n label?: string;\n labeloffset?: number;\n labelpos?: string;\n width?: number;\n height?: number;\n weight?: number;\n minlen?: number;\n showArrowHeads?: boolean;\n from?: string;\n to?: string;\n relations?: string[];\n };\n id: {\n v: string;\n w: string;\n name?: string | undefined;\n };\n };\n\n /**\n * Custom React component for graph {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderEdgeFunction<T = {}> = (\n props: RenderEdgeProps<T>,\n ) => ReactNode;\n\n /**\n * Graph direction\n *\n * @public\n */\n export
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../../../src/components/DependencyGraph/types.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\n/**\n * Types used to customize and provide data to {@link DependencyGraph}\n *\n * @packageDocumentation\n */\n\nimport { ReactNode } from 'react';\n\n/**\n * Types for the {@link DependencyGraph} component.\n *\n * @public\n */\nexport namespace DependencyGraphTypes {\n /**\n * Edge of {@link DependencyGraph}\n *\n * @public\n */\n export type DependencyEdge<T = {}> = T & {\n /**\n * ID of {@link DependencyNode} from where the Edge start\n */\n from: string;\n /**\n * ID of {@link DependencyNode} to where the Edge goes to\n */\n to: string;\n /**\n * Label assigned and rendered with the Edge\n */\n label?: string;\n /**\n * Distance to a root entity\n */\n distance?: number;\n };\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderLabelFunction} for {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderLabelProps<T = unknown> = { edge: DependencyEdge<T> };\n\n /**\n * Custom React component for edge labels\n *\n * @public\n */\n export type RenderLabelFunction<T = {}> = (\n props: RenderLabelProps<T>,\n ) => ReactNode;\n\n /**\n * Node of {@link DependencyGraph}\n *\n * @public\n */\n export type DependencyNode<T = {}> = T & {\n id: string;\n };\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderNodeFunction} for {@link DependencyGraphTypes.DependencyNode}\n *\n * @public\n */\n export type RenderNodeProps<T = unknown> = { node: DependencyNode<T> };\n\n /**\n * Custom React component for graph {@link DependencyGraphTypes.DependencyNode}\n *\n * @public\n */\n export type RenderNodeFunction<T = {}> = (\n props: RenderNodeProps<T>,\n ) => ReactNode;\n\n /**\n * Properties of {@link DependencyGraphTypes.RenderEdgeFunction} for {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderEdgeProps<T = {}> = {\n edge: T & {\n points: { x: number; y: number }[];\n label?: string;\n labeloffset?: number;\n labelpos?: string;\n width?: number;\n height?: number;\n weight?: number;\n minlen?: number;\n showArrowHeads?: boolean;\n from?: string;\n to?: string;\n relations?: string[];\n };\n id: {\n v: string;\n w: string;\n name?: string | undefined;\n };\n };\n\n /**\n * Custom React component for graph {@link DependencyGraphTypes.DependencyEdge}\n *\n * @public\n */\n export type RenderEdgeFunction<T = {}> = (\n props: RenderEdgeProps<T>,\n ) => ReactNode;\n\n /**\n * Graph direction\n *\n * @public\n */\n export const Direction = {\n /**\n * Top to Bottom\n */\n TOP_BOTTOM: 'TB',\n /**\n * Bottom to Top\n */\n BOTTOM_TOP: 'BT',\n /**\n * Left to Right\n */\n LEFT_RIGHT: 'LR',\n /**\n * Right to Left\n */\n RIGHT_LEFT: 'RL',\n } as const;\n\n /**\n * @public\n */\n export type Direction = (typeof Direction)[keyof typeof Direction];\n\n /**\n * @public\n */\n export namespace Direction {\n export type TOP_BOTTOM = typeof Direction.TOP_BOTTOM;\n export type BOTTOM_TOP = typeof Direction.BOTTOM_TOP;\n export type LEFT_RIGHT = typeof Direction.LEFT_RIGHT;\n export type RIGHT_LEFT = typeof Direction.RIGHT_LEFT;\n }\n\n /**\n * Node alignment\n *\n * @public\n */\n export const Alignment = {\n /**\n * Up Left\n */\n UP_LEFT: 'UL',\n /**\n * Up Right\n */\n UP_RIGHT: 'UR',\n /**\n * Down Left\n */\n DOWN_LEFT: 'DL',\n /**\n * Down Right\n */\n DOWN_RIGHT: 'DR',\n } as const;\n\n /**\n * @public\n */\n export type Alignment = (typeof Alignment)[keyof typeof Alignment];\n\n /**\n * @public\n */\n export namespace Alignment {\n export type UP_LEFT = typeof Alignment.UP_LEFT;\n export type UP_RIGHT = typeof Alignment.UP_RIGHT;\n export type DOWN_LEFT = typeof Alignment.DOWN_LEFT;\n export type DOWN_RIGHT = typeof Alignment.DOWN_RIGHT;\n }\n\n /**\n * Algorithm used to rand nodes in graph\n *\n * @public\n */\n export const Ranker = {\n /**\n * {@link https://en.wikipedia.org/wiki/Network_simplex_algorithm | Network Simplex} algorithm\n */\n NETWORK_SIMPLEX: 'network-simplex',\n /**\n * Tight Tree algorithm\n */\n TIGHT_TREE: 'tight-tree',\n /**\n * Longest path algorithm\n *\n * @remarks\n *\n * Simplest and fastest\n */\n LONGEST_PATH: 'longest-path',\n } as const;\n\n /**\n * @public\n */\n export type Ranker = (typeof Ranker)[keyof typeof Ranker];\n\n /**\n * @public\n */\n export namespace Ranker {\n export type NETWORK_SIMPLEX = typeof Ranker.NETWORK_SIMPLEX;\n export type TIGHT_TREE = typeof Ranker.TIGHT_TREE;\n export type LONGEST_PATH = typeof Ranker.LONGEST_PATH;\n }\n\n /**\n * Position of label in relation to the edge\n *\n * @public\n */\n export const LabelPosition = {\n LEFT: 'l',\n RIGHT: 'r',\n CENTER: 'c',\n } as const;\n\n /**\n * @public\n */\n export type LabelPosition =\n (typeof LabelPosition)[keyof typeof LabelPosition];\n\n /**\n * @public\n */\n export namespace LabelPosition {\n export type LEFT = typeof LabelPosition.LEFT;\n export type RIGHT = typeof LabelPosition.RIGHT;\n export type CENTER = typeof LabelPosition.CENTER;\n }\n}\n"],"names":["DependencyGraphTypes"],"mappings":"AA+BO,IAAU;AAAA,CAAV,CAAUA,qBAAAA,KAAV;AA2GE,EAAMA,sBAAA,SAAA,GAAY;AAAA;AAAA;AAAA;AAAA,IAIvB,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA;AAAA,IAIZ,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA;AAAA,IAIZ,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA;AAAA,IAIZ,UAAA,EAAY;AAAA,GACd;AAsBO,EAAMA,sBAAA,SAAA,GAAY;AAAA;AAAA;AAAA;AAAA,IAIvB,OAAA,EAAS,IAAA;AAAA;AAAA;AAAA;AAAA,IAIT,QAAA,EAAU,IAAA;AAAA;AAAA;AAAA;AAAA,IAIV,SAAA,EAAW,IAAA;AAAA;AAAA;AAAA;AAAA,IAIX,UAAA,EAAY;AAAA,GACd;AAsBO,EAAMA,sBAAA,MAAA,GAAS;AAAA;AAAA;AAAA;AAAA,IAIpB,eAAA,EAAiB,iBAAA;AAAA;AAAA;AAAA;AAAA,IAIjB,UAAA,EAAY,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQZ,YAAA,EAAc;AAAA,GAChB;AAqBO,EAAMA,sBAAA,aAAA,GAAgB;AAAA,IAC3B,IAAA,EAAM,GAAA;AAAA,IACN,KAAA,EAAO,GAAA;AAAA,IACP,MAAA,EAAQ;AAAA,GACV;AAAA,CAAA,EAnOe,oBAAA,KAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.esm.js","sources":["../../../src/components/LogViewer/styles.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { alpha, makeStyles } from '@material-ui/core/styles';\nimport * as colors from '@material-ui/core/colors';\n\nexport const HEADER_SIZE = 40;\n\n/** @public Class keys for overriding LogViewer styles */\nexport type LogViewerClassKey =\n | 'root'\n | 'header'\n | 'log'\n | 'line'\n | 'lineSelected'\n | 'lineCopyButton'\n | 'lineNumber'\n | 'textHighlight'\n | 'textSelectedHighlight'\n | 'modifierBold'\n | 'modifierItalic'\n | 'modifierUnderline'\n | 'modifierForegroundBlack'\n | 'modifierForegroundRed'\n | 'modifierForegroundGreen'\n | 'modifierForegroundYellow'\n | 'modifierForegroundBlue'\n | 'modifierForegroundMagenta'\n | 'modifierForegroundCyan'\n | 'modifierForegroundWhite'\n | 'modifierForegroundGrey'\n | 'modifierBackgroundBlack'\n | 'modifierBackgroundRed'\n | 'modifierBackgroundGreen'\n | 'modifierBackgroundYellow'\n | 'modifierBackgroundBlue'\n | 'modifierBackgroundMagenta'\n | 'modifierBackgroundCyan'\n | 'modifierBackgroundWhite'\n | 'modifierBackgroundGrey';\n\nexport const useStyles = makeStyles(\n theme => ({\n root: {\n background: theme.palette.background.paper,\n },\n header: {\n height: HEADER_SIZE,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n log: {\n fontFamily: '\"Monaco\", monospace',\n fontSize: theme.typography.pxToRem(12),\n lineHeight: '20px',\n },\n line: {\n position: 'relative',\n whiteSpace: 'pre',\n display: 'flex',\n alignItems: 'flex-start',\n\n '&:hover': {\n background: theme.palette.action.hover,\n },\n },\n lineSelected: {\n background: theme.palette.action.selected,\n\n '&:hover': {\n background: theme.palette.action.selected,\n },\n },\n lineCopyButton: {\n position: 'absolute',\n paddingTop: 0,\n paddingBottom: 0,\n },\n lineNumber: {\n display: 'inline-block',\n textAlign: 'end',\n width: 60,\n marginRight: theme.spacing(1),\n cursor: 'pointer',\n flexShrink: 0,\n },\n textHighlight: {\n background: alpha(theme.palette.info.main, 0.15),\n },\n textSelectedHighlight: {\n background: alpha(theme.palette.info.main, 0.4),\n },\n modifierBold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n modifierItalic: {\n fontStyle: 'italic',\n },\n modifierUnderline: {\n textDecoration: 'underline',\n },\n modifierForegroundBlack: {\n color: colors.common.black,\n },\n modifierForegroundRed: {\n color: colors.red[500],\n },\n modifierForegroundGreen: {\n color: colors.green[500],\n },\n modifierForegroundYellow: {\n color: colors.yellow[500],\n },\n modifierForegroundBlue: {\n color: colors.blue[500],\n },\n modifierForegroundMagenta: {\n color: colors.purple[500],\n },\n modifierForegroundCyan: {\n color: colors.cyan[500],\n },\n modifierForegroundWhite: {\n color: colors.common.white,\n },\n modifierForegroundGrey: {\n color: colors.grey[500],\n },\n modifierBackgroundBlack: {\n background: colors.common.black,\n },\n modifierBackgroundRed: {\n background: colors.red[500],\n },\n modifierBackgroundGreen: {\n background: colors.green[500],\n },\n modifierBackgroundYellow: {\n background: colors.yellow[500],\n },\n modifierBackgroundBlue: {\n background: colors.blue[500],\n },\n modifierBackgroundMagenta: {\n background: colors.purple[500],\n },\n modifierBackgroundCyan: {\n background: colors.cyan[500],\n },\n modifierBackgroundWhite: {\n background: colors.common.white,\n },\n modifierBackgroundGrey: {\n background: colors.grey[500],\n },\n textWrap: {\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-all',\n },\n }),\n { name: 'BackstageLogViewer' },\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,WAAA,GAAc;AAmCpB,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA,KACvC;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,MAAA,EAAQ,WAAA;AAAA,MACR,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,QAAA;AAAA,MACZ,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,GAAA,EAAK;AAAA,MACH,UAAA,EAAY,qBAAA;AAAA,MACZ,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,EAAE,CA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,MAAA,CAAO,IAAA,CAAK,GAAG;AAAA,KAC7B;AAAA,IACA,yBAAA,EAA2B;AAAA,MACzB,UAAA,EAAY,MAAA,CAAO,MAAA,CAAO,GAAG;AAAA,KAC/B;AAAA,IACA,sBAAA,EAAwB;AAAA,MACtB,UAAA,EAAY,MAAA,CAAO,IAAA,CAAK,GAAG;AAAA,KAC7B;AAAA,IACA,uBAAA,EAAyB;AAAA,MACvB,UAAA,EAAY,OAAO,MAAA,CAAO;AAAA,KAC5B;AAAA,IACA,sBAAA,EAAwB;AAAA,MACtB,UAAA,EAAY,MAAA,CAAO,IAAA,CAAK,GAAG;AAAA,KAC7B;AAAA,IACA,QAAA,EAAU;AAAA,MACR,UAAA,EAAY,UAAA;AAAA,MACZ,SAAA,EAAW;AAAA;AACb,GACF,CAAA;AAAA,EACA,EAAE,MAAM,oBAAA;AACV;;;;"}
|
|
1
|
+
{"version":3,"file":"styles.esm.js","sources":["../../../src/components/LogViewer/styles.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { alpha, makeStyles } from '@material-ui/core/styles';\nimport * as colors from '@material-ui/core/colors';\n\nexport const HEADER_SIZE = 40;\n\n/** @public Class keys for overriding LogViewer styles */\nexport type LogViewerClassKey =\n | 'root'\n | 'header'\n | 'log'\n | 'line'\n | 'lineSelected'\n | 'lineCopyButton'\n | 'lineNumber'\n | 'textHighlight'\n | 'textSelectedHighlight'\n | 'modifierBold'\n | 'modifierItalic'\n | 'modifierUnderline'\n | 'modifierForegroundBlack'\n | 'modifierForegroundRed'\n | 'modifierForegroundGreen'\n | 'modifierForegroundYellow'\n | 'modifierForegroundBlue'\n | 'modifierForegroundMagenta'\n | 'modifierForegroundCyan'\n | 'modifierForegroundWhite'\n | 'modifierForegroundGrey'\n | 'modifierBackgroundBlack'\n | 'modifierBackgroundRed'\n | 'modifierBackgroundGreen'\n | 'modifierBackgroundYellow'\n | 'modifierBackgroundBlue'\n | 'modifierBackgroundMagenta'\n | 'modifierBackgroundCyan'\n | 'modifierBackgroundWhite'\n | 'modifierBackgroundGrey';\n\nexport const useStyles = makeStyles(\n theme => ({\n root: {\n background: theme.palette.background.paper,\n },\n header: {\n height: HEADER_SIZE,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n log: {\n fontFamily: '\"Monaco\", monospace',\n fontSize: theme.typography.pxToRem(12),\n lineHeight: '20px',\n },\n line: {\n position: 'relative',\n whiteSpace: 'pre',\n display: 'flex',\n alignItems: 'flex-start',\n\n '&:hover': {\n background: theme.palette.action.hover,\n },\n },\n lineSelected: {\n background: theme.palette.action.selected,\n\n '&:hover': {\n background: theme.palette.action.selected,\n },\n },\n lineCopyButton: {\n position: 'absolute',\n paddingTop: 0,\n paddingBottom: 0,\n },\n lineNumber: {\n display: 'inline-block',\n textAlign: 'end',\n width: 60,\n marginRight: theme.spacing(1),\n cursor: 'pointer',\n flexShrink: 0,\n userSelect: 'none',\n },\n textHighlight: {\n background: alpha(theme.palette.info.main, 0.15),\n },\n textSelectedHighlight: {\n background: alpha(theme.palette.info.main, 0.4),\n },\n modifierBold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n modifierItalic: {\n fontStyle: 'italic',\n },\n modifierUnderline: {\n textDecoration: 'underline',\n },\n modifierForegroundBlack: {\n color: colors.common.black,\n },\n modifierForegroundRed: {\n color: colors.red[500],\n },\n modifierForegroundGreen: {\n color: colors.green[500],\n },\n modifierForegroundYellow: {\n color: colors.yellow[500],\n },\n modifierForegroundBlue: {\n color: colors.blue[500],\n },\n modifierForegroundMagenta: {\n color: colors.purple[500],\n },\n modifierForegroundCyan: {\n color: colors.cyan[500],\n },\n modifierForegroundWhite: {\n color: colors.common.white,\n },\n modifierForegroundGrey: {\n color: colors.grey[500],\n },\n modifierBackgroundBlack: {\n background: colors.common.black,\n },\n modifierBackgroundRed: {\n background: colors.red[500],\n },\n modifierBackgroundGreen: {\n background: colors.green[500],\n },\n modifierBackgroundYellow: {\n background: colors.yellow[500],\n },\n modifierBackgroundBlue: {\n background: colors.blue[500],\n },\n modifierBackgroundMagenta: {\n background: colors.purple[500],\n },\n modifierBackgroundCyan: {\n background: colors.cyan[500],\n },\n modifierBackgroundWhite: {\n background: colors.common.white,\n },\n modifierBackgroundGrey: {\n background: colors.grey[500],\n },\n textWrap: {\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-all',\n },\n }),\n { name: 'BackstageLogViewer' },\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,WAAA,GAAc;AAmCpB,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA,KACvC;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,MAAA,EAAQ,WAAA;AAAA,MACR,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,QAAA;AAAA,MACZ,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,GAAA,EAAK;AAAA,MACH,UAAA,EAAY,qBAAA;AAAA,MACZ,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,OAAA,CAAQ,EAAE,CAAA;AAAA,MACrC,UAAA,EAAY;AAAA,KACd;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU,UAAA;AAAA,MACV,UAAA,EAAY,KAAA;AAAA,MACZ,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,YAAA;AAAA,MAEZ,SAAA,EAAW;AAAA,QACT,UAAA,EAAY,KAAA,CA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AAK,GAAG;AAAA,KAC7B;AAAA,IACA,uBAAA,EAAyB;AAAA,MACvB,UAAA,EAAY,OAAO,MAAA,CAAO;AAAA,KAC5B;AAAA,IACA,sBAAA,EAAwB;AAAA,MACtB,UAAA,EAAY,MAAA,CAAO,IAAA,CAAK,GAAG;AAAA,KAC7B;AAAA,IACA,QAAA,EAAU;AAAA,MACR,UAAA,EAAY,UAAA;AAAA,MACZ,SAAA,EAAW;AAAA;AACb,GACF,CAAA;AAAA,EACA,EAAE,MAAM,oBAAA;AACV;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -419,61 +419,87 @@ declare namespace DependencyGraphTypes {
|
|
|
419
419
|
*
|
|
420
420
|
* @public
|
|
421
421
|
*/
|
|
422
|
-
|
|
422
|
+
const Direction: {
|
|
423
423
|
/**
|
|
424
424
|
* Top to Bottom
|
|
425
425
|
*/
|
|
426
|
-
TOP_BOTTOM
|
|
426
|
+
readonly TOP_BOTTOM: "TB";
|
|
427
427
|
/**
|
|
428
428
|
* Bottom to Top
|
|
429
429
|
*/
|
|
430
|
-
BOTTOM_TOP
|
|
430
|
+
readonly BOTTOM_TOP: "BT";
|
|
431
431
|
/**
|
|
432
432
|
* Left to Right
|
|
433
433
|
*/
|
|
434
|
-
LEFT_RIGHT
|
|
434
|
+
readonly LEFT_RIGHT: "LR";
|
|
435
435
|
/**
|
|
436
436
|
* Right to Left
|
|
437
437
|
*/
|
|
438
|
-
RIGHT_LEFT
|
|
438
|
+
readonly RIGHT_LEFT: "RL";
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* @public
|
|
442
|
+
*/
|
|
443
|
+
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
444
|
+
/**
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
447
|
+
namespace Direction {
|
|
448
|
+
type TOP_BOTTOM = typeof Direction.TOP_BOTTOM;
|
|
449
|
+
type BOTTOM_TOP = typeof Direction.BOTTOM_TOP;
|
|
450
|
+
type LEFT_RIGHT = typeof Direction.LEFT_RIGHT;
|
|
451
|
+
type RIGHT_LEFT = typeof Direction.RIGHT_LEFT;
|
|
439
452
|
}
|
|
440
453
|
/**
|
|
441
454
|
* Node alignment
|
|
442
455
|
*
|
|
443
456
|
* @public
|
|
444
457
|
*/
|
|
445
|
-
|
|
458
|
+
const Alignment: {
|
|
446
459
|
/**
|
|
447
460
|
* Up Left
|
|
448
461
|
*/
|
|
449
|
-
UP_LEFT
|
|
462
|
+
readonly UP_LEFT: "UL";
|
|
450
463
|
/**
|
|
451
464
|
* Up Right
|
|
452
465
|
*/
|
|
453
|
-
UP_RIGHT
|
|
466
|
+
readonly UP_RIGHT: "UR";
|
|
454
467
|
/**
|
|
455
468
|
* Down Left
|
|
456
469
|
*/
|
|
457
|
-
DOWN_LEFT
|
|
470
|
+
readonly DOWN_LEFT: "DL";
|
|
458
471
|
/**
|
|
459
472
|
* Down Right
|
|
460
473
|
*/
|
|
461
|
-
DOWN_RIGHT
|
|
474
|
+
readonly DOWN_RIGHT: "DR";
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* @public
|
|
478
|
+
*/
|
|
479
|
+
type Alignment = (typeof Alignment)[keyof typeof Alignment];
|
|
480
|
+
/**
|
|
481
|
+
* @public
|
|
482
|
+
*/
|
|
483
|
+
namespace Alignment {
|
|
484
|
+
type UP_LEFT = typeof Alignment.UP_LEFT;
|
|
485
|
+
type UP_RIGHT = typeof Alignment.UP_RIGHT;
|
|
486
|
+
type DOWN_LEFT = typeof Alignment.DOWN_LEFT;
|
|
487
|
+
type DOWN_RIGHT = typeof Alignment.DOWN_RIGHT;
|
|
462
488
|
}
|
|
463
489
|
/**
|
|
464
490
|
* Algorithm used to rand nodes in graph
|
|
465
491
|
*
|
|
466
492
|
* @public
|
|
467
493
|
*/
|
|
468
|
-
|
|
494
|
+
const Ranker: {
|
|
469
495
|
/**
|
|
470
496
|
* {@link https://en.wikipedia.org/wiki/Network_simplex_algorithm | Network Simplex} algorithm
|
|
471
497
|
*/
|
|
472
|
-
NETWORK_SIMPLEX
|
|
498
|
+
readonly NETWORK_SIMPLEX: "network-simplex";
|
|
473
499
|
/**
|
|
474
500
|
* Tight Tree algorithm
|
|
475
501
|
*/
|
|
476
|
-
TIGHT_TREE
|
|
502
|
+
readonly TIGHT_TREE: "tight-tree";
|
|
477
503
|
/**
|
|
478
504
|
* Longest path algorithm
|
|
479
505
|
*
|
|
@@ -481,17 +507,41 @@ declare namespace DependencyGraphTypes {
|
|
|
481
507
|
*
|
|
482
508
|
* Simplest and fastest
|
|
483
509
|
*/
|
|
484
|
-
LONGEST_PATH
|
|
510
|
+
readonly LONGEST_PATH: "longest-path";
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* @public
|
|
514
|
+
*/
|
|
515
|
+
type Ranker = (typeof Ranker)[keyof typeof Ranker];
|
|
516
|
+
/**
|
|
517
|
+
* @public
|
|
518
|
+
*/
|
|
519
|
+
namespace Ranker {
|
|
520
|
+
type NETWORK_SIMPLEX = typeof Ranker.NETWORK_SIMPLEX;
|
|
521
|
+
type TIGHT_TREE = typeof Ranker.TIGHT_TREE;
|
|
522
|
+
type LONGEST_PATH = typeof Ranker.LONGEST_PATH;
|
|
485
523
|
}
|
|
486
524
|
/**
|
|
487
525
|
* Position of label in relation to the edge
|
|
488
526
|
*
|
|
489
527
|
* @public
|
|
490
528
|
*/
|
|
491
|
-
|
|
492
|
-
LEFT
|
|
493
|
-
RIGHT
|
|
494
|
-
CENTER
|
|
529
|
+
const LabelPosition: {
|
|
530
|
+
readonly LEFT: "l";
|
|
531
|
+
readonly RIGHT: "r";
|
|
532
|
+
readonly CENTER: "c";
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
type LabelPosition = (typeof LabelPosition)[keyof typeof LabelPosition];
|
|
538
|
+
/**
|
|
539
|
+
* @public
|
|
540
|
+
*/
|
|
541
|
+
namespace LabelPosition {
|
|
542
|
+
type LEFT = typeof LabelPosition.LEFT;
|
|
543
|
+
type RIGHT = typeof LabelPosition.RIGHT;
|
|
544
|
+
type CENTER = typeof LabelPosition.CENTER;
|
|
495
545
|
}
|
|
496
546
|
}
|
|
497
547
|
|
|
@@ -512,7 +562,7 @@ interface DependencyGraphProps<NodeData, EdgeData> extends SVGProps<SVGSVGElemen
|
|
|
512
562
|
*/
|
|
513
563
|
nodes: DependencyGraphTypes.DependencyNode<NodeData>[];
|
|
514
564
|
/**
|
|
515
|
-
* Graph {@link DependencyGraphTypes.Direction | direction}
|
|
565
|
+
* Graph {@link DependencyGraphTypes.(Direction:namespace) | direction}
|
|
516
566
|
*
|
|
517
567
|
* @remarks
|
|
518
568
|
*
|
|
@@ -520,7 +570,7 @@ interface DependencyGraphProps<NodeData, EdgeData> extends SVGProps<SVGSVGElemen
|
|
|
520
570
|
*/
|
|
521
571
|
direction?: DependencyGraphTypes.Direction;
|
|
522
572
|
/**
|
|
523
|
-
* Node {@link DependencyGraphTypes.Alignment | alignment}
|
|
573
|
+
* Node {@link DependencyGraphTypes.(Alignment:namespace) | alignment}
|
|
524
574
|
*/
|
|
525
575
|
align?: DependencyGraphTypes.Alignment;
|
|
526
576
|
/**
|
|
@@ -568,7 +618,7 @@ interface DependencyGraphProps<NodeData, EdgeData> extends SVGProps<SVGSVGElemen
|
|
|
568
618
|
*/
|
|
569
619
|
acyclicer?: 'greedy';
|
|
570
620
|
/**
|
|
571
|
-
* {@link DependencyGraphTypes.Ranker | Algorithm} used to rank nodes
|
|
621
|
+
* {@link DependencyGraphTypes.(Ranker:namespace) | Algorithm} used to rank nodes
|
|
572
622
|
*
|
|
573
623
|
* @remarks
|
|
574
624
|
*
|
|
@@ -576,7 +626,7 @@ interface DependencyGraphProps<NodeData, EdgeData> extends SVGProps<SVGSVGElemen
|
|
|
576
626
|
*/
|
|
577
627
|
ranker?: DependencyGraphTypes.Ranker;
|
|
578
628
|
/**
|
|
579
|
-
* {@link DependencyGraphTypes.LabelPosition | Position} of label in relation to edge
|
|
629
|
+
* {@link DependencyGraphTypes.(LabelPosition:namespace) | Position} of label in relation to edge
|
|
580
630
|
*
|
|
581
631
|
* @remarks
|
|
582
632
|
*
|
|
@@ -70,6 +70,11 @@ const useStyles = makeStyles(
|
|
|
70
70
|
}),
|
|
71
71
|
{ name: "BackstageSidebar" }
|
|
72
72
|
);
|
|
73
|
+
const State = {
|
|
74
|
+
Closed: 0,
|
|
75
|
+
Idle: 1,
|
|
76
|
+
Open: 2
|
|
77
|
+
};
|
|
73
78
|
const DesktopSidebar = (props) => {
|
|
74
79
|
const { sidebarConfig } = useContext(SidebarConfigContext);
|
|
75
80
|
const {
|
|
@@ -83,7 +88,9 @@ const DesktopSidebar = (props) => {
|
|
|
83
88
|
(theme) => theme.breakpoints.down("md"),
|
|
84
89
|
{ noSsr: true }
|
|
85
90
|
);
|
|
86
|
-
const [state, setState] = useState(
|
|
91
|
+
const [state, setState] = useState(
|
|
92
|
+
State.Closed
|
|
93
|
+
);
|
|
87
94
|
const hoverTimerRef = useRef();
|
|
88
95
|
const { isPinned, toggleSidebarPinState } = useSidebarPinState();
|
|
89
96
|
const handleOpen = () => {
|
|
@@ -94,12 +101,12 @@ const DesktopSidebar = (props) => {
|
|
|
94
101
|
clearTimeout(hoverTimerRef.current);
|
|
95
102
|
hoverTimerRef.current = void 0;
|
|
96
103
|
}
|
|
97
|
-
if (state !==
|
|
104
|
+
if (state !== State.Open && !isSmallScreen) {
|
|
98
105
|
hoverTimerRef.current = window.setTimeout(() => {
|
|
99
106
|
hoverTimerRef.current = void 0;
|
|
100
|
-
setState(
|
|
107
|
+
setState(State.Open);
|
|
101
108
|
}, openDelayMs);
|
|
102
|
-
setState(
|
|
109
|
+
setState(State.Idle);
|
|
103
110
|
}
|
|
104
111
|
};
|
|
105
112
|
const handleClose = () => {
|
|
@@ -110,22 +117,22 @@ const DesktopSidebar = (props) => {
|
|
|
110
117
|
clearTimeout(hoverTimerRef.current);
|
|
111
118
|
hoverTimerRef.current = void 0;
|
|
112
119
|
}
|
|
113
|
-
if (state ===
|
|
114
|
-
setState(
|
|
115
|
-
} else if (state ===
|
|
120
|
+
if (state === State.Idle) {
|
|
121
|
+
setState(State.Closed);
|
|
122
|
+
} else if (state === State.Open) {
|
|
116
123
|
hoverTimerRef.current = window.setTimeout(() => {
|
|
117
124
|
hoverTimerRef.current = void 0;
|
|
118
|
-
setState(
|
|
125
|
+
setState(State.Closed);
|
|
119
126
|
}, closeDelayMs);
|
|
120
127
|
}
|
|
121
128
|
};
|
|
122
|
-
const isOpen = state ===
|
|
129
|
+
const isOpen = state === State.Open && !isSmallScreen || isPinned;
|
|
123
130
|
const setOpen = (open) => {
|
|
124
131
|
if (open) {
|
|
125
|
-
setState(
|
|
132
|
+
setState(State.Open);
|
|
126
133
|
toggleSidebarPinState();
|
|
127
134
|
} else {
|
|
128
|
-
setState(
|
|
135
|
+
setState(State.Closed);
|
|
129
136
|
toggleSidebarPinState();
|
|
130
137
|
}
|
|
131
138
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.esm.js","sources":["../../../src/layout/Sidebar/Bar.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport classnames from 'classnames';\nimport { ReactNode, useContext, useRef, useState } from 'react';\n\nimport {\n makeSidebarConfig,\n makeSidebarSubmenuConfig,\n SidebarConfig,\n SidebarConfigContext,\n SidebarOptions,\n SubmenuConfig,\n SubmenuOptions,\n} from './config';\nimport { MobileSidebar } from './MobileSidebar';\nimport { useContent } from './Page';\nimport { SidebarOpenStateProvider } from './SidebarOpenStateContext';\nimport { useSidebarPinState } from './SidebarPinStateContext';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\n/** @public */\nexport type SidebarClassKey = 'drawer' | 'drawerOpen';\nconst useStyles = makeStyles<Theme, { sidebarConfig: SidebarConfig }>(\n theme => ({\n root: {\n left: 0,\n top: 0,\n bottom: 0,\n zIndex: theme.zIndex.appBar,\n position: 'fixed',\n },\n drawer: {\n display: 'flex',\n flexFlow: 'column nowrap',\n alignItems: 'flex-start',\n left: 0,\n top: 0,\n bottom: 0,\n position: 'absolute',\n background: theme.palette.navigation.background,\n overflowX: 'hidden',\n msOverflowStyle: 'none',\n scrollbarWidth: 'none',\n transition: theme.transitions.create('width', {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.shortest,\n }),\n '& > *': {\n flexShrink: 0,\n },\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n '@media print': {\n display: 'none',\n },\n },\n drawerWidth: props => ({\n width: props.sidebarConfig.drawerWidthClosed,\n }),\n drawerOpen: props => ({\n width: props.sidebarConfig.drawerWidthOpen,\n transition: theme.transitions.create('width', {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.shorter,\n }),\n }),\n visuallyHidden: {\n top: 0,\n position: 'absolute',\n zIndex: 1000,\n transform: 'translateY(-200%)',\n '&:focus': {\n transform: 'translateY(5px)',\n },\n },\n }),\n { name: 'BackstageSidebar' },\n);\n\nenum State {\n Closed,\n Idle,\n Open,\n}\n\n/** @public */\nexport type SidebarProps = {\n openDelayMs?: number;\n closeDelayMs?: number;\n sidebarOptions?: SidebarOptions;\n submenuOptions?: SubmenuOptions;\n disableExpandOnHover?: boolean;\n children?: ReactNode;\n};\n\nexport type DesktopSidebarProps = {\n openDelayMs?: number;\n closeDelayMs?: number;\n disableExpandOnHover?: boolean;\n children?: ReactNode;\n};\n\n/**\n * Places the Sidebar & wraps the children providing context weather the `Sidebar` is open or not.\n *\n * Handles & delays hover events for expanding the `Sidebar`\n *\n * @param props `disableExpandOnHover` disables the default hover behaviour;\n * `openDelayMs` & `closeDelayMs` set delay until sidebar will open/close on hover\n * @returns\n * @internal\n */\nconst DesktopSidebar = (props: DesktopSidebarProps) => {\n const { sidebarConfig } = useContext(SidebarConfigContext);\n const {\n openDelayMs = sidebarConfig.defaultOpenDelayMs,\n closeDelayMs = sidebarConfig.defaultCloseDelayMs,\n disableExpandOnHover,\n children,\n } = props;\n\n const classes = useStyles({ sidebarConfig });\n const isSmallScreen = useMediaQuery<Theme>(\n theme => theme.breakpoints.down('md'),\n { noSsr: true },\n );\n const [state, setState] = useState(State.Closed);\n const hoverTimerRef = useRef<number>();\n const { isPinned, toggleSidebarPinState } = useSidebarPinState();\n\n const handleOpen = () => {\n if (isPinned || disableExpandOnHover) {\n return;\n }\n if (hoverTimerRef.current) {\n clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = undefined;\n }\n if (state !== State.Open && !isSmallScreen) {\n hoverTimerRef.current = window.setTimeout(() => {\n hoverTimerRef.current = undefined;\n setState(State.Open);\n }, openDelayMs);\n\n setState(State.Idle);\n }\n };\n\n const handleClose = () => {\n if (isPinned || disableExpandOnHover) {\n return;\n }\n if (hoverTimerRef.current) {\n clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = undefined;\n }\n if (state === State.Idle) {\n setState(State.Closed);\n } else if (state === State.Open) {\n hoverTimerRef.current = window.setTimeout(() => {\n hoverTimerRef.current = undefined;\n setState(State.Closed);\n }, closeDelayMs);\n }\n };\n\n const isOpen = (state === State.Open && !isSmallScreen) || isPinned;\n\n /**\n * Close/Open Sidebar directly without delays. Also toggles `SidebarPinState` to avoid hidden content behind Sidebar.\n */\n const setOpen = (open: boolean) => {\n if (open) {\n setState(State.Open);\n toggleSidebarPinState();\n } else {\n setState(State.Closed);\n toggleSidebarPinState();\n }\n };\n\n return (\n <nav style={{}} aria-label=\"sidebar nav\">\n <A11ySkipSidebar />\n <SidebarOpenStateProvider value={{ isOpen, setOpen }}>\n <Box\n className={classes.root}\n data-testid=\"sidebar-root\"\n onMouseEnter={disableExpandOnHover ? () => {} : handleOpen}\n onFocus={disableExpandOnHover ? () => {} : handleOpen}\n onMouseLeave={disableExpandOnHover ? () => {} : handleClose}\n onBlur={disableExpandOnHover ? () => {} : handleClose}\n >\n <Box\n className={classnames(classes.drawer, classes.drawerWidth, {\n [classes.drawerOpen]: isOpen,\n })}\n >\n {children}\n </Box>\n </Box>\n </SidebarOpenStateProvider>\n </nav>\n );\n};\n\n/**\n * Passing children into the desktop or mobile sidebar depending on the context\n *\n * @public\n */\nexport const Sidebar = (props: SidebarProps) => {\n const sidebarConfig: SidebarConfig = makeSidebarConfig(\n props.sidebarOptions ?? {},\n );\n const submenuConfig: SubmenuConfig = makeSidebarSubmenuConfig(\n props.submenuOptions ?? {},\n );\n const { children, disableExpandOnHover, openDelayMs, closeDelayMs } = props;\n const { isMobile } = useSidebarPinState();\n\n return isMobile ? (\n <MobileSidebar>{children}</MobileSidebar>\n ) : (\n <SidebarConfigContext.Provider value={{ sidebarConfig, submenuConfig }}>\n <DesktopSidebar\n openDelayMs={openDelayMs}\n closeDelayMs={closeDelayMs}\n disableExpandOnHover={disableExpandOnHover}\n >\n {children}\n </DesktopSidebar>\n </SidebarConfigContext.Provider>\n );\n};\n\nfunction A11ySkipSidebar() {\n const { sidebarConfig } = useContext(SidebarConfigContext);\n const { focusContent, contentRef } = useContent();\n const classes = useStyles({ sidebarConfig });\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!contentRef?.current) {\n return null;\n }\n return (\n <Button\n onClick={focusContent}\n variant=\"contained\"\n className={classnames(classes.visuallyHidden)}\n >\n {t('skipToContent')}\n </Button>\n );\n}\n"],"names":["classnames"],"mappings":";;;;;;;;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,QAAA,EAAU,oBAAA,EAAsB,WAAA,EAAa,cAAa,GAAI,KAAA;AACtE,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,kBAAA,EAAmB;AAExC,EAAA,OAAO,QAAA,mBACL,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAS,CAAA,mBAEzB,GAAA,CAAC,oBAAA,CAAqB,QAAA,EAArB,EAA8B,KAAA,EAAO,EAAE,aAAA,EAAe,eAAc,EACnE,QAAA,kBAAA,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,YAAA;AAAA,MACA,oBAAA;AAAA,MAEC;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;AAEA,SAAS,eAAA,GAAkB;AACzB,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,UAAA,CAAW,oBAAoB,CAAA;AACzD,EAAA,MAAM,EAAE,YAAA,EAAc,UAAA,EAAW,GAAI,UAAA,EAAW;AAChD,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,EAAE,aAAA,EAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,4BAA4B,CAAA;AAE5D,EAAA,IAAI,CAAC,YAAY,OAAA,EAAS;AACxB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,YAAA;AAAA,MACT,OAAA,EAAQ,WAAA;AAAA,MACR,SAAA,EAAWA,UAAA,CAAW,OAAA,CAAQ,cAAc,CAAA;AAAA,MAE3C,YAAE,eAAe;AAAA;AAAA,GACpB;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Bar.esm.js","sources":["../../../src/layout/Sidebar/Bar.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport classnames from 'classnames';\nimport { ReactNode, useContext, useRef, useState } from 'react';\n\nimport {\n makeSidebarConfig,\n makeSidebarSubmenuConfig,\n SidebarConfig,\n SidebarConfigContext,\n SidebarOptions,\n SubmenuConfig,\n SubmenuOptions,\n} from './config';\nimport { MobileSidebar } from './MobileSidebar';\nimport { useContent } from './Page';\nimport { SidebarOpenStateProvider } from './SidebarOpenStateContext';\nimport { useSidebarPinState } from './SidebarPinStateContext';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { coreComponentsTranslationRef } from '../../translation';\n\n/** @public */\nexport type SidebarClassKey = 'drawer' | 'drawerOpen';\nconst useStyles = makeStyles<Theme, { sidebarConfig: SidebarConfig }>(\n theme => ({\n root: {\n left: 0,\n top: 0,\n bottom: 0,\n zIndex: theme.zIndex.appBar,\n position: 'fixed',\n },\n drawer: {\n display: 'flex',\n flexFlow: 'column nowrap',\n alignItems: 'flex-start',\n left: 0,\n top: 0,\n bottom: 0,\n position: 'absolute',\n background: theme.palette.navigation.background,\n overflowX: 'hidden',\n msOverflowStyle: 'none',\n scrollbarWidth: 'none',\n transition: theme.transitions.create('width', {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.shortest,\n }),\n '& > *': {\n flexShrink: 0,\n },\n '&::-webkit-scrollbar': {\n display: 'none',\n },\n '@media print': {\n display: 'none',\n },\n },\n drawerWidth: props => ({\n width: props.sidebarConfig.drawerWidthClosed,\n }),\n drawerOpen: props => ({\n width: props.sidebarConfig.drawerWidthOpen,\n transition: theme.transitions.create('width', {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.shorter,\n }),\n }),\n visuallyHidden: {\n top: 0,\n position: 'absolute',\n zIndex: 1000,\n transform: 'translateY(-200%)',\n '&:focus': {\n transform: 'translateY(5px)',\n },\n },\n }),\n { name: 'BackstageSidebar' },\n);\n\nconst State = {\n Closed: 0,\n Idle: 1,\n Open: 2,\n} as const;\n\n/** @public */\nexport type SidebarProps = {\n openDelayMs?: number;\n closeDelayMs?: number;\n sidebarOptions?: SidebarOptions;\n submenuOptions?: SubmenuOptions;\n disableExpandOnHover?: boolean;\n children?: ReactNode;\n};\n\nexport type DesktopSidebarProps = {\n openDelayMs?: number;\n closeDelayMs?: number;\n disableExpandOnHover?: boolean;\n children?: ReactNode;\n};\n\n/**\n * Places the Sidebar & wraps the children providing context weather the `Sidebar` is open or not.\n *\n * Handles & delays hover events for expanding the `Sidebar`\n *\n * @param props `disableExpandOnHover` disables the default hover behaviour;\n * `openDelayMs` & `closeDelayMs` set delay until sidebar will open/close on hover\n * @returns\n * @internal\n */\nconst DesktopSidebar = (props: DesktopSidebarProps) => {\n const { sidebarConfig } = useContext(SidebarConfigContext);\n const {\n openDelayMs = sidebarConfig.defaultOpenDelayMs,\n closeDelayMs = sidebarConfig.defaultCloseDelayMs,\n disableExpandOnHover,\n children,\n } = props;\n\n const classes = useStyles({ sidebarConfig });\n const isSmallScreen = useMediaQuery<Theme>(\n theme => theme.breakpoints.down('md'),\n { noSsr: true },\n );\n const [state, setState] = useState<(typeof State)[keyof typeof State]>(\n State.Closed,\n );\n const hoverTimerRef = useRef<number>();\n const { isPinned, toggleSidebarPinState } = useSidebarPinState();\n\n const handleOpen = () => {\n if (isPinned || disableExpandOnHover) {\n return;\n }\n if (hoverTimerRef.current) {\n clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = undefined;\n }\n if (state !== State.Open && !isSmallScreen) {\n hoverTimerRef.current = window.setTimeout(() => {\n hoverTimerRef.current = undefined;\n setState(State.Open);\n }, openDelayMs);\n\n setState(State.Idle);\n }\n };\n\n const handleClose = () => {\n if (isPinned || disableExpandOnHover) {\n return;\n }\n if (hoverTimerRef.current) {\n clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = undefined;\n }\n if (state === State.Idle) {\n setState(State.Closed);\n } else if (state === State.Open) {\n hoverTimerRef.current = window.setTimeout(() => {\n hoverTimerRef.current = undefined;\n setState(State.Closed);\n }, closeDelayMs);\n }\n };\n\n const isOpen = (state === State.Open && !isSmallScreen) || isPinned;\n\n /**\n * Close/Open Sidebar directly without delays. Also toggles `SidebarPinState` to avoid hidden content behind Sidebar.\n */\n const setOpen = (open: boolean) => {\n if (open) {\n setState(State.Open);\n toggleSidebarPinState();\n } else {\n setState(State.Closed);\n toggleSidebarPinState();\n }\n };\n\n return (\n <nav style={{}} aria-label=\"sidebar nav\">\n <A11ySkipSidebar />\n <SidebarOpenStateProvider value={{ isOpen, setOpen }}>\n <Box\n className={classes.root}\n data-testid=\"sidebar-root\"\n onMouseEnter={disableExpandOnHover ? () => {} : handleOpen}\n onFocus={disableExpandOnHover ? () => {} : handleOpen}\n onMouseLeave={disableExpandOnHover ? () => {} : handleClose}\n onBlur={disableExpandOnHover ? () => {} : handleClose}\n >\n <Box\n className={classnames(classes.drawer, classes.drawerWidth, {\n [classes.drawerOpen]: isOpen,\n })}\n >\n {children}\n </Box>\n </Box>\n </SidebarOpenStateProvider>\n </nav>\n );\n};\n\n/**\n * Passing children into the desktop or mobile sidebar depending on the context\n *\n * @public\n */\nexport const Sidebar = (props: SidebarProps) => {\n const sidebarConfig: SidebarConfig = makeSidebarConfig(\n props.sidebarOptions ?? {},\n );\n const submenuConfig: SubmenuConfig = makeSidebarSubmenuConfig(\n props.submenuOptions ?? {},\n );\n const { children, disableExpandOnHover, openDelayMs, closeDelayMs } = props;\n const { isMobile } = useSidebarPinState();\n\n return isMobile ? (\n <MobileSidebar>{children}</MobileSidebar>\n ) : (\n <SidebarConfigContext.Provider value={{ sidebarConfig, submenuConfig }}>\n <DesktopSidebar\n openDelayMs={openDelayMs}\n closeDelayMs={closeDelayMs}\n disableExpandOnHover={disableExpandOnHover}\n >\n {children}\n </DesktopSidebar>\n </SidebarConfigContext.Provider>\n );\n};\n\nfunction A11ySkipSidebar() {\n const { sidebarConfig } = useContext(SidebarConfigContext);\n const { focusContent, contentRef } = useContent();\n const classes = useStyles({ sidebarConfig });\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!contentRef?.current) {\n return null;\n }\n return (\n <Button\n onClick={focusContent}\n variant=\"contained\"\n className={classnames(classes.visuallyHidden)}\n >\n {t('skipToContent')}\n </Button>\n );\n}\n"],"names":["classnames"],"mappings":";;;;;;;;;;;;;;;AAyCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,CAAA;AAAA,MACN,GAAA,EAAK,CAAA;AAAA,MACL,MAAA,EAAQ,CAAA;AAAA,MACR,MAAA,EAAQ,MAAM,MAAA,CAAO,MAAA;AAAA,MACrB,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,QAAA,EAAU,eAAA;AAAA,MACV,UAAA,EAAY,YAAA;AAAA,MACZ,IAAA,EAAM,CAAA;AAAA,MACN,GAAA,EAAK,CAAA;AAAA,MACL,MAAA,EAAQ,CAAA;AAAA,MACR,QAAA,EAAU,UAAA;AAAA,MACV,UAAA,EAAY,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW,UAAA;AAAA,MACrC,SAAA,EAAW,QAAA;AAAA,MACX,eAAA,EAAiB,MAAA;AAAA,MACjB,cAAA,EAAgB,MAAA;AAAA,MAChB,UAAA,EAAY,KAAA,CAAM,WAAA,CAAY,MAAA,CAAO,OAAA,EAAS;AAAA,QAC5C,MAAA,EAAQ,KAAA,CAAM,WAAA,CAAY,MAAA,CAAO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,YAAA,EAAc,UAAA,EAAW,GAAI,UAAA,EAAW;AAChD,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,EAAE,aAAA,EAAe,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,4BAA4B,CAAA;AAE5D,EAAA,IAAI,CAAC,YAAY,OAAA,EAAS;AACxB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,YAAA;AAAA,MACT,OAAA,EAAQ,WAAA;AAAA,MACR,SAAA,EAAWA,UAAA,CAAW,OAAA,CAAQ,cAAc,CAAA;AAAA,MAE3C,YAAE,eAAe;AAAA;AAAA,GACpB;AAEJ;;;;"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
const LocalStorageKeys = {
|
|
2
|
+
SIDEBAR_PIN_STATE: "sidebarPinState"
|
|
3
|
+
};
|
|
1
4
|
const LocalStorage = {
|
|
2
5
|
getSidebarPinState() {
|
|
3
6
|
let value;
|
|
4
7
|
try {
|
|
5
8
|
value = JSON.parse(
|
|
6
|
-
window.localStorage.getItem(
|
|
9
|
+
window.localStorage.getItem(LocalStorageKeys.SIDEBAR_PIN_STATE) || "true"
|
|
7
10
|
);
|
|
8
11
|
} catch {
|
|
9
12
|
return true;
|
|
@@ -12,7 +15,7 @@ const LocalStorage = {
|
|
|
12
15
|
},
|
|
13
16
|
setSidebarPinState(state) {
|
|
14
17
|
return window.localStorage.setItem(
|
|
15
|
-
|
|
18
|
+
LocalStorageKeys.SIDEBAR_PIN_STATE,
|
|
16
19
|
JSON.stringify(state)
|
|
17
20
|
);
|
|
18
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localStorage.esm.js","sources":["../../../src/layout/Sidebar/localStorage.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\
|
|
1
|
+
{"version":3,"file":"localStorage.esm.js","sources":["../../../src/layout/Sidebar/localStorage.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst LocalStorageKeys = {\n SIDEBAR_PIN_STATE: 'sidebarPinState',\n} as const;\n\nexport const LocalStorage = {\n getSidebarPinState(): boolean {\n let value;\n try {\n value = JSON.parse(\n window.localStorage.getItem(LocalStorageKeys.SIDEBAR_PIN_STATE) ||\n 'true',\n );\n } catch {\n return true;\n }\n return !!value;\n },\n setSidebarPinState(state: boolean) {\n return window.localStorage.setItem(\n LocalStorageKeys.SIDEBAR_PIN_STATE,\n JSON.stringify(state),\n );\n },\n};\n"],"names":[],"mappings":"AAgBA,MAAM,gBAAA,GAAmB;AAAA,EACvB,iBAAA,EAAmB;AACrB,CAAA;AAEO,MAAM,YAAA,GAAe;AAAA,EAC1B,kBAAA,GAA8B;AAC5B,IAAA,IAAI,KAAA;AACJ,IAAA,IAAI;AACF,MAAA,KAAA,GAAQ,IAAA,CAAK,KAAA;AAAA,QACX,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,gBAAA,CAAiB,iBAAiB,CAAA,IAC5D;AAAA,OACJ;AAAA,IACF,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAO,CAAC,CAAC,KAAA;AAAA,EACX,CAAA;AAAA,EACA,mBAAmB,KAAA,EAAgB;AACjC,IAAA,OAAO,OAAO,YAAA,CAAa,OAAA;AAAA,MACzB,gBAAA,CAAiB,iBAAA;AAAA,MACjB,IAAA,CAAK,UAAU,KAAK;AAAA,KACtB;AAAA,EACF;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/core-components",
|
|
3
|
-
"version": "0.18.3-next.
|
|
3
|
+
"version": "0.18.3-next.2",
|
|
4
4
|
"description": "Core components used by Backstage plugins and apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@backstage/config": "1.3.6-next.0",
|
|
70
|
-
"@backstage/core-plugin-api": "1.11.2-next.
|
|
70
|
+
"@backstage/core-plugin-api": "1.11.2-next.1",
|
|
71
71
|
"@backstage/errors": "1.2.7",
|
|
72
72
|
"@backstage/theme": "0.7.0",
|
|
73
73
|
"@backstage/version-bridge": "1.0.11",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@backstage/app-defaults": "1.7.2-next.0",
|
|
111
|
-
"@backstage/cli": "0.34.5-next.
|
|
112
|
-
"@backstage/core-app-api": "1.19.2-next.
|
|
111
|
+
"@backstage/cli": "0.34.5-next.1",
|
|
112
|
+
"@backstage/core-app-api": "1.19.2-next.1",
|
|
113
113
|
"@backstage/test-utils": "1.7.13-next.0",
|
|
114
114
|
"@testing-library/dom": "^10.0.0",
|
|
115
115
|
"@testing-library/jest-dom": "^6.0.0",
|