@techdocs/cli 1.14.1-next.1 → 1.14.1

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.
Files changed (128) hide show
  1. package/CHANGELOG.md +6 -19
  2. package/dist/commands/generate/generate.cjs.js +3 -1
  3. package/dist/commands/generate/generate.cjs.js.map +1 -1
  4. package/dist/commands/index.cjs.js +4 -0
  5. package/dist/commands/index.cjs.js.map +1 -1
  6. package/dist/embedded-app/.config-schema.json +26 -2
  7. package/dist/embedded-app/index.html +1 -1
  8. package/dist/embedded-app/index.html.tmpl +1 -1
  9. package/dist/embedded-app/static/123.b7794a0eee64.chunk.js +2 -0
  10. package/dist/embedded-app/static/123.b7794a0eee64.chunk.js.map +1 -0
  11. package/dist/embedded-app/static/1435.8322a7d8da03.chunk.js +2 -0
  12. package/dist/embedded-app/static/1435.8322a7d8da03.chunk.js.map +1 -0
  13. package/dist/embedded-app/static/1659.b8b0e908d038.chunk.js +2 -0
  14. package/dist/embedded-app/static/1659.b8b0e908d038.chunk.js.map +1 -0
  15. package/dist/embedded-app/static/1749.682df5396a43.chunk.js +2 -0
  16. package/dist/embedded-app/static/1749.682df5396a43.chunk.js.map +1 -0
  17. package/dist/embedded-app/static/1767.9f5e3fa87f62.chunk.js +2 -0
  18. package/dist/embedded-app/static/1767.9f5e3fa87f62.chunk.js.map +1 -0
  19. package/dist/embedded-app/static/1994.e9f61042da84.chunk.js +2 -0
  20. package/dist/embedded-app/static/1994.e9f61042da84.chunk.js.map +1 -0
  21. package/dist/embedded-app/static/2295.6b18a59669de.chunk.js +5 -0
  22. package/dist/embedded-app/static/2295.6b18a59669de.chunk.js.map +1 -0
  23. package/dist/embedded-app/static/2360.c15ceaf7a336.chunk.js +2 -0
  24. package/dist/embedded-app/static/2360.c15ceaf7a336.chunk.js.map +1 -0
  25. package/dist/embedded-app/static/{2668.420a5986c298.chunk.js → 2668.70ce80bd9574.chunk.js} +2 -2
  26. package/dist/embedded-app/static/{2668.420a5986c298.chunk.js.map → 2668.70ce80bd9574.chunk.js.map} +1 -1
  27. package/dist/embedded-app/static/3031.a64485c78a5e.chunk.js +2 -0
  28. package/dist/embedded-app/static/{3031.3ad03b75f7d6.chunk.js.map → 3031.a64485c78a5e.chunk.js.map} +1 -1
  29. package/dist/embedded-app/static/{3554.3dc8d75e4b1f.chunk.js → 3554.43b3a3c60b33.chunk.js} +2 -2
  30. package/dist/embedded-app/static/{3554.3dc8d75e4b1f.chunk.js.map → 3554.43b3a3c60b33.chunk.js.map} +1 -1
  31. package/dist/embedded-app/static/4587.fa2bf602f965.chunk.js +2 -0
  32. package/dist/embedded-app/static/4587.fa2bf602f965.chunk.js.map +1 -0
  33. package/dist/embedded-app/static/{4591.47a06af79fef.chunk.js → 4591.d741c025cb8a.chunk.js} +2 -2
  34. package/dist/embedded-app/static/{4591.47a06af79fef.chunk.js.map → 4591.d741c025cb8a.chunk.js.map} +1 -1
  35. package/dist/embedded-app/static/4609.afdaf67e3d37.chunk.js +531 -0
  36. package/dist/embedded-app/static/4609.afdaf67e3d37.chunk.js.map +1 -0
  37. package/dist/embedded-app/static/4648.0de68968e5e2.chunk.js +2 -0
  38. package/dist/embedded-app/static/4648.0de68968e5e2.chunk.js.map +1 -0
  39. package/dist/embedded-app/static/{5124.7da4bbeaafd0.chunk.js → 5124.bf809bc06c78.chunk.js} +2 -2
  40. package/dist/embedded-app/static/{5124.7da4bbeaafd0.chunk.js.map → 5124.bf809bc06c78.chunk.js.map} +1 -1
  41. package/dist/embedded-app/static/5877.a2e28865fc9e.chunk.js +2 -0
  42. package/dist/embedded-app/static/5877.a2e28865fc9e.chunk.js.map +1 -0
  43. package/dist/embedded-app/static/6138.3678d771bc61.chunk.js +2 -0
  44. package/dist/embedded-app/static/6138.3678d771bc61.chunk.js.map +1 -0
  45. package/dist/embedded-app/static/{6206.a6dc0414494f.chunk.js → 6206.69309b586b93.chunk.js} +2 -2
  46. package/dist/embedded-app/static/{6206.a6dc0414494f.chunk.js.map → 6206.69309b586b93.chunk.js.map} +1 -1
  47. package/dist/embedded-app/static/6718.89aeb24410af.chunk.js +22 -0
  48. package/dist/embedded-app/static/{6718.245b95228170.chunk.js.map → 6718.89aeb24410af.chunk.js.map} +1 -1
  49. package/dist/embedded-app/static/6949.7ed9d7a91fab.chunk.js +4 -0
  50. package/dist/embedded-app/static/6949.7ed9d7a91fab.chunk.js.map +1 -0
  51. package/dist/embedded-app/static/7203.80b9f341a5e8.chunk.js +2 -0
  52. package/dist/embedded-app/static/7203.80b9f341a5e8.chunk.js.map +1 -0
  53. package/dist/embedded-app/static/{7226.cd9be3586445.chunk.js → 7226.21b332b45923.chunk.js} +2 -2
  54. package/dist/embedded-app/static/{7226.cd9be3586445.chunk.js.map → 7226.21b332b45923.chunk.js.map} +1 -1
  55. package/dist/embedded-app/static/7632.3917bed33d55.chunk.js +2 -0
  56. package/dist/embedded-app/static/{7632.79234b81e968.chunk.js.map → 7632.3917bed33d55.chunk.js.map} +1 -1
  57. package/dist/embedded-app/static/{8125.84952fcec739.chunk.js → 8125.d349a79d61b4.chunk.js} +2 -2
  58. package/dist/embedded-app/static/{8125.84952fcec739.chunk.js.map → 8125.d349a79d61b4.chunk.js.map} +1 -1
  59. package/dist/embedded-app/static/8877.eae6a09dd4f9.chunk.js +2 -0
  60. package/dist/embedded-app/static/{8877.cdb190e598d5.chunk.js.map → 8877.eae6a09dd4f9.chunk.js.map} +1 -1
  61. package/dist/embedded-app/static/9050.ea90466f10f3.chunk.js +2 -0
  62. package/dist/embedded-app/static/9050.ea90466f10f3.chunk.js.map +1 -0
  63. package/dist/embedded-app/static/9230.53ff1aa23058.chunk.js +2 -0
  64. package/dist/embedded-app/static/9230.53ff1aa23058.chunk.js.map +1 -0
  65. package/dist/embedded-app/static/main.7dc68125121e.js +2 -0
  66. package/dist/embedded-app/static/main.7dc68125121e.js.map +1 -0
  67. package/dist/embedded-app/static/module-micromark-core-commonmark.d049c8fc059e.js +2 -0
  68. package/dist/embedded-app/static/module-micromark-core-commonmark.d049c8fc059e.js.map +1 -0
  69. package/dist/embedded-app/static/module-parse5.94980036c2b0.js +2 -0
  70. package/dist/embedded-app/static/module-parse5.94980036c2b0.js.map +1 -0
  71. package/dist/embedded-app/static/module-react-aria-components.27a8b47829ea.js +2 -0
  72. package/dist/embedded-app/static/module-react-aria-components.27a8b47829ea.js.map +1 -0
  73. package/dist/embedded-app/static/{runtime.3d9231da678d.js → runtime.fa776ba09ef1.js} +2 -2
  74. package/dist/embedded-app/static/{runtime.3d9231da678d.js.map → runtime.fa776ba09ef1.js.map} +1 -1
  75. package/dist/embedded-app/static/vendor.e2d917c57ed9.js +2 -0
  76. package/dist/embedded-app/static/vendor.e2d917c57ed9.js.map +1 -0
  77. package/dist/packages/techdocs-cli/package.json.cjs.js +1 -1
  78. package/dist/plugins/techdocs-zensical-internal/src/TechdocsZensicalGenerator.cjs.js +5 -1
  79. package/dist/plugins/techdocs-zensical-internal/src/TechdocsZensicalGenerator.cjs.js.map +1 -1
  80. package/package.json +10 -10
  81. package/dist/embedded-app/static/123.45e40c5d70dc.chunk.js +0 -2
  82. package/dist/embedded-app/static/123.45e40c5d70dc.chunk.js.map +0 -1
  83. package/dist/embedded-app/static/1659.865be4aaaafb.chunk.js +0 -2
  84. package/dist/embedded-app/static/1659.865be4aaaafb.chunk.js.map +0 -1
  85. package/dist/embedded-app/static/1749.b4483b4e2bb6.chunk.js +0 -2
  86. package/dist/embedded-app/static/1749.b4483b4e2bb6.chunk.js.map +0 -1
  87. package/dist/embedded-app/static/1767.6e4cbc9c9d27.chunk.js +0 -2
  88. package/dist/embedded-app/static/1767.6e4cbc9c9d27.chunk.js.map +0 -1
  89. package/dist/embedded-app/static/1994.38d3dd466d30.chunk.js +0 -2
  90. package/dist/embedded-app/static/1994.38d3dd466d30.chunk.js.map +0 -1
  91. package/dist/embedded-app/static/2295.dda08612a0e4.chunk.js +0 -5
  92. package/dist/embedded-app/static/2295.dda08612a0e4.chunk.js.map +0 -1
  93. package/dist/embedded-app/static/2339.4b6211cd2e17.chunk.js +0 -2
  94. package/dist/embedded-app/static/2339.4b6211cd2e17.chunk.js.map +0 -1
  95. package/dist/embedded-app/static/2360.e30d0a827f1b.chunk.js +0 -2
  96. package/dist/embedded-app/static/2360.e30d0a827f1b.chunk.js.map +0 -1
  97. package/dist/embedded-app/static/3031.3ad03b75f7d6.chunk.js +0 -2
  98. package/dist/embedded-app/static/3306.ebe1d57e1ee8.chunk.js +0 -2
  99. package/dist/embedded-app/static/3306.ebe1d57e1ee8.chunk.js.map +0 -1
  100. package/dist/embedded-app/static/4587.51c2cef24263.chunk.js +0 -2
  101. package/dist/embedded-app/static/4587.51c2cef24263.chunk.js.map +0 -1
  102. package/dist/embedded-app/static/4609.59cdb7eef90d.chunk.js +0 -531
  103. package/dist/embedded-app/static/4609.59cdb7eef90d.chunk.js.map +0 -1
  104. package/dist/embedded-app/static/4648.71cc1dd433d0.chunk.js +0 -2
  105. package/dist/embedded-app/static/4648.71cc1dd433d0.chunk.js.map +0 -1
  106. package/dist/embedded-app/static/5877.dcbb54defb88.chunk.js +0 -2
  107. package/dist/embedded-app/static/5877.dcbb54defb88.chunk.js.map +0 -1
  108. package/dist/embedded-app/static/6138.4babe9cc6492.chunk.js +0 -2
  109. package/dist/embedded-app/static/6138.4babe9cc6492.chunk.js.map +0 -1
  110. package/dist/embedded-app/static/6718.245b95228170.chunk.js +0 -22
  111. package/dist/embedded-app/static/6949.d6860e77e10c.chunk.js +0 -4
  112. package/dist/embedded-app/static/6949.d6860e77e10c.chunk.js.map +0 -1
  113. package/dist/embedded-app/static/698.6389c3faa0bb.chunk.js +0 -2
  114. package/dist/embedded-app/static/698.6389c3faa0bb.chunk.js.map +0 -1
  115. package/dist/embedded-app/static/7203.a37705ededb5.chunk.js +0 -2
  116. package/dist/embedded-app/static/7203.a37705ededb5.chunk.js.map +0 -1
  117. package/dist/embedded-app/static/7632.79234b81e968.chunk.js +0 -2
  118. package/dist/embedded-app/static/8877.cdb190e598d5.chunk.js +0 -2
  119. package/dist/embedded-app/static/9050.d056f544fb11.chunk.js +0 -2
  120. package/dist/embedded-app/static/9050.d056f544fb11.chunk.js.map +0 -1
  121. package/dist/embedded-app/static/9230.cf54b232ffd4.chunk.js +0 -2
  122. package/dist/embedded-app/static/9230.cf54b232ffd4.chunk.js.map +0 -1
  123. package/dist/embedded-app/static/main.4513a8956ce8.js +0 -2
  124. package/dist/embedded-app/static/main.4513a8956ce8.js.map +0 -1
  125. package/dist/embedded-app/static/module-react-aria-components.ad458624f76c.js +0 -2
  126. package/dist/embedded-app/static/module-react-aria-components.ad458624f76c.js.map +0 -1
  127. package/dist/embedded-app/static/vendor.9c2d9a0c65bd.js +0 -2
  128. package/dist/embedded-app/static/vendor.9c2d9a0c65bd.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["7226"],{52235(e,t,a){var r=a(4293),n=a(78920);t.default=void 0;var i=n(a(14041));t.default=(0,r(a(74044)).default)(i.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward")},89439(e,t,a){a.d(t,{n:()=>N});var r=a(31085),n=a(40703),i=a(59469),l=a(48653),s=a(45685),d=a(37197),o=a(58837),c=a(7031),p=a(53373),h=a.n(p),m=a(77125),g=a(72501),u=a(52235),x=a(60603);let f=(0,o.A)(e=>({root:{maxWidth:"fit-content",padding:e.spacing(2,2,2,2.5)},boxTitle:{margin:0,color:e.palette.textSubtle},arrow:{color:e.palette.textSubtle}}),{name:"BackstageBottomLink"});function j(e){let{link:t,title:a,onClick:n}=e,i=f();return(0,r.jsxs)(m.A,{children:[(0,r.jsx)(d.A,{}),(0,r.jsx)(x.N_,{to:t,onClick:n,underline:"none",children:(0,r.jsxs)(m.A,{display:"flex",alignItems:"center",className:i.root,children:[(0,r.jsx)(m.A,{className:i.boxTitle,fontWeight:"fontWeightBold",m:1,children:(0,r.jsx)(g.A,{children:(0,r.jsx)("strong",{children:a})})}),(0,r.jsx)(u.default,{className:i.arrow})]})})]})}var A=a(14041),b=a(45463),y=a(60691),k=a(89332),v=a(89595);let C=e=>{let{slackChannel:t}=e,{t:a}=(0,v.i)(k.O);return t?"string"==typeof t?(0,r.jsx)(g.A,{children:a("errorBoundary.title",{slackChannel:t})}):t.href?(0,r.jsx)(b.z,{to:t.href,variant:"contained",children:t.name}):(0,r.jsx)(g.A,{children:a("errorBoundary.title",{slackChannel:t.name})}):null},B=class extends A.Component{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(e,t){console.error(`ErrorBoundary, error: ${e}`,{error:e,errorInfo:t}),this.setState({error:e,errorInfo:t})}render(){let{slackChannel:e,children:t}=this.props,{error:a}=this.state;return a?(0,r.jsx)(y.b,{title:"Something Went Wrong",error:a,children:(0,r.jsx)(C,{slackChannel:e})}):t}},S=(0,o.A)(e=>({noPadding:{padding:0,"&:last-child":{paddingBottom:0}},contentAlignBottom:{display:"flex",alignItems:"self-end"},header:{padding:e.spacing(2,2,2,2.5)},headerTitle:{fontWeight:e.typography.fontWeightBold},headerSubheader:{paddingTop:e.spacing(1)},headerAvatar:{},headerAction:{},headerContent:{},subheader:{display:"flex"}}),{name:"BackstageInfoCard"}),T=(0,c.A)(e=>({root:{display:"inline-block",padding:e.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(i.A),I={flex:{display:"flex",flexDirection:"column"},fullHeight:{display:"flex",flexDirection:"column",height:"100%"},gridItem:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px",breakInside:"avoid-page","@media print":{height:"auto"}}},P={fullHeight:{flex:1},gridItem:{flex:1}};function N(e){let{title:t,subheader:a,divider:o=!0,deepLink:c,slackChannel:p,errorBoundaryProps:m,variant:g,alignContent:u="normal",children:x,headerStyle:f,headerProps:A,icon:b,action:y,actionsClassName:k,actions:v,cardClassName:C,actionsTopRight:N,className:w,noPadding:W,titleTypographyProps:D,subheaderTypographyProps:U}=e,_=S(),E={},H={};return g&&g.split(/[\s]+/g).forEach(e=>{E={...E,...I[e]},H={...H,...P[e]}}),(0,r.jsx)(n.A,{style:E,className:w,children:(0,r.jsxs)(B,{...m||(p?{slackChannel:p}:{}),children:[t&&(0,r.jsx)(s.A,{classes:{root:h()(_.header),title:_.headerTitle,subheader:_.headerSubheader,avatar:_.headerAvatar,action:_.headerAction,content:_.headerContent},title:t,subheader:a||b?(0,r.jsxs)("div",{"data-testid":"info-card-subheader",children:[a&&(0,r.jsx)("div",{className:_.subheader,children:a}),b]}):null,action:y,style:{...f},titleTypographyProps:D,subheaderTypographyProps:U,...A}),N&&(0,r.jsx)(T,{children:N}),o&&(0,r.jsx)(d.A,{}),(0,r.jsx)(l.A,{className:h()(C,{[_.noPadding]:W,[_.contentAlignBottom]:"bottom"===u}),style:H,children:x}),v&&(0,r.jsx)(i.A,{className:k,children:v}),c&&(0,r.jsx)(j,{...c})]})})}},68817(e,t,a){a.d(t,{TechDocsCustomHome:()=>ee});var r=a(31085),n=a(14041),i=a(73466),l=a(58837),s=a(49185),d=a(58077),o=a(50509),c=a(48203),p=a(53320),h=a(59378),m=a(76272),g=a(74854),u=a(31314),x=a(90898),f=a(99255),j=a(81219),A=a(19735),b=a(77125),y=a(99703);let k=(0,l.A)(e=>(0,y.A)({root:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(22em, 1fr))",gridAutoRows:"1fr",gridGap:e.spacing(2)}}),{name:"BackstageItemCardGrid"});function v(e){let{children:t,...a}=e,n=k(a);return(0,r.jsx)(b.A,{className:n.root,...a,children:t})}var C=a(72501);let B=(0,l.A)(e=>(0,y.A)({root:{color:e.getPageTheme({themeId:"card"}).fontColor,padding:e.spacing(2,2,3),backgroundImage:e.getPageTheme({themeId:"card"}).backgroundImage,backgroundPosition:0,backgroundSize:"inherit"}}),{name:"BackstageItemCardHeader"});function S(e){let{title:t,subtitle:a,children:n}=e,i=B(e);return(0,r.jsxs)(b.A,{className:i.root,children:[a&&(0,r.jsx)(C.A,{variant:"subtitle2",component:"h3",children:a}),t&&(0,r.jsx)(C.A,{variant:"h6",component:"h4",children:t}),n]})}var T=a(45463),I=a(26958),P=a(40703),N=a(59469),w=a(48653),W=a(57369),D=a(55489),U=a(89439),_=a(60603),E=a(87623);let H=(0,l.A)(e=>({linkSpacer:{paddingTop:e.spacing(.2)},readMoreLink:{paddingTop:e.spacing(.2)}}),{name:"BackstageInfoCardGrid"});var L=a(59821),M=a(47677),R=a(15179),V=a(45794),z=a(84391),G=a(87187),O=a(4809),$=a(38605),F=a(74953);let K=(0,l.A)(e=>({tabsWrapper:{gridArea:"pageSubheader",backgroundColor:e.palette.background.paper,paddingLeft:e.spacing(3),minWidth:0},defaultTab:{...e.typography.caption,padding:e.spacing(3,3),textTransform:"uppercase",fontWeight:e.typography.fontWeightBold,color:e.palette.text.secondary},selected:{color:e.palette.text.primary},tabRoot:{"&:hover":{backgroundColor:e.palette.background.default,color:e.palette.text.primary}}}),{name:"BackstageHeaderTabs"});function Y(e){let{tabs:t,onChange:a,selectedIndex:i}=e,[l,s]=(0,n.useState)(i??0),d=K(),o=(0,n.useCallback)((e,t)=>{void 0===i&&s(t),a&&a(t)},[i,a]);return(0,n.useEffect)(()=>{void 0!==i&&s(i)},[i]),(0,r.jsx)(b.A,{className:d.tabsWrapper,children:(0,r.jsx)(F.A,{indicatorColor:"primary",textColor:"inherit",variant:"scrollable",scrollButtons:"auto","aria-label":"tabs",onChange:o,value:l,children:t.map((e,t)=>(0,r.jsx)($.A,{"data-testid":`header-tab-${t}`,label:e.label,value:t,className:d.defaultTab,classes:{selected:d.selected,root:d.tabRoot},...e.tabProps},e.id))})})}var q=a(89595),J=a(64009),Q=a(78931);let X={DocsTable:u.o,DocsCardGrid:e=>{let{entities:t}=e,a=(0,j.S)(x.Oc),n=(0,o.g)(A.U);return t?(0,r.jsx)(v,{"data-testid":"docs-explore",children:t?.length?t.map((e,t)=>(0,r.jsxs)(P.A,{children:[(0,r.jsx)(W.A,{children:(0,r.jsx)(S,{title:(0,r.jsx)(I.d,{entityRef:e})})}),(0,r.jsx)(w.A,{children:e.metadata.description}),(0,r.jsx)(N.A,{children:(0,r.jsx)(T.z,{to:a({namespace:(0,f.V)(e.metadata.namespace??"default",n),kind:(0,f.V)(e.kind,n),name:(0,f.V)(e.metadata.name,n)}),color:"primary","data-testid":"read_docs",children:"Read Docs"})})]},t)):null}):null},TechDocsIndexPage:M.TechDocsIndexPage,InfoCardGrid:e=>{let{entities:t,linkContent:a,linkDestination:n}=e,l=H(),s=(0,j.S)(x.Oc),c=(0,o.g)(A.U),p=(0,o.g)(E.n),{value:h,loading:m}=(0,i.A)(async()=>new Map(await Promise.all(t?.map(async e=>{let t=await p.forEntity(e).promise;return[(0,d.U2)(e),t]})||[])));return m?(0,r.jsx)(D.k,{}):t&&t?.length?(0,r.jsx)(v,{"data-testid":"info-card-container",children:t.map(e=>(0,r.jsxs)(U.n,{"data-testid":e?.metadata?.title,title:h?.get((0,d.U2)(e))?.primaryTitle,children:[(0,r.jsx)("div",{children:e?.metadata?.description}),(0,r.jsx)("div",{className:l.linkSpacer}),(0,r.jsx)(_.N_,{to:(e=>{if(n){let t=n(e);if(t)return t}return s({namespace:(0,f.V)(e.metadata.namespace??"default",c),kind:(0,f.V)(e.kind,c),name:(0,f.V)(e.metadata.name,c)})})(e),className:l.readMoreLink,"data-testid":"read-docs-link",children:a||"Read Docs"})]},(0,d.U2)(e)))}):null}},Z=({config:e,entities:t,index:a})=>{let m=(0,l.A)({panelContainer:{marginBottom:"2rem",...e.panelCSS?e.panelCSS:{}}})(),{loading:g,isOwnedEntity:u}=function(){let e=(0,o.g)(c.K),{loading:t,value:a}=(0,i.A)(async()=>{let{ownershipEntityRefs:t}=await e.getBackstageIdentity();return t},[]);return{loading:t,isOwnedEntity:(0,n.useMemo)(()=>{let e=new Set(a??[]);return t=>{for(let a of(0,p.t)(t,s.vv).map(d.U2))if(e.has(a))return!0;return!1}},[a])}}(),x=X[e.panelType],f=t.filter(t=>"ownedByUser"===e.filterPredicate?!g&&u(t):"function"==typeof e.filterPredicate&&e.filterPredicate(t)),{t:j}=(0,q.i)(J.M),A=e.panelProps?.CustomHeader||(()=>(0,r.jsx)(R.d,{title:e.title,description:e.description,children:0===a?(0,r.jsx)(V.Y,{children:j("home.supportButton")}):null}));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A,{}),(0,r.jsx)("div",{className:m.panelContainer,children:(0,r.jsx)(h.B9,{children:(0,r.jsx)(x,{"data-testid":"techdocs-custom-panel",entities:f,...e.panelProps})})})]})},ee=e=>{let{tabsConfig:t,filter:a,CustomPageWrapper:l}=e,[s,d]=(0,n.useState)(0),c=(0,o.g)(m.v),{t:p}=(0,q.i)(J.M),{value:h,loading:u,error:x}=(0,i.A)(async()=>(await c.getEntities({filter:{...a,[`metadata.annotations.${Q.As}`]:g.c},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(e=>!!e.metadata.annotations?.[Q.As])),f=t[s];return u?(0,r.jsx)(L.S,{CustomPageWrapper:l,children:(0,r.jsx)(z.U,{children:(0,r.jsx)(D.k,{})})}):x?(0,r.jsx)(L.S,{CustomPageWrapper:l,children:(0,r.jsx)(z.U,{children:(0,r.jsx)(G.B,{severity:"error",title:p("error.couldNotLoad"),children:(0,r.jsx)(O.z,{language:"text",text:x.toString()})})})}):(0,r.jsxs)(L.S,{CustomPageWrapper:l,children:[(0,r.jsx)(Y,{selectedIndex:s,onChange:e=>d(e),tabs:t.map(({label:e},t)=>({id:t.toString(),label:e}))}),(0,r.jsx)(z.U,{"data-testid":"techdocs-content",children:f.panels.map((e,t)=>(0,r.jsx)(Z,{config:e,entities:h||[],index:t},t))})]})}}}]);
2
- //# sourceMappingURL=7226.cd9be3586445.chunk.js.map
1
+ "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["7226"],{52235(e,t,a){var r=a(4293),n=a(78920);t.default=void 0;var i=n(a(14041));t.default=(0,r(a(74044)).default)(i.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward")},89439(e,t,a){a.d(t,{n:()=>N});var r=a(31085),n=a(40703),i=a(59469),l=a(48653),s=a(45685),d=a(37197),o=a(58837),c=a(7031),p=a(53373),h=a.n(p),m=a(77125),g=a(72501),u=a(52235),x=a(60603);let f=(0,o.A)(e=>({root:{maxWidth:"fit-content",padding:e.spacing(2,2,2,2.5)},boxTitle:{margin:0,color:e.palette.textSubtle},arrow:{color:e.palette.textSubtle}}),{name:"BackstageBottomLink"});function j(e){let{link:t,title:a,onClick:n}=e,i=f();return(0,r.jsxs)(m.A,{children:[(0,r.jsx)(d.A,{}),(0,r.jsx)(x.N_,{to:t,onClick:n,underline:"none",children:(0,r.jsxs)(m.A,{display:"flex",alignItems:"center",className:i.root,children:[(0,r.jsx)(m.A,{className:i.boxTitle,fontWeight:"fontWeightBold",m:1,children:(0,r.jsx)(g.A,{children:(0,r.jsx)("strong",{children:a})})}),(0,r.jsx)(u.default,{className:i.arrow})]})})]})}var A=a(14041),b=a(45463),y=a(60691),k=a(89332),v=a(89595);let C=e=>{let{slackChannel:t}=e,{t:a}=(0,v.i)(k.O);return t?"string"==typeof t?(0,r.jsx)(g.A,{children:a("errorBoundary.title",{slackChannel:t})}):t.href?(0,r.jsx)(b.z,{to:t.href,variant:"contained",children:t.name}):(0,r.jsx)(g.A,{children:a("errorBoundary.title",{slackChannel:t.name})}):null},B=class extends A.Component{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(e,t){console.error(`ErrorBoundary, error: ${e}`,{error:e,errorInfo:t}),this.setState({error:e,errorInfo:t})}render(){let{slackChannel:e,children:t}=this.props,{error:a}=this.state;return a?(0,r.jsx)(y.b,{title:"Something Went Wrong",error:a,children:(0,r.jsx)(C,{slackChannel:e})}):t}},S=(0,o.A)(e=>({noPadding:{padding:0,"&:last-child":{paddingBottom:0}},contentAlignBottom:{display:"flex",alignItems:"self-end"},header:{padding:e.spacing(2,2,2,2.5)},headerTitle:{fontWeight:e.typography.fontWeightBold},headerSubheader:{paddingTop:e.spacing(1)},headerAvatar:{},headerAction:{},headerContent:{},subheader:{display:"flex"}}),{name:"BackstageInfoCard"}),T=(0,c.A)(e=>({root:{display:"inline-block",padding:e.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(i.A),I={flex:{display:"flex",flexDirection:"column"},fullHeight:{display:"flex",flexDirection:"column",height:"100%"},gridItem:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px",breakInside:"avoid-page","@media print":{height:"auto"}}},P={fullHeight:{flex:1},gridItem:{flex:1}};function N(e){let{title:t,subheader:a,divider:o=!0,deepLink:c,slackChannel:p,errorBoundaryProps:m,variant:g,alignContent:u="normal",children:x,headerStyle:f,headerProps:A,icon:b,action:y,actionsClassName:k,actions:v,cardClassName:C,actionsTopRight:N,className:w,noPadding:W,titleTypographyProps:D,subheaderTypographyProps:U}=e,_=S(),E={},H={};return g&&g.split(/[\s]+/g).forEach(e=>{E={...E,...I[e]},H={...H,...P[e]}}),(0,r.jsx)(n.A,{style:E,className:w,children:(0,r.jsxs)(B,{...m||(p?{slackChannel:p}:{}),children:[t&&(0,r.jsx)(s.A,{classes:{root:h()(_.header),title:_.headerTitle,subheader:_.headerSubheader,avatar:_.headerAvatar,action:_.headerAction,content:_.headerContent},title:t,subheader:a||b?(0,r.jsxs)("div",{"data-testid":"info-card-subheader",children:[a&&(0,r.jsx)("div",{className:_.subheader,children:a}),b]}):null,action:y,style:{...f},titleTypographyProps:D,subheaderTypographyProps:U,...A}),N&&(0,r.jsx)(T,{children:N}),o&&(0,r.jsx)(d.A,{}),(0,r.jsx)(l.A,{className:h()(C,{[_.noPadding]:W,[_.contentAlignBottom]:"bottom"===u}),style:H,children:x}),v&&(0,r.jsx)(i.A,{className:k,children:v}),c&&(0,r.jsx)(j,{...c})]})})}},68817(e,t,a){a.d(t,{TechDocsCustomHome:()=>ee});var r=a(31085),n=a(14041),i=a(73466),l=a(58837),s=a(49185),d=a(58077),o=a(50509),c=a(48203),p=a(53320),h=a(59378),m=a(76272),g=a(74854),u=a(31314),x=a(90898),f=a(99255),j=a(81219),A=a(19735),b=a(77125),y=a(99703);let k=(0,l.A)(e=>(0,y.A)({root:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(22em, 1fr))",gridAutoRows:"1fr",gridGap:e.spacing(2)}}),{name:"BackstageItemCardGrid"});function v(e){let{children:t,...a}=e,n=k(a);return(0,r.jsx)(b.A,{className:n.root,...a,children:t})}var C=a(72501);let B=(0,l.A)(e=>(0,y.A)({root:{color:e.getPageTheme({themeId:"card"}).fontColor,padding:e.spacing(2,2,3),backgroundImage:e.getPageTheme({themeId:"card"}).backgroundImage,backgroundPosition:0,backgroundSize:"inherit"}}),{name:"BackstageItemCardHeader"});function S(e){let{title:t,subtitle:a,children:n}=e,i=B(e);return(0,r.jsxs)(b.A,{className:i.root,children:[a&&(0,r.jsx)(C.A,{variant:"subtitle2",component:"h3",children:a}),t&&(0,r.jsx)(C.A,{variant:"h6",component:"h4",children:t}),n]})}var T=a(45463),I=a(26958),P=a(40703),N=a(59469),w=a(48653),W=a(57369),D=a(55489),U=a(89439),_=a(60603),E=a(87623);let H=(0,l.A)(e=>({linkSpacer:{paddingTop:e.spacing(.2)},readMoreLink:{paddingTop:e.spacing(.2)}}),{name:"BackstageInfoCardGrid"});var L=a(59821),M=a(47677),R=a(15179),V=a(45794),z=a(84391),G=a(87187),O=a(4809),$=a(38605),F=a(74953);let K=(0,l.A)(e=>({tabsWrapper:{gridArea:"pageSubheader",backgroundColor:e.palette.background.paper,paddingLeft:e.spacing(3),minWidth:0},defaultTab:{...e.typography.caption,padding:e.spacing(3,3),textTransform:"uppercase",fontWeight:e.typography.fontWeightBold,color:e.palette.text.secondary},selected:{color:e.palette.text.primary},tabRoot:{"&:hover":{backgroundColor:e.palette.background.default,color:e.palette.text.primary}}}),{name:"BackstageHeaderTabs"});function Y(e){let{tabs:t,onChange:a,selectedIndex:i}=e,[l,s]=(0,n.useState)(i??0),d=K(),o=(0,n.useCallback)((e,t)=>{void 0===i&&s(t),a&&a(t)},[i,a]);return(0,n.useEffect)(()=>{void 0!==i&&s(i)},[i]),(0,r.jsx)(b.A,{className:d.tabsWrapper,children:(0,r.jsx)(F.A,{indicatorColor:"primary",textColor:"inherit",variant:"scrollable",scrollButtons:"auto","aria-label":"tabs",onChange:o,value:l,children:t.map((e,t)=>(0,r.jsx)($.A,{"data-testid":`header-tab-${t}`,label:e.label,value:t,className:d.defaultTab,classes:{selected:d.selected,root:d.tabRoot},...e.tabProps},e.id))})})}var q=a(89595),J=a(64009),Q=a(78931);let X={DocsTable:u.o,DocsCardGrid:e=>{let{entities:t}=e,a=(0,j.S)(x.Oc),n=(0,o.gf)(A.U);return t?(0,r.jsx)(v,{"data-testid":"docs-explore",children:t?.length?t.map((e,t)=>(0,r.jsxs)(P.A,{children:[(0,r.jsx)(W.A,{children:(0,r.jsx)(S,{title:(0,r.jsx)(I.d,{entityRef:e})})}),(0,r.jsx)(w.A,{children:e.metadata.description}),(0,r.jsx)(N.A,{children:(0,r.jsx)(T.z,{to:a({namespace:(0,f.V)(e.metadata.namespace??"default",n),kind:(0,f.V)(e.kind,n),name:(0,f.V)(e.metadata.name,n)}),color:"primary","data-testid":"read_docs",children:"Read Docs"})})]},t)):null}):null},TechDocsIndexPage:M.TechDocsIndexPage,InfoCardGrid:e=>{let{entities:t,linkContent:a,linkDestination:n}=e,l=H(),s=(0,j.S)(x.Oc),c=(0,o.gf)(A.U),p=(0,o.gf)(E.n),{value:h,loading:m}=(0,i.A)(async()=>new Map(await Promise.all(t?.map(async e=>{let t=await p.forEntity(e).promise;return[(0,d.U2)(e),t]})||[])));return m?(0,r.jsx)(D.k,{}):t&&t?.length?(0,r.jsx)(v,{"data-testid":"info-card-container",children:t.map(e=>(0,r.jsxs)(U.n,{"data-testid":e?.metadata?.title,title:h?.get((0,d.U2)(e))?.primaryTitle,children:[(0,r.jsx)("div",{children:e?.metadata?.description}),(0,r.jsx)("div",{className:l.linkSpacer}),(0,r.jsx)(_.N_,{to:(e=>{if(n){let t=n(e);if(t)return t}return s({namespace:(0,f.V)(e.metadata.namespace??"default",c),kind:(0,f.V)(e.kind,c),name:(0,f.V)(e.metadata.name,c)})})(e),className:l.readMoreLink,"data-testid":"read-docs-link",children:a||"Read Docs"})]},(0,d.U2)(e)))}):null}},Z=({config:e,entities:t,index:a})=>{let m=(0,l.A)({panelContainer:{marginBottom:"2rem",...e.panelCSS?e.panelCSS:{}}})(),{loading:g,isOwnedEntity:u}=function(){let e=(0,o.gf)(c.K),{loading:t,value:a}=(0,i.A)(async()=>{let{ownershipEntityRefs:t}=await e.getBackstageIdentity();return t},[]);return{loading:t,isOwnedEntity:(0,n.useMemo)(()=>{let e=new Set(a??[]);return t=>{for(let a of(0,p.t)(t,s.vv).map(d.U2))if(e.has(a))return!0;return!1}},[a])}}(),x=X[e.panelType],f=t.filter(t=>"ownedByUser"===e.filterPredicate?!g&&u(t):"function"==typeof e.filterPredicate&&e.filterPredicate(t)),{t:j}=(0,q.i)(J.M),A=e.panelProps?.CustomHeader||(()=>(0,r.jsx)(R.d,{title:e.title,description:e.description,children:0===a?(0,r.jsx)(V.Y,{children:j("home.supportButton")}):null}));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A,{}),(0,r.jsx)("div",{className:m.panelContainer,children:(0,r.jsx)(h.B9,{children:(0,r.jsx)(x,{"data-testid":"techdocs-custom-panel",entities:f,...e.panelProps})})})]})},ee=e=>{let{tabsConfig:t,filter:a,CustomPageWrapper:l}=e,[s,d]=(0,n.useState)(0),c=(0,o.gf)(m.v),{t:p}=(0,q.i)(J.M),{value:h,loading:u,error:x}=(0,i.A)(async()=>(await c.getEntities({filter:{...a,[`metadata.annotations.${Q.As}`]:g.c},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(e=>!!e.metadata.annotations?.[Q.As])),f=t[s];return u?(0,r.jsx)(L.S,{CustomPageWrapper:l,children:(0,r.jsx)(z.U,{children:(0,r.jsx)(D.k,{})})}):x?(0,r.jsx)(L.S,{CustomPageWrapper:l,children:(0,r.jsx)(z.U,{children:(0,r.jsx)(G.B,{severity:"error",title:p("error.couldNotLoad"),children:(0,r.jsx)(O.z,{language:"text",text:x.toString()})})})}):(0,r.jsxs)(L.S,{CustomPageWrapper:l,children:[(0,r.jsx)(Y,{selectedIndex:s,onChange:e=>d(e),tabs:t.map(({label:e},t)=>({id:t.toString(),label:e}))}),(0,r.jsx)(z.U,{"data-testid":"techdocs-content",children:f.panels.map((e,t)=>(0,r.jsx)(Z,{config:e,entities:h||[],index:t},t))})]})}}}]);
2
+ //# sourceMappingURL=7226.21b332b45923.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static/7226.cd9be3586445.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../../node_modules/@material-ui/icons/ArrowForward.js","webpack://techdocs-cli-embedded-app/../core-components/src/layout/BottomLink/BottomLink.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/InfoCard/InfoCard.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/InfoCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityOwnership.ts"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar React = _interopRequireWildcard(require(\"react\"));\n\nvar _createSvgIcon = _interopRequireDefault(require(\"./utils/createSvgIcon\"));\n\nvar _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z\"\n}), 'ArrowForward');\n\nexports.default = _default;","/*\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 Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ArrowIcon from '@material-ui/icons/ArrowForward';\nimport { MouseEvent } from 'react';\nimport { Link } from '../../components/Link';\n\n/** @public */\nexport type BottomLinkClassKey = 'root' | 'boxTitle' | 'arrow';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n maxWidth: 'fit-content',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n boxTitle: {\n margin: 0,\n color: theme.palette.textSubtle,\n },\n arrow: {\n color: theme.palette.textSubtle,\n },\n }),\n { name: 'BackstageBottomLink' },\n);\n\n/** @public */\nexport type BottomLinkProps = {\n link: string;\n title: string;\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n};\n\n/**\n * Footer with link used in {@link InfoCard } and {@link TabbedCard}\n *\n * @public\n *\n */\nexport function BottomLink(props: BottomLinkProps) {\n const { link, title, onClick } = props;\n const classes = useStyles();\n\n return (\n <Box>\n <Divider />\n <Link to={link} onClick={onClick} underline=\"none\">\n <Box display=\"flex\" alignItems=\"center\" className={classes.root}>\n <Box className={classes.boxTitle} fontWeight=\"fontWeightBold\" m={1}>\n <Typography>\n <strong>{title}</strong>\n </Typography>\n </Box>\n <ArrowIcon className={classes.arrow} />\n </Box>\n </Link>\n </Box>\n );\n}\n","/*\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 Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ComponentClass, Component, ErrorInfo } from 'react';\nimport { LinkButton } from '../../components/LinkButton';\nimport { ErrorPanel } from '../../components/ErrorPanel';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SlackChannel = {\n name: string;\n href?: string;\n};\n\n/** @public */\nexport type ErrorBoundaryProps = PropsWithChildren<{\n slackChannel?: string | SlackChannel;\n onError?: (error: Error, errorInfo: string) => null;\n}>;\n\ntype State = {\n error?: Error;\n errorInfo?: ErrorInfo;\n};\n\nconst SlackLink = (props: { slackChannel?: string | SlackChannel }) => {\n const { slackChannel } = props;\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!slackChannel) {\n return null;\n } else if (typeof slackChannel === 'string') {\n return (\n <Typography>{t('errorBoundary.title', { slackChannel })}</Typography>\n );\n } else if (!slackChannel.href) {\n return (\n <Typography>\n {t('errorBoundary.title', {\n slackChannel: slackChannel.name,\n })}\n </Typography>\n );\n }\n\n return (\n <LinkButton to={slackChannel.href} variant=\"contained\">\n {slackChannel.name}\n </LinkButton>\n );\n};\n\n/** @public */\nexport const ErrorBoundary: ComponentClass<\n ErrorBoundaryProps,\n State\n> = class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {\n error: undefined,\n errorInfo: undefined,\n };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // eslint-disable-next-line no-console\n console.error(`ErrorBoundary, error: ${error}`, { error, errorInfo });\n this.setState({ error, errorInfo });\n }\n\n render() {\n const { slackChannel, children } = this.props;\n const { error } = this.state;\n\n if (!error) {\n return children;\n }\n\n return (\n <ErrorPanel title=\"Something Went Wrong\" error={error}>\n <SlackLink slackChannel={slackChannel} />\n </ErrorPanel>\n );\n }\n};\n","/*\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 Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader, { CardHeaderProps } from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { ReactNode } from 'react';\nimport { BottomLink, BottomLinkProps } from '../BottomLink';\nimport { ErrorBoundary, ErrorBoundaryProps } from '../ErrorBoundary';\n\n/** @public */\nexport type InfoCardClassKey =\n | 'noPadding'\n | 'header'\n | 'headerTitle'\n | 'headerSubheader'\n | 'headerAvatar'\n | 'headerAction'\n | 'headerContent';\n\nconst useStyles = makeStyles(\n theme => ({\n noPadding: {\n padding: 0,\n '&:last-child': {\n paddingBottom: 0,\n },\n },\n contentAlignBottom: {\n display: 'flex',\n alignItems: 'self-end',\n },\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n headerTitle: {\n fontWeight: theme.typography.fontWeightBold,\n },\n headerSubheader: {\n paddingTop: theme.spacing(1),\n },\n headerAvatar: {},\n headerAction: {},\n headerContent: {},\n subheader: {\n display: 'flex',\n },\n }),\n { name: 'BackstageInfoCard' },\n);\n\n/** @public */\nexport type CardActionsTopRightClassKey = 'root';\n\nconst CardActionsTopRight = withStyles(\n theme => ({\n root: {\n display: 'inline-block',\n padding: theme.spacing(8, 8, 0, 0),\n float: 'right',\n },\n }),\n { name: 'BackstageInfoCardCardActionsTopRight' },\n)(CardActions);\n\nconst VARIANT_STYLES = {\n card: {\n flex: {\n display: 'flex',\n flexDirection: 'column',\n },\n fullHeight: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItem: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n breakInside: 'avoid-page',\n '@media print': {\n height: 'auto',\n },\n },\n },\n cardContent: {\n fullHeight: {\n flex: 1,\n },\n gridItem: {\n flex: 1,\n },\n },\n};\n\n/** @public */\nexport type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem';\n\n/**\n * InfoCard is used to display a paper-styled block on the screen, similar to a panel.\n *\n * You can custom style an InfoCard with the 'className' (outer container) and 'cardClassName' (inner container)\n * props. This is typically used with the material-ui makeStyles mechanism.\n *\n * The InfoCard serves as an error boundary. As a result, if you provide an 'errorBoundaryProps' property this\n * specifies the extra information to display in the error component that is displayed if an error occurs\n * in any descendent components.\n *\n * By default the InfoCard has no custom layout of its children, but is treated as a block element. A\n * couple common variants are provided and can be specified via the variant property:\n *\n * When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.\n * Set to the 'gridItem' variant to display the InfoCard with full height suitable for Grid:\n *\n * `<InfoCard variant=\"gridItem\">...</InfoCard>`\n */\nexport type Props = {\n title?: ReactNode;\n subheader?: ReactNode;\n divider?: boolean;\n deepLink?: BottomLinkProps;\n /** @deprecated Use errorBoundaryProps instead */\n slackChannel?: string;\n errorBoundaryProps?: ErrorBoundaryProps;\n variant?: InfoCardVariants;\n alignContent?: 'normal' | 'bottom';\n children?: ReactNode;\n headerStyle?: object;\n headerProps?: CardHeaderProps;\n icon?: ReactNode;\n action?: ReactNode;\n actionsClassName?: string;\n actions?: ReactNode;\n cardClassName?: string;\n actionsTopRight?: ReactNode;\n className?: string;\n noPadding?: boolean;\n titleTypographyProps?: object;\n subheaderTypographyProps?: object;\n};\n\n/**\n * Material-ui card with header , content and actions footer\n *\n * @public\n *\n */\nexport function InfoCard(props: Props): JSX.Element {\n const {\n title,\n subheader,\n divider = true,\n deepLink,\n slackChannel,\n errorBoundaryProps,\n variant,\n alignContent = 'normal',\n children,\n headerStyle,\n headerProps,\n icon,\n action,\n actionsClassName,\n actions,\n cardClassName,\n actionsTopRight,\n className,\n noPadding,\n titleTypographyProps,\n subheaderTypographyProps,\n } = props;\n const classes = useStyles();\n /**\n * If variant is specified, we build up styles for that particular variant for both\n * the Card and the CardContent (since these need to be synced)\n */\n let calculatedStyle = {};\n let calculatedCardStyle = {};\n if (variant) {\n const variants = variant.split(/[\\s]+/g);\n variants.forEach(name => {\n calculatedStyle = {\n ...calculatedStyle,\n ...VARIANT_STYLES.card[name as keyof (typeof VARIANT_STYLES)['card']],\n };\n calculatedCardStyle = {\n ...calculatedCardStyle,\n ...VARIANT_STYLES.cardContent[\n name as keyof (typeof VARIANT_STYLES)['cardContent']\n ],\n };\n });\n }\n\n const cardSubTitle = () => {\n if (!subheader && !icon) {\n return null;\n }\n\n return (\n <div data-testid=\"info-card-subheader\">\n {subheader && <div className={classes.subheader}>{subheader}</div>}\n {icon}\n </div>\n );\n };\n\n const errProps: ErrorBoundaryProps =\n errorBoundaryProps || (slackChannel ? { slackChannel } : {});\n\n return (\n <Card style={calculatedStyle} className={className}>\n <ErrorBoundary {...errProps}>\n {title && (\n <CardHeader\n classes={{\n root: classNames(classes.header),\n title: classes.headerTitle,\n subheader: classes.headerSubheader,\n avatar: classes.headerAvatar,\n action: classes.headerAction,\n content: classes.headerContent,\n }}\n title={title}\n subheader={cardSubTitle()}\n action={action}\n style={{ ...headerStyle }}\n titleTypographyProps={titleTypographyProps}\n subheaderTypographyProps={subheaderTypographyProps}\n {...headerProps}\n />\n )}\n {actionsTopRight && (\n <CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>\n )}\n {divider && <Divider />}\n <CardContent\n className={classNames(cardClassName, {\n [classes.noPadding]: noPadding,\n [classes.contentAlignBottom]: alignContent === 'bottom',\n })}\n style={calculatedCardStyle}\n >\n {children}\n </CardContent>\n {actions && (\n <CardActions className={actionsClassName}>{actions}</CardActions>\n )}\n {deepLink && <BottomLink {...deepLink} />}\n </ErrorBoundary>\n </Card>\n );\n}\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\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 Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n color: theme.getPageTheme({ themeId: 'card' }).fontColor,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={stringifyEntityRef(entity)}\n data-testid={entity?.metadata?.title}\n title={\n entityRefToPresentation?.get(stringifyEntityRef(entity))\n ?.primaryTitle\n }\n >\n <div>{entity?.metadata?.description}</div>\n <div className={classes.linkSpacer} />\n <Link\n to={linkRoute(entity)}\n className={classes.readMoreLink}\n data-testid=\"read-docs-link\"\n >\n {linkContent || 'Read Docs'}\n </Link>\n </InfoCard>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport {\n ElementType,\n ChangeEvent,\n useCallback,\n useEffect,\n useState,\n} from 'react';\n\n// TODO(blam): Remove this implementation when the Tabs are ready\n// This is just a temporary solution to implementing tabs for now\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\nexport type Tab = {\n id: string;\n label: string;\n tabProps?: TabProps<ElementType, { component?: ElementType }>;\n};\n\ntype HeaderTabsProps = {\n tabs: Tab[];\n onChange?: (index: number) => void;\n selectedIndex?: number;\n};\n\n/**\n * Horizontal Tabs component\n *\n * @public\n *\n */\nexport function HeaderTabs(props: HeaderTabsProps) {\n const { tabs, onChange, selectedIndex } = props;\n const [selectedTab, setSelectedTab] = useState<number>(selectedIndex ?? 0);\n const styles = useStyles();\n\n const handleChange = useCallback(\n (_: ChangeEvent<{}>, index: number) => {\n if (selectedIndex === undefined) {\n setSelectedTab(index);\n }\n if (onChange) onChange(index);\n },\n [selectedIndex, onChange],\n );\n\n useEffect(() => {\n if (selectedIndex !== undefined) {\n setSelectedTab(selectedIndex);\n }\n }, [selectedIndex]);\n\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n {...tab.tabProps}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\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 { FC, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n useEntityOwnership,\n EntityListProvider,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable, DocsTableRow } from './Tables';\nimport { DocsCardGrid, InfoCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsIndexPage } from './TechDocsIndexPage';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../translation';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n TechDocsIndexPage: TechDocsIndexPage,\n InfoCardGrid: InfoCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType =\n | 'DocsCardGrid'\n | 'DocsTable'\n | 'TechDocsIndexPage'\n | 'InfoCardGrid';\n\n/**\n * Type representing Panel props\n *\n * @public\n */\nexport interface PanelProps {\n options?: TableOptions<DocsTableRow>;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n PageWrapper?: FC;\n CustomHeader?: FC;\n}\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n panelProps?: PanelProps;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\n/**\n * Component which can be used to render entities in a custom way.\n *\n * @public\n */\nexport const CustomDocsPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n const { t } = useTranslationRef(techdocsTranslationRef);\n const Header: FC =\n config.panelProps?.CustomHeader ||\n (() => (\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>{t('home.supportButton')}</SupportButton>\n ) : null}\n </ContentHeader>\n ));\n\n return (\n <>\n <Header />\n <div className={classes.panelContainer}>\n <EntityListProvider>\n <Panel\n data-testid=\"techdocs-custom-panel\"\n entities={shownEntities}\n {...config.panelProps}\n />\n </EntityListProvider>\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n filter?: EntityFilterQuery;\n CustomPageWrapper?: FC;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig, filter, CustomPageWrapper } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi = useApi(catalogApiRef);\n const { t } = useTranslationRef(techdocsTranslationRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n ...filter,\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <WarningPanel severity=\"error\" title={t('error.couldNotLoad')}>\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomDocsPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n","/*\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 { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\nimport { EntityDisplayName } from '@backstage/plugin-catalog-react';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={<EntityDisplayName entityRef={entity} />}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\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 {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n"],"names":["useStyles","makeStyles","theme","BottomLink","props","link","title","onClick","classes","Box","Divider","Link","Typography","ArrowIcon","SlackLink","slackChannel","t","useTranslationRef","coreComponentsTranslationRef","LinkButton","ErrorBoundary","Component","undefined","error","errorInfo","console","children","ErrorPanel","CardActionsTopRight","withStyles","CardActions","InfoCard","subheader","divider","deepLink","errorBoundaryProps","variant","alignContent","headerStyle","headerProps","icon","action","actionsClassName","actions","cardClassName","actionsTopRight","className","noPadding","titleTypographyProps","subheaderTypographyProps","calculatedStyle","calculatedCardStyle","variants","name","VARIANT_STYLES","Card","CardHeader","classNames","CardContent","createStyles","ItemCardGrid","otherProps","ItemCardHeader","subtitle","HeaderTabs","tabs","onChange","selectedIndex","selectedTab","setSelectedTab","useState","styles","handleChange","useCallback","_","index","useEffect","Tabs","tab","TabUI","panels","DocsTable","entities","getRouteToReaderPageFor","useRouteRef","rootDocsRouteRef","config","useApi","configApiRef","entity","CardMedia","EntityDisplayName","toLowerMaybe","TechDocsIndexPage","linkContent","linkDestination","entityPresentationApi","entityPresentationApiRef","entityRefToPresentation","loading","useAsync","Map","Promise","presentation","stringifyEntityRef","Progress","linkRoute","destination","CustomDocsPanel","loadingOwnership","isOwnedEntity","useEntityOwnership","identityApi","identityApiRef","refs","ownershipEntityRefs","useMemo","myOwnerRefs","Set","ref","getEntityRelations","RELATION_OWNED_BY","Panel","shownEntities","techdocsTranslationRef","Header","ContentHeader","SupportButton","EntityListProvider","TechDocsCustomHome","tabsConfig","filter","CustomPageWrapper","catalogApi","catalogApiRef","response","TECHDOCS_ANNOTATION","CATALOG_FILTER_EXISTS","currentTabConfig","TechDocsPageWrapper","Content","WarningPanel","CodeSnippet","label"],"mappings":"sIAEA,IAAI,EAAyB,EAAQ,MAEjC,EAA0B,EAAQ,MAKtC,UAAe,CAAG,KAAK,EAEvB,IAAI,EAAQ,EAAwB,EAAQ,OAQ5C,UAAe,CAJA,AAAC,GAAG,AAFE,EAAuB,EAAQ,QAElB,OAAO,AAAD,EAAiB,EAAM,aAAa,CAAC,OAAQ,CACnF,EAAG,2DACL,GAAI,e,2LCUJ,IAAMA,EAAYC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAChBC,AAAAA,GAAU,EACR,KAAM,CACJ,SAAU,cACV,QAASA,EAAM,OAAO,CAAC,EAAG,EAAG,EAAG,IAClC,EACA,SAAU,CACR,OAAQ,EACR,MAAOA,EAAM,OAAO,CAAC,UAAU,AACjC,EACA,MAAO,CACL,MAAOA,EAAM,OAAO,CAAC,UAAU,AACjC,CACF,GACA,CAAE,KAAM,qBAAsB,GAgBzB,SAASC,EAAWC,CAAsB,EAC/C,GAAM,CAAEC,KAAAA,CAAI,CAAEC,MAAAA,CAAK,CAAEC,QAAAA,CAAO,CAAE,CAAGH,EAC3BI,EAAUR,IAEhB,MACE,WAACS,EAAAA,CAAGA,CAAAA,C,UACF,UAACC,EAAAA,CAAOA,CAAAA,CAAAA,GACR,UAACC,EAAAA,EAAIA,CAAAA,CAAC,GAAIN,EAAM,QAASE,EAAS,UAAU,O,SAC1C,WAACE,EAAAA,CAAGA,CAAAA,CAAC,QAAQ,OAAO,WA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A,AACxE,EACA,OAAQ,CACN,aACA,OACA,WACA,YACA,aACA,YACD,AACH,EAAC,EACe,KAAK,CAAC,MAAM,CAAC,AAAChD,GACrB,CAAC,CAACA,EAAO,QAAQ,CAAC,WAAW,EAAE,CAAC+C,EAAAA,EAAmBA,CAAC,GAIzDE,EAAmBR,CAAU,CAAC9D,EAAY,QAEhD,AAAI+B,EAEA,UAACwC,EAAAA,CAAmBA,CAAAA,CAAC,kBAAmBP,E,SACtC,UAACQ,EAAAA,CAAOA,CAAAA,C,SACN,UAACnC,EAAAA,CAAQA,CAAAA,CAAAA,E,KAMblF,EAEA,UAACoH,EAAAA,CAAmBA,CAAAA,CAAC,kBAAmBP,E,SACtC,UAACQ,EAAAA,CAAOA,CAAAA,C,SACN,UAACC,EAAAA,CAAYA,CAAAA,CAAC,SAAS,QAAQ,MAAO7H,EAAE,sB,SACtC,UAAC8H,EAAAA,CAAWA,CAAAA,CAAC,SAAS,OAAO,KAAMvH,EAAM,QAAQ,E,SAQzD,WAACoH,EAAAA,CAAmBA,CAAAA,CAAC,kBAAmBP,E,UACtC,UAACpE,EAAUA,CACT,cAAeI,EACf,SAAUO,AAAAA,GAASN,EAAeM,GAClC,KAAMuD,EAAW,GAAG,CAAC,CAAC,CAAEa,MAAAA,CAAK,CAAE,CAAEpE,IAAW,EAC1C,GAAIA,EAAM,QAAQ,GAClBoE,MAAAA,CACF,G,GAEF,UAACH,EAAAA,CAAOA,CAAAA,CAAC,cAAY,mB,SAClBF,EAAiB,MAAM,CAAC,GAAG,CAAC,CAACpD,EAAQX,IACpC,UAACiC,EAAAA,CAEC,OAAQtB,EACR,SAAU,AAAEJ,GAAsB,EAAE,CACpC,MAAOP,C,EAHFA,G,KASjB,C"}
1
+ {"version":3,"file":"static/7226.21b332b45923.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../../node_modules/@material-ui/icons/ArrowForward.js","webpack://techdocs-cli-embedded-app/../core-components/src/layout/BottomLink/BottomLink.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/InfoCard/InfoCard.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/InfoCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityOwnership.ts"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar React = _interopRequireWildcard(require(\"react\"));\n\nvar _createSvgIcon = _interopRequireDefault(require(\"./utils/createSvgIcon\"));\n\nvar _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z\"\n}), 'ArrowForward');\n\nexports.default = _default;","/*\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 Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ArrowIcon from '@material-ui/icons/ArrowForward';\nimport { MouseEvent } from 'react';\nimport { Link } from '../../components/Link';\n\n/** @public */\nexport type BottomLinkClassKey = 'root' | 'boxTitle' | 'arrow';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n maxWidth: 'fit-content',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n boxTitle: {\n margin: 0,\n color: theme.palette.textSubtle,\n },\n arrow: {\n color: theme.palette.textSubtle,\n },\n }),\n { name: 'BackstageBottomLink' },\n);\n\n/** @public */\nexport type BottomLinkProps = {\n link: string;\n title: string;\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n};\n\n/**\n * Footer with link used in {@link InfoCard } and {@link TabbedCard}\n *\n * @public\n *\n */\nexport function BottomLink(props: BottomLinkProps) {\n const { link, title, onClick } = props;\n const classes = useStyles();\n\n return (\n <Box>\n <Divider />\n <Link to={link} onClick={onClick} underline=\"none\">\n <Box display=\"flex\" alignItems=\"center\" className={classes.root}>\n <Box className={classes.boxTitle} fontWeight=\"fontWeightBold\" m={1}>\n <Typography>\n <strong>{title}</strong>\n </Typography>\n </Box>\n <ArrowIcon className={classes.arrow} />\n </Box>\n </Link>\n </Box>\n );\n}\n","/*\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 Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ComponentClass, Component, ErrorInfo } from 'react';\nimport { LinkButton } from '../../components/LinkButton';\nimport { ErrorPanel } from '../../components/ErrorPanel';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SlackChannel = {\n name: string;\n href?: string;\n};\n\n/** @public */\nexport type ErrorBoundaryProps = PropsWithChildren<{\n slackChannel?: string | SlackChannel;\n onError?: (error: Error, errorInfo: string) => null;\n}>;\n\ntype State = {\n error?: Error;\n errorInfo?: ErrorInfo;\n};\n\nconst SlackLink = (props: { slackChannel?: string | SlackChannel }) => {\n const { slackChannel } = props;\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!slackChannel) {\n return null;\n } else if (typeof slackChannel === 'string') {\n return (\n <Typography>{t('errorBoundary.title', { slackChannel })}</Typography>\n );\n } else if (!slackChannel.href) {\n return (\n <Typography>\n {t('errorBoundary.title', {\n slackChannel: slackChannel.name,\n })}\n </Typography>\n );\n }\n\n return (\n <LinkButton to={slackChannel.href} variant=\"contained\">\n {slackChannel.name}\n </LinkButton>\n );\n};\n\n/** @public */\nexport const ErrorBoundary: ComponentClass<\n ErrorBoundaryProps,\n State\n> = class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {\n error: undefined,\n errorInfo: undefined,\n };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // eslint-disable-next-line no-console\n console.error(`ErrorBoundary, error: ${error}`, { error, errorInfo });\n this.setState({ error, errorInfo });\n }\n\n render() {\n const { slackChannel, children } = this.props;\n const { error } = this.state;\n\n if (!error) {\n return children;\n }\n\n return (\n <ErrorPanel title=\"Something Went Wrong\" error={error}>\n <SlackLink slackChannel={slackChannel} />\n </ErrorPanel>\n );\n }\n};\n","/*\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 Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader, { CardHeaderProps } from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { ReactNode } from 'react';\nimport { BottomLink, BottomLinkProps } from '../BottomLink';\nimport { ErrorBoundary, ErrorBoundaryProps } from '../ErrorBoundary';\n\n/** @public */\nexport type InfoCardClassKey =\n | 'noPadding'\n | 'header'\n | 'headerTitle'\n | 'headerSubheader'\n | 'headerAvatar'\n | 'headerAction'\n | 'headerContent';\n\nconst useStyles = makeStyles(\n theme => ({\n noPadding: {\n padding: 0,\n '&:last-child': {\n paddingBottom: 0,\n },\n },\n contentAlignBottom: {\n display: 'flex',\n alignItems: 'self-end',\n },\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n headerTitle: {\n fontWeight: theme.typography.fontWeightBold,\n },\n headerSubheader: {\n paddingTop: theme.spacing(1),\n },\n headerAvatar: {},\n headerAction: {},\n headerContent: {},\n subheader: {\n display: 'flex',\n },\n }),\n { name: 'BackstageInfoCard' },\n);\n\n/** @public */\nexport type CardActionsTopRightClassKey = 'root';\n\nconst CardActionsTopRight = withStyles(\n theme => ({\n root: {\n display: 'inline-block',\n padding: theme.spacing(8, 8, 0, 0),\n float: 'right',\n },\n }),\n { name: 'BackstageInfoCardCardActionsTopRight' },\n)(CardActions);\n\nconst VARIANT_STYLES = {\n card: {\n flex: {\n display: 'flex',\n flexDirection: 'column',\n },\n fullHeight: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItem: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n breakInside: 'avoid-page',\n '@media print': {\n height: 'auto',\n },\n },\n },\n cardContent: {\n fullHeight: {\n flex: 1,\n },\n gridItem: {\n flex: 1,\n },\n },\n};\n\n/** @public */\nexport type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem';\n\n/**\n * InfoCard is used to display a paper-styled block on the screen, similar to a panel.\n *\n * You can custom style an InfoCard with the 'className' (outer container) and 'cardClassName' (inner container)\n * props. This is typically used with the material-ui makeStyles mechanism.\n *\n * The InfoCard serves as an error boundary. As a result, if you provide an 'errorBoundaryProps' property this\n * specifies the extra information to display in the error component that is displayed if an error occurs\n * in any descendent components.\n *\n * By default the InfoCard has no custom layout of its children, but is treated as a block element. A\n * couple common variants are provided and can be specified via the variant property:\n *\n * When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.\n * Set to the 'gridItem' variant to display the InfoCard with full height suitable for Grid:\n *\n * `<InfoCard variant=\"gridItem\">...</InfoCard>`\n */\nexport type Props = {\n title?: ReactNode;\n subheader?: ReactNode;\n divider?: boolean;\n deepLink?: BottomLinkProps;\n /** @deprecated Use errorBoundaryProps instead */\n slackChannel?: string;\n errorBoundaryProps?: ErrorBoundaryProps;\n variant?: InfoCardVariants;\n alignContent?: 'normal' | 'bottom';\n children?: ReactNode;\n headerStyle?: object;\n headerProps?: CardHeaderProps;\n icon?: ReactNode;\n action?: ReactNode;\n actionsClassName?: string;\n actions?: ReactNode;\n cardClassName?: string;\n actionsTopRight?: ReactNode;\n className?: string;\n noPadding?: boolean;\n titleTypographyProps?: object;\n subheaderTypographyProps?: object;\n};\n\n/**\n * Material-ui card with header , content and actions footer\n *\n * @public\n *\n */\nexport function InfoCard(props: Props): JSX.Element {\n const {\n title,\n subheader,\n divider = true,\n deepLink,\n slackChannel,\n errorBoundaryProps,\n variant,\n alignContent = 'normal',\n children,\n headerStyle,\n headerProps,\n icon,\n action,\n actionsClassName,\n actions,\n cardClassName,\n actionsTopRight,\n className,\n noPadding,\n titleTypographyProps,\n subheaderTypographyProps,\n } = props;\n const classes = useStyles();\n /**\n * If variant is specified, we build up styles for that particular variant for both\n * the Card and the CardContent (since these need to be synced)\n */\n let calculatedStyle = {};\n let calculatedCardStyle = {};\n if (variant) {\n const variants = variant.split(/[\\s]+/g);\n variants.forEach(name => {\n calculatedStyle = {\n ...calculatedStyle,\n ...VARIANT_STYLES.card[name as keyof (typeof VARIANT_STYLES)['card']],\n };\n calculatedCardStyle = {\n ...calculatedCardStyle,\n ...VARIANT_STYLES.cardContent[\n name as keyof (typeof VARIANT_STYLES)['cardContent']\n ],\n };\n });\n }\n\n const cardSubTitle = () => {\n if (!subheader && !icon) {\n return null;\n }\n\n return (\n <div data-testid=\"info-card-subheader\">\n {subheader && <div className={classes.subheader}>{subheader}</div>}\n {icon}\n </div>\n );\n };\n\n const errProps: ErrorBoundaryProps =\n errorBoundaryProps || (slackChannel ? { slackChannel } : {});\n\n return (\n <Card style={calculatedStyle} className={className}>\n <ErrorBoundary {...errProps}>\n {title && (\n <CardHeader\n classes={{\n root: classNames(classes.header),\n title: classes.headerTitle,\n subheader: classes.headerSubheader,\n avatar: classes.headerAvatar,\n action: classes.headerAction,\n content: classes.headerContent,\n }}\n title={title}\n subheader={cardSubTitle()}\n action={action}\n style={{ ...headerStyle }}\n titleTypographyProps={titleTypographyProps}\n subheaderTypographyProps={subheaderTypographyProps}\n {...headerProps}\n />\n )}\n {actionsTopRight && (\n <CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>\n )}\n {divider && <Divider />}\n <CardContent\n className={classNames(cardClassName, {\n [classes.noPadding]: noPadding,\n [classes.contentAlignBottom]: alignContent === 'bottom',\n })}\n style={calculatedCardStyle}\n >\n {children}\n </CardContent>\n {actions && (\n <CardActions className={actionsClassName}>{actions}</CardActions>\n )}\n {deepLink && <BottomLink {...deepLink} />}\n </ErrorBoundary>\n </Card>\n );\n}\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\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 Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { ReactNode } from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n color: theme.getPageTheme({ themeId: 'card' }).fontColor,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\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 useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n ItemCardGrid,\n InfoCard,\n Link,\n Progress,\n} from '@backstage/core-components';\nimport {\n EntityRefPresentationSnapshot,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\n\n/** @public */\nexport type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';\n\nconst useStyles = makeStyles(\n theme => ({\n linkSpacer: {\n paddingTop: theme.spacing(0.2),\n },\n readMoreLink: {\n paddingTop: theme.spacing(0.2),\n },\n }),\n { name: 'BackstageInfoCardGrid' },\n);\n\n/**\n * Props for {@link InfoCardGrid}\n *\n * @public\n */\nexport type InfoCardGridProps = {\n entities: Entity[] | undefined;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a info card for each entity\n *\n * @public\n */\nexport const InfoCardGrid = (props: InfoCardGridProps) => {\n const { entities, linkContent, linkDestination } = props;\n const classes = useStyles();\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n const linkRoute = (entity: Entity) => {\n if (linkDestination) {\n const destination = linkDestination(entity);\n if (destination) {\n return destination;\n }\n }\n return getRouteToReaderPageFor({\n namespace: toLowerMaybe(entity.metadata.namespace ?? 'default', config),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n });\n };\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entityRefToPresentation, loading } = useAsync(async () => {\n return new Map<string, EntityRefPresentationSnapshot>(\n await Promise.all(\n entities?.map(async entity => {\n const presentation = await entityPresentationApi.forEntity(entity)\n .promise;\n return [stringifyEntityRef(entity), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }) || [],\n ),\n );\n });\n if (loading) return <Progress />;\n if (!entities || !entities?.length) return null;\n return (\n <ItemCardGrid data-testid=\"info-card-container\">\n {entities.map(entity => (\n <InfoCard\n key={stringifyEntityRef(entity)}\n data-testid={entity?.metadata?.title}\n title={\n entityRefToPresentation?.get(stringifyEntityRef(entity))\n ?.primaryTitle\n }\n >\n <div>{entity?.metadata?.description}</div>\n <div className={classes.linkSpacer} />\n <Link\n to={linkRoute(entity)}\n className={classes.readMoreLink}\n data-testid=\"read-docs-link\"\n >\n {linkContent || 'Read Docs'}\n </Link>\n </InfoCard>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport {\n ElementType,\n ChangeEvent,\n useCallback,\n useEffect,\n useState,\n} from 'react';\n\n// TODO(blam): Remove this implementation when the Tabs are ready\n// This is just a temporary solution to implementing tabs for now\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\nexport type Tab = {\n id: string;\n label: string;\n tabProps?: TabProps<ElementType, { component?: ElementType }>;\n};\n\ntype HeaderTabsProps = {\n tabs: Tab[];\n onChange?: (index: number) => void;\n selectedIndex?: number;\n};\n\n/**\n * Horizontal Tabs component\n *\n * @public\n *\n */\nexport function HeaderTabs(props: HeaderTabsProps) {\n const { tabs, onChange, selectedIndex } = props;\n const [selectedTab, setSelectedTab] = useState<number>(selectedIndex ?? 0);\n const styles = useStyles();\n\n const handleChange = useCallback(\n (_: ChangeEvent<{}>, index: number) => {\n if (selectedIndex === undefined) {\n setSelectedTab(index);\n }\n if (onChange) onChange(index);\n },\n [selectedIndex, onChange],\n );\n\n useEffect(() => {\n if (selectedIndex !== undefined) {\n setSelectedTab(selectedIndex);\n }\n }, [selectedIndex]);\n\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n {...tab.tabProps}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\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 { FC, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n useEntityOwnership,\n EntityListProvider,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable, DocsTableRow } from './Tables';\nimport { DocsCardGrid, InfoCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\nimport { TechDocsIndexPage } from './TechDocsIndexPage';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { techdocsTranslationRef } from '../../translation';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n TechDocsIndexPage: TechDocsIndexPage,\n InfoCardGrid: InfoCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType =\n | 'DocsCardGrid'\n | 'DocsTable'\n | 'TechDocsIndexPage'\n | 'InfoCardGrid';\n\n/**\n * Type representing Panel props\n *\n * @public\n */\nexport interface PanelProps {\n options?: TableOptions<DocsTableRow>;\n linkContent?: string | JSX.Element;\n linkDestination?: (entity: Entity) => string | undefined;\n PageWrapper?: FC;\n CustomHeader?: FC;\n}\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n panelProps?: PanelProps;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\n/**\n * Component which can be used to render entities in a custom way.\n *\n * @public\n */\nexport const CustomDocsPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n const { t } = useTranslationRef(techdocsTranslationRef);\n const Header: FC =\n config.panelProps?.CustomHeader ||\n (() => (\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>{t('home.supportButton')}</SupportButton>\n ) : null}\n </ContentHeader>\n ));\n\n return (\n <>\n <Header />\n <div className={classes.panelContainer}>\n <EntityListProvider>\n <Panel\n data-testid=\"techdocs-custom-panel\"\n entities={shownEntities}\n {...config.panelProps}\n />\n </EntityListProvider>\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n filter?: EntityFilterQuery;\n CustomPageWrapper?: FC;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig, filter, CustomPageWrapper } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi = useApi(catalogApiRef);\n const { t } = useTranslationRef(techdocsTranslationRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n ...filter,\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <Content>\n <WarningPanel severity=\"error\" title={t('error.couldNotLoad')}>\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper CustomPageWrapper={CustomPageWrapper}>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomDocsPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n","/*\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 { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\nimport { EntityDisplayName } from '@backstage/plugin-catalog-react';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={<EntityDisplayName entityRef={entity} />}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\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 {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n"],"names":["useStyles","makeStyles","theme","BottomLink","props","link","title","onClick","classes","Box","Divider","Link","Typography","ArrowIcon","SlackLink","slackChannel","t","useTranslationRef","coreComponentsTranslationRef","LinkButton","ErrorBoundary","Component","undefined","error","errorInfo","console","children","ErrorPanel","CardActionsTopRight","withStyles","CardActions","InfoCard","subheader","divider","deepLink","errorBoundaryProps","variant","alignContent","headerStyle","headerProps","icon","action","actionsClassName","actions","cardClassName","actionsTopRight","className","noPadding","titleTypographyProps","subheaderTypographyProps","calculatedStyle","calculatedCardStyle","variants","name","VARIANT_STYLES","Card","CardHeader","classNames","CardContent","createStyles","ItemCardGrid","otherProps","ItemCardHeader","subtitle","HeaderTabs","tabs","onChange","selectedIndex","selectedTab","setSelectedTab","useState","styles","handleChange","useCallback","_","index","useEffect","Tabs","tab","TabUI","panels","DocsTable","entities","getRouteToReaderPageFor","useRouteRef","rootDocsRouteRef","config","useApi","configApiRef","entity","CardMedia","EntityDisplayName","toLowerMaybe","TechDocsIndexPage","linkContent","linkDestination","entityPresentationApi","entityPresentationApiRef","entityRefToPresentation","loading","useAsync","Map","Promise","presentation","stringifyEntityRef","Progress","linkRoute","destination","CustomDocsPanel","loadingOwnership","isOwnedEntity","useEntityOwnership","identityApi","identityApiRef","refs","ownershipEntityRefs","useMemo","myOwnerRefs","Set","ref","getEntityRelations","RELATION_OWNED_BY","Panel","shownEntities","techdocsTranslationRef","Header","ContentHeader","SupportButton","EntityListProvider","TechDocsCustomHome","tabsConfig","filter","CustomPageWrapper","catalogApi","catalogApiRef","response","TECHDOCS_ANNOTATION","CATALOG_FILTER_EXISTS","currentTabConfig","TechDocsPageWrapper","Content","WarningPanel","CodeSnippet","label"],"mappings":"sIAEA,IAAI,EAAyB,EAAQ,MAEjC,EAA0B,EAAQ,MAKtC,UAAe,CAAG,KAAK,EAEvB,IAAI,EAAQ,EAAwB,EAAQ,OAQ5C,UAAe,CAJA,AAAC,GAAG,AAFE,EAAuB,EAAQ,QAElB,OAAO,AAAD,EAAiB,EAAM,aAAa,CAAC,OAAQ,CACnF,EAAG,2DACL,GAAI,e,2LCUJ,IAAMA,EAAYC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAChBC,AAAAA,GAAU,EACR,KAAM,CACJ,SAAU,cACV,QAASA,EAAM,OAAO,CAAC,EAAG,EAAG,EAAG,IAClC,EACA,SAAU,CACR,OA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G,CAAC,CAAC,CAAEa,MAAAA,CAAK,CAAE,CAAEpE,IAAW,EAC1C,GAAIA,EAAM,QAAQ,GAClBoE,MAAAA,CACF,G,GAEF,UAACH,EAAAA,CAAOA,CAAAA,CAAC,cAAY,mB,SAClBF,EAAiB,MAAM,CAAC,GAAG,CAAC,CAACpD,EAAQX,IACpC,UAACiC,EAAAA,CAEC,OAAQtB,EACR,SAAU,AAAEJ,GAAsB,EAAE,CACpC,MAAOP,C,EAHFA,G,KASjB,C"}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["7632"],{6659(e,t,r){r.d(t,{DependencyGraph:()=>P});var n=r(31085),a=r(14041),i=r(37238),l=r(53373),s=r.n(l),d=r(45250),u=r(68510),o=r(67566),c=r(41809),h=r(57586),f=r.n(h),m=r(12784),g=r.n(m),x=r(6033),p=r(22249),k=r(58837);let w=(0,k.A)(e=>({node:{fill:e.palette.primary.light,stroke:e.palette.primary.light},text:{fill:e.palette.primary.contrastText}}),{name:"BackstageDependencyGraphDefaultNode"});function b({node:{id:e}}){let t=w(),[r,i]=(0,a.useState)(0),[l,s]=(0,a.useState)(0),d=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>{if(d.current){let{height:e,width:t}=d.current.getBBox();e=Math.round(e),t=Math.round(t),(e!==l||t!==r)&&(i(t),s(e))}},[r,l]);let u=r+20,o=l+20;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{className:t.node,width:u,height:o,rx:10}),(0,n.jsx)("text",{ref:d,className:t.text,y:o/2,x:u/2,textAnchor:"middle",alignmentBaseline:"middle",children:e})]})}let y=(0,p.default)(e=>({node:{transition:`${e.transitions.duration.shortest}ms`}}),{name:"BackstageDependencyGraphNode"}),v=e=>(0,n.jsx)(b,{...e});function j({render:e=v,setNode:t,node:r}){let{width:i,height:l,x:s=0,y:d=0}=r,u=y(),o=(0,a.useRef)(null);return(0,a.useLayoutEffect)(()=>{if(o.current){let{height:e,width:n}=o.current.getBBox();e=Math.round(e),n=Math.round(n),(e!==l||n!==i)&&t(r.id,{...r,height:e,width:n})}},[r,i,l,t]),(0,n.jsx)("g",{ref:o,"data-testid":"node",className:u.node,transform:`translate(${s-i/2},${d-l/2})`,children:e({node:r})})}var M=r(1121),E=r(12895),B=r(20644),N=r.n(B);let $="arrow-marker",S=(0,p.default)(e=>({text:{fill:e.palette.textContrast}}),{name:"BackstageDependencyGraphDefaultLabel"});function A({edge:{label:e}}){let t=S();return(0,n.jsx)("text",{className:t.text,textAnchor:"middle",children:e})}let R=(0,p.default)(e=>({path:{strokeWidth:1.3,stroke:e.palette.textSubtle,fill:"none",transition:`${e.transitions.duration.shortest}ms`},label:{transition:`${e.transitions.duration.shortest}ms`}}),{name:"BackstageDependencyGraphEdge"}),D=e=>(0,n.jsx)(A,{...e});function H({render:e=D,setEdge:t,id:r,edge:i,curve:l,showArrowHeads:s}){let{x:d=0,y:u=0,width:o,height:c,points:h}=i,f=R(),m=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>{if(m.current){let{height:e,width:n}=m.current.getBBox();e=Math.round(e),n=Math.round(n),(e!==c||n!==o)&&t(r,{...i,height:e,width:n})}},[i,c,o,t,r]);let g="",x=(0,a.useMemo)(()=>M.A().x(e=>e.x).y(e=>e.y).curve(E[l]),[l]);return h&&(g=x(h.filter(e=>N()(e.x)&&N()(e.y)))||""),(0,n.jsxs)(n.Fragment,{children:[g&&(0,n.jsx)("path",{"data-testid":"edge",className:f.path,markerEnd:s?`url(#${$})`:void 0,d:g}),i.label?(0,n.jsx)("g",{ref:m,"data-testid":"label",className:f.label,transform:`translate(${d},${u})`,children:e({edge:i})}):null]})}var C=r(29365),G=r(25828),T=r(63988),W=r(14112),_=r(71677),L=r(89595),O=r(89332);let q=(0,k.A)(e=>({fullscreenButton:{position:"absolute",right:0},root:{overflow:"hidden",minHeight:"100%",minWidth:"100%"},fixedHeight:{maxHeight:"100%"},fullscreen:{backgroundColor:e.palette.background.paper}})),F="workspace",I="dependency-graph";function P(e){let{edges:t,nodes:r,renderNode:l,direction:h=x.D.Direction.TOP_BOTTOM,align:m,nodeMargin:p=50,edgeMargin:k=10,rankMargin:w=50,paddingX:b=0,paddingY:y=0,acyclicer:v,ranker:M=x.D.Ranker.NETWORK_SIMPLEX,labelPosition:E=x.D.LabelPosition.RIGHT,labelOffset:B=10,edgeRanks:N=1,edgeWeight:S=1,renderEdge:A,renderLabel:R,defs:D,zoom:P="enabled",curve:X="curveMonotoneX",showArrowHeads:z=!1,fit:K="grow",allowFullscreen:U=!0,...V}=e,Y=(0,c.default)(),[J,Q]=(0,a.useState)(100),[Z,ee]=(0,a.useState)(100),et=(0,W.V)(),er=q(),{t:en}=(0,L.i)(O.O),ea=(0,a.useRef)(new(f()).graphlib.Graph),[ei,el]=(0,a.useState)(ea.current.graph()?.width||0),[es,ed]=(0,a.useState)(ea.current.graph()?.height||0),[eu,eo]=(0,a.useState)([]),[ec,eh]=(0,a.useState)([]),[ef,em]=(0,a.useState)(!1),[eg,ex]=(0,a.useState)(!1),ep=(0,a.useRef)(!1),ek=(0,a.useRef)(!1),ew=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(ef&&!eg){let e=requestAnimationFrame(()=>{ex(!0)});return()=>cancelAnimationFrame(e)}},[ef,eg]),(0,a.useEffect)(()=>{if(eu.length>0&&!ep.current){let e=setTimeout(()=>{ep.current||(ep.current=!0,em(!0))},500);return()=>clearTimeout(e)}},[eu]);let eb=Math.max(ei,J),ey=Math.max(es,Z),ev=(0,a.useRef)({containerWidth:J,containerHeight:Z,maxWidth:eb,maxHeight:ey});ev.current={containerWidth:J,containerHeight:Z,maxWidth:eb,maxHeight:ey};let[ej]=(0,i.A)(),eM=(0,d.once)(ej),eE="grow"!==K||et.active?"100%":ey,eB=(0,a.useMemo)(()=>g()(e=>{if(!e)return;eM(e);let t=e.querySelector(`svg#${I}`);if(!t)return;let r=o.A(t),n=o.A(t.getElementById(F));function a(){r.call(u.s_().scaleExtent([1,1/0]).on("zoom",e=>{let t=ev.current;e.transform.x=Math.min(0,Math.max(e.transform.x,t.maxWidth-t.maxWidth*e.transform.k)),e.transform.y=Math.min(0,Math.max(e.transform.y,t.maxHeight-t.maxHeight*e.transform.k)),n.attr("transform",e.transform)}))}"enabled"===P?a():"enable-on-click"===P&&r.on("click",()=>a());let{width:i,height:l}=e.getBoundingClientRect(),s=ev.current;s.containerWidth!==i&&i<=s.maxWidth&&Q(i),s.containerHeight!==l&&l<=s.maxHeight&&ee(l)},100),[eM,P]),eN=(0,a.useCallback)(()=>{let e=ea.current.nodes(),n=ea.current.edges();e.forEach(e=>{r.some(t=>t.id===e)||ea.current.removeNode(e)}),n.forEach(e=>{t.some(t=>t.from===e.v&&t.to===e.w)||ea.current.removeEdge(e.v,e.w)}),r.forEach(e=>{let t=ea.current.nodes().find(t=>e.id===t);if(t&&ea.current.node(t)){let{width:r,height:n,x:a,y:i}=ea.current.node(t);ea.current.setNode(t,{...e,width:r,height:n,x:a,y:i})}else ea.current.setNode(e.id,{...e,width:0,height:0})}),t.forEach(e=>{ea.current.setEdge(e.from,e.to,{...e,label:e.label,width:0,height:0,labelpos:E,labeloffset:B,weight:S,minlen:N})})},[t,r,E,B,S,N]),e$=(0,a.useMemo)(()=>g()(()=>{f().layout(ea.current);let{height:e,width:t}=ea.current.graph(),r=Math.max(0,e||0);if(el(Math.max(0,t||0)),ed(r),eo(ea.current.nodes()),eh(ea.current.edges()),!ep.current){let e=ea.current.nodes();e.length>0&&e.some(e=>{let t=ea.current.node(e);return t&&t.width>0&&t.height>0})&&(ew.current+=1),(ew.current>=2||0===e.length)&&(ep.current=!0,em(!0))}},250,{leading:!0}),[]);(0,a.useEffect)(()=>(ea.current.setGraph({rankdir:h,align:m,nodesep:p,edgesep:k,ranksep:w,marginx:b,marginy:y,acyclicer:v,ranker:M}),eN(),e$(),e$.cancel),[v,m,h,k,b,y,p,w,M,eN,e$]);let eS=(0,a.useCallback)((e,t)=>(ea.current.setNode(e,t),e$(),ep.current||ek.current||(ek.current=!0,queueMicrotask(()=>{ek.current=!1,e$.flush()})),ea.current),[e$]),eA=(0,a.useCallback)((e,t)=>(ea.current.setEdge(e,t),e$(),ea.current),[e$]);return(0,n.jsxs)(W.m,{handle:et,className:s()(et.active?er.fullscreen:er.root),children:[U&&(0,n.jsx)(_.Ay,{title:en("dependencyGraph.fullscreenTooltip"),children:(0,n.jsx)(C.A,{className:er.fullscreenButton,onClick:et.active?et.exit:et.enter,children:et.active?(0,n.jsx)(T.default,{}):(0,n.jsx)(G.default,{})})}),(0,n.jsx)("div",{ref:eB,style:{width:"100%",height:"100%",visibility:ef?"visible":"hidden"},children:(0,n.jsxs)("svg",{...V,width:"100%",height:eE,viewBox:`0 0 ${eb} ${ey}`,id:I,children:[(0,n.jsxs)("defs",{children:[(0,n.jsx)("marker",{id:$,viewBox:"0 0 24 24",markerWidth:"14",markerHeight:"14",refX:"16",refY:"12",orient:"auto",markerUnits:"strokeWidth",children:(0,n.jsx)("path",{fill:Y.palette.textSubtle,d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"})}),D]}),!eg&&(0,n.jsx)("style",{children:`#${I} * { transition: none !important; }`}),(0,n.jsx)("g",{id:F,children:(0,n.jsxs)("svg",{width:ei,height:es,y:ey/2-es/2,x:eb/2-ei/2,viewBox:`0 0 ${ei} ${es}`,children:[ec.map(e=>{let t=ea.current.edge(e);return t?A?A({edge:t,id:e}):(0,n.jsx)(H,{id:e,setEdge:eA,render:R,edge:t,curve:X,showArrowHeads:z},`${e.v}-${e.w}`):null}),eu.map(e=>{let t=ea.current.node(e);return t?(0,n.jsx)(j,{setNode:eS,render:l,node:t},e):null})]})})]})})]})}}}]);
2
+ //# sourceMappingURL=7632.3917bed33d55.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static/7632.79234b81e968.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DefaultNode.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/Node.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/constants.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DefaultLabel.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/Edge.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DependencyGraphContent.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 { useState, useRef, useLayoutEffect } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { DependencyGraphTypes as Types } from './types';\n\n/** @public */\nexport type DependencyGraphDefaultNodeClassKey = 'node' | 'text';\n\nconst useStyles = makeStyles(\n theme => ({\n node: {\n fill: theme.palette.primary.light,\n stroke: theme.palette.primary.light,\n },\n text: {\n fill: theme.palette.primary.contrastText,\n },\n }),\n { name: 'BackstageDependencyGraphDefaultNode' },\n);\n\n/** @public */\nexport function DefaultNode({ node: { id } }: Types.RenderNodeProps) {\n const classes = useStyles();\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const idRef = useRef<SVGTextElement | null>(null);\n\n useLayoutEffect(() => {\n // set the width to the length of the ID\n if (idRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n idRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setWidth(renderedWidth);\n setHeight(renderedHeight);\n }\n }\n }, [width, height]);\n\n const padding = 10;\n const paddedWidth = width + padding * 2;\n const paddedHeight = height + padding * 2;\n\n return (\n <g>\n <rect\n className={classes.node}\n width={paddedWidth}\n height={paddedHeight}\n rx={10}\n />\n <text\n ref={idRef}\n className={classes.text}\n y={paddedHeight / 2}\n x={paddedWidth / 2}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n >\n {id}\n </text>\n </g>\n );\n}\n","/*\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 { useRef, useLayoutEffect } from 'react';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DefaultNode } from './DefaultNode';\nimport { DependencyGraphTypes as Types } from './types';\nimport { NODE_TEST_ID } from './constants';\nimport dagre from '@dagrejs/dagre';\n\n/** @public */\nexport type DependencyGraphNodeClassKey = 'node';\n\nconst useStyles = makeStyles(\n theme => ({\n node: {\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n }),\n { name: 'BackstageDependencyGraphNode' },\n);\n\nexport type GraphNode<T> = dagre.Node<Types.DependencyNode<T>>;\n\nexport type NodeComponentProps<T> = {\n node: GraphNode<T>;\n render?: Types.RenderNodeFunction<T>;\n setNode: dagre.graphlib.Graph['setNode'];\n};\n\nconst renderDefault = (props: Types.RenderNodeProps) => (\n <DefaultNode {...props} />\n);\n\nexport function Node<T>({\n render = renderDefault,\n setNode,\n node,\n}: NodeComponentProps<T>) {\n const { width, height, x = 0, y = 0 } = node;\n const nodeProps: Types.DependencyNode<T> = node;\n const classes = useStyles();\n const nodeRef = useRef<SVGGElement | null>(null);\n\n useLayoutEffect(() => {\n // set the node width to the actual rendered width to properly layout graph\n if (nodeRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n nodeRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setNode(node.id, {\n ...node,\n height: renderedHeight,\n width: renderedWidth,\n });\n }\n }\n }, [node, width, height, setNode]);\n\n return (\n <g\n ref={nodeRef}\n data-testid={NODE_TEST_ID}\n className={classes.node}\n transform={`translate(${x - width / 2},${y - height / 2})`}\n >\n {render({ node: nodeProps })}\n </g>\n );\n}\n","/*\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\nexport const ARROW_MARKER_ID = 'arrow-marker';\n\nexport const NODE_TEST_ID = 'node';\nexport const EDGE_TEST_ID = 'edge';\nexport const LABEL_TEST_ID = 'label';\n","/*\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 makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DependencyGraphTypes as Types } from './types';\n\n/** @public */\nexport type DependencyGraphDefaultLabelClassKey = 'text';\n\nconst useStyles = makeStyles(\n theme => ({\n text: {\n fill: theme.palette.textContrast,\n },\n }),\n { name: 'BackstageDependencyGraphDefaultLabel' },\n);\n\n/** @public */\nexport function DefaultLabel({ edge: { label } }: Types.RenderLabelProps) {\n const classes = useStyles();\n return (\n <text className={classes.text} textAnchor=\"middle\">\n {label}\n </text>\n );\n}\n","/*\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 { useRef, useLayoutEffect, useMemo } from 'react';\nimport * as d3Shape from 'd3-shape';\nimport isFinite from 'lodash/isFinite';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DependencyGraphTypes as Types } from './types';\nimport { ARROW_MARKER_ID, EDGE_TEST_ID, LABEL_TEST_ID } from './constants';\nimport { DefaultLabel } from './DefaultLabel';\nimport dagre from '@dagrejs/dagre';\n\n/* Based on: https://github.com/dagrejs/dagre/wiki#configuring-the-layout */\nexport type EdgeProperties = {\n label?: string;\n width?: number;\n height?: number;\n labeloffset?: number;\n labelpos?: Types.LabelPosition;\n minlen?: number;\n weight?: number;\n};\nexport type GraphEdge<T> = Types.DependencyEdge<T> &\n dagre.GraphEdge &\n EdgeProperties;\n\n/** @public */\nexport type DependencyGraphEdgeClassKey = 'path' | 'label';\n\nconst useStyles = makeStyles(\n theme => ({\n path: {\n strokeWidth: 1.3,\n stroke: theme.palette.textSubtle,\n fill: 'none',\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n label: {\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n }),\n { name: 'BackstageDependencyGraphEdge' },\n);\n\ntype EdgePoint = dagre.GraphEdge['points'][0];\n\n/** @public */\nexport type EdgeComponentProps<T = unknown> = {\n id: dagre.Edge;\n edge: GraphEdge<T>;\n render?: Types.RenderLabelFunction<T>;\n setEdge: (\n id: dagre.Edge,\n edge: Types.DependencyEdge<T>,\n ) => dagre.graphlib.Graph<{}>;\n curve: 'curveStepBefore' | 'curveMonotoneX';\n showArrowHeads?: boolean;\n};\n\nconst renderDefault = (props: Types.RenderLabelProps<unknown>) => (\n <DefaultLabel {...props} />\n);\n\nexport function Edge<EdgeData>({\n render = renderDefault,\n setEdge,\n id,\n edge,\n curve,\n showArrowHeads,\n}: EdgeComponentProps<EdgeData>) {\n const { x = 0, y = 0, width, height, points } = edge;\n const labelProps: Types.DependencyEdge<EdgeData> = edge;\n const classes = useStyles();\n\n const labelRef = useRef<SVGGElement>(null);\n\n useLayoutEffect(() => {\n // set the label width to the actual rendered width to properly layout graph\n if (labelRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n labelRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setEdge(id, {\n ...edge,\n height: renderedHeight,\n width: renderedWidth,\n });\n }\n }\n }, [edge, height, width, setEdge, id]);\n\n let path: string = '';\n\n const createPath = useMemo(\n () =>\n d3Shape\n .line<EdgePoint>()\n .x(d => d.x)\n .y(d => d.y)\n .curve(d3Shape[curve]),\n [curve],\n );\n\n if (points) {\n const finitePoints = points.filter(\n (point: EdgePoint) => isFinite(point.x) && isFinite(point.y),\n );\n path = createPath(finitePoints) || '';\n }\n\n return (\n <>\n {path && (\n <path\n data-testid={EDGE_TEST_ID}\n className={classes.path}\n markerEnd={showArrowHeads ? `url(#${ARROW_MARKER_ID})` : undefined}\n d={path}\n />\n )}\n {labelProps.label ? (\n <g\n ref={labelRef}\n data-testid={LABEL_TEST_ID}\n className={classes.label}\n transform={`translate(${x},${y})`}\n >\n {render({ edge: labelProps })}\n </g>\n ) : null}\n </>\n );\n}\n","/*\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 const [settled, setSettled] = useState(false);\n const [transitionsReady, setTransitionsReady] = useState(false);\n const settledRef = useRef(false);\n const pendingInitialFlush = useRef(false);\n const measuredLayoutCount = useRef(0);\n\n useEffect(() => {\n if (settled && !transitionsReady) {\n const frame = requestAnimationFrame(() => {\n setTransitionsReady(true);\n });\n return () => cancelAnimationFrame(frame);\n }\n return undefined;\n }, [settled, transitionsReady]);\n\n // Fallback: if getBBox() returns zero dimensions (e.g. in jsdom or hidden\n // containers), setNode is never called and the normal settlement path never\n // triggers. This timeout ensures the graph still becomes visible.\n useEffect(() => {\n if (graphNodes.length > 0 && !settledRef.current) {\n const timeout = setTimeout(() => {\n if (!settledRef.current) {\n settledRef.current = true;\n setSettled(true);\n }\n }, 500);\n return () => clearTimeout(timeout);\n }\n return undefined;\n }, [graphNodes]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const dimensionsRef = useRef({\n containerWidth,\n containerHeight,\n maxWidth,\n maxHeight,\n });\n dimensionsRef.current = {\n containerWidth,\n containerHeight,\n maxWidth,\n maxHeight,\n };\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 const dims = dimensionsRef.current;\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n dims.maxWidth - dims.maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n dims.maxHeight - dims.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 const dims = dimensionsRef.current;\n if (\n dims.containerWidth !== newContainerWidth &&\n newContainerWidth <= dims.maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n dims.containerHeight !== newContainerHeight &&\n newContainerHeight <= dims.maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, 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 if (!settledRef.current) {\n const nodeIds = graph.current.nodes();\n const hasMeasuredNodes =\n nodeIds.length > 0 &&\n nodeIds.some(id => {\n const n = graph.current.node(id);\n return n && n.width > 0 && n.height > 0;\n });\n if (hasMeasuredNodes) {\n measuredLayoutCount.current += 1;\n }\n if (measuredLayoutCount.current >= 2 || nodeIds.length === 0) {\n settledRef.current = true;\n setSettled(true);\n }\n }\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 if (!settledRef.current && !pendingInitialFlush.current) {\n pendingInitialFlush.current = true;\n queueMicrotask(() => {\n pendingInitialFlush.current = false;\n updateGraph.flush();\n });\n }\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\n ref={containerRef}\n style={{\n width: '100%',\n height: '100%',\n visibility: settled ? 'visible' : 'hidden',\n }}\n >\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 {!transitionsReady && (\n <style>{`#${DEPENDENCY_GRAPH_SVG} * { transition: none !important; }`}</style>\n )}\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={`0 0 ${graphWidth} ${graphHeight}`}\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":["useStyles","makeStyles","theme","DefaultNode","id","classes","width","setWidth","useState","height","setHeight","idRef","useRef","useLayoutEffect","renderedHeight","renderedWidth","Math","paddedWidth","padding","paddedHeight","renderDefault","props","Node","render","setNode","node","x","y","nodeRef","NODE_TEST_ID","ARROW_MARKER_ID","DefaultLabel","label","Edge","setEdge","edge","curve","showArrowHeads","points","labelRef","path","createPath","useMemo","d3Shape","d","point","isFinite","EDGE_TEST_ID","undefined","labelProps","LABEL_TEST_ID","WORKSPACE_ID","DEPENDENCY_GRAPH_SVG","DependencyGraph","edges","nodes","renderNode","direction","Types","align","nodeMargin","edgeMargin","rankMargin","paddingX","paddingY","acyclicer","ranker","labelPosition","labelOffset","edgeRanks","edgeWeight","renderEdge","renderLabel","defs","zoom","fit","allowFullscreen","svgProps","useTheme","containerWidth","setContainerWidth","containerHeight","setContainerHeight","fullScreenHandle","useFullScreenHandle","styles","t","useTranslationRef","coreComponentsTranslationRef","graph","dagre","graphWidth","setGraphWidth","graphHeight","setGraphHeight","graphNodes","setGraphNodes","graphEdges","setGraphEdges","settled","setSettled","transitionsReady","setTransitionsReady","settledRef","pendingInitialFlush","measuredLayoutCount","useEffect","frame","requestAnimationFrame","cancelAnimationFrame","timeout","setTimeout","clearTimeout","maxWidth","maxHeight","dimensionsRef","_measureRef","useMeasure","measureRef","once","scalableHeight","containerRef","debounce","root","container","d3Selection","workspace","enableZoom","d3Zoom","Infinity","event","dims","newContainerWidth","newContainerHeight","setNodesAndEdges","useCallback","currentGraphNodes","currentGraphEdges","nodeId","e","existingNode","updateGraph","newHeight","nodeIds","hasMeasuredNodes","n","queueMicrotask","FullScreen","classNames","Tooltip","IconButton","FullscreenExitIcon","FullscreenIcon"],"mappings":"+UAuBA,IAAMA,EAAYC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAChBC,AAAAA,GAAU,EACR,KAAM,CACJ,KAAMA,EAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CACjC,OAAQA,EAAM,OAAO,CAAC,OAAO,CAAC,KAAK,AACrC,EACA,KAAM,CACJ,KAAMA,EAAM,OAAO,CAAC,OAAO,CAAC,YAAY,AAC1C,CACF,GACA,CAAE,KAAM,qCAAsC,GAIzC,SAASC,EAAY,CAAE,KAAM,CAAEC,GAAAA,CAAE,CAAE,CAAyB,EACjE,IAAMC,EAAUL,IACV,CAACM,EAAOC,EAAS,CAAGC,AAAAA,GAAAA,EAAAA,QAAAA,AAAAA,EAAS,GAC7B,CAACC,EAAQC,EAAU,CAAGF,AAAAA,GAAAA,EAAAA,QAAAA,AAAAA,EAAS,GAC/BG,EAAQC,AAAAA,GAAAA,EAAAA,MAAAA,AAAAA,EAA8B,MAE5CC,AAAAA,GAAAA,EAAAA,eAAAA,AAAAA,EAAgB,KAEd,GAAIF,EAAM,OAAO,CAAE,CACjB,GAAI,CAAE,OAAQG,CAAc,CAAE,MAAOC,CAAa,CAAE,CAClDJ,EAAM,OAAO,CAAC,OAAO,GACvBG,EAAiBE,KAAK,KAAK,CAACF,GAC5BC,EAAgBC,KAAK,KAAK,CAACD,GAEvBD,CAAAA,IAAmBL,GAAUM,IAAkBT,CAAI,IACrDC,EAASQ,GACTL,EAAUI,GAEd,CACF,EAAG,CAACR,EAAOG,EAAO,EAGlB,IAAMQ,EAAcX,EAAQY,GACtBC,EAAeV,EAASS,GAE9B,MACE,WAAC,K,UACC,UAAC,QACC,UAAWb,EAAQ,IAAI,CACvB,MAAOY,EACP,OAAQE,EACR,GAAI,E,GAEN,U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C,GACP,OAAQE,GACR,EAAGqB,GAAY,EAAIrB,GAAc,EACjC,EAAGoB,GAAW,EAAItB,GAAa,EAC/B,QAAS,CAAC,IAAI,EAAEA,GAAW,CAAC,EAAEE,GAAY,CAAC,C,UAE1CI,GAAW,GAAG,CAAC0C,AAAAA,IACd,IAAMxG,EAAOsD,GAAM,OAAO,CAAC,IAAI,CAACkD,UAChC,AAAKxG,EACDoC,EAAmBA,EAAW,CAAEpC,KAAAA,EAAM,GAAIwG,CAAE,GAG9C,UAAC1G,EAAIA,CAEH,GAAI0G,EACJ,QAASzG,GACT,OAAQsC,EACR,KAAMrC,EACN,MAAOC,EACP,eAAgBC,C,EANX,CAAC,EAAEsG,EAAE,CAAC,CAAC,CAAC,EAAEA,EAAE,CAAC,CAAC,CAAC,EALN,IAcpB,GACC5C,GAAW,GAAG,CAAC,AAAC3F,IACf,IAAMqB,EAAOgE,GAAM,OAAO,CAAC,IAAI,CAACrF,UAChC,AAAKqB,EAEH,UAACH,EAAIA,CAEH,QAASE,GACT,OAAQgC,EACR,KAAM/B,C,EAHDrB,GAHS,IASpB,G,YAOd,C"}
1
+ {"version":3,"file":"static/7632.3917bed33d55.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DefaultNode.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/Node.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/constants.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DefaultLabel.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/Edge.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/DependencyGraph/DependencyGraphContent.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 { useState, useRef, useLayoutEffect } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { DependencyGraphTypes as Types } from './types';\n\n/** @public */\nexport type DependencyGraphDefaultNodeClassKey = 'node' | 'text';\n\nconst useStyles = makeStyles(\n theme => ({\n node: {\n fill: theme.palette.primary.light,\n stroke: theme.palette.primary.light,\n },\n text: {\n fill: theme.palette.primary.contrastText,\n },\n }),\n { name: 'BackstageDependencyGraphDefaultNode' },\n);\n\n/** @public */\nexport function DefaultNode({ node: { id } }: Types.RenderNodeProps) {\n const classes = useStyles();\n const [width, setWidth] = useState(0);\n const [height, setHeight] = useState(0);\n const idRef = useRef<SVGTextElement | null>(null);\n\n useLayoutEffect(() => {\n // set the width to the length of the ID\n if (idRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n idRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setWidth(renderedWidth);\n setHeight(renderedHeight);\n }\n }\n }, [width, height]);\n\n const padding = 10;\n const paddedWidth = width + padding * 2;\n const paddedHeight = height + padding * 2;\n\n return (\n <g>\n <rect\n className={classes.node}\n width={paddedWidth}\n height={paddedHeight}\n rx={10}\n />\n <text\n ref={idRef}\n className={classes.text}\n y={paddedHeight / 2}\n x={paddedWidth / 2}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n >\n {id}\n </text>\n </g>\n );\n}\n","/*\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 { useRef, useLayoutEffect } from 'react';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DefaultNode } from './DefaultNode';\nimport { DependencyGraphTypes as Types } from './types';\nimport { NODE_TEST_ID } from './constants';\nimport dagre from '@dagrejs/dagre';\n\n/** @public */\nexport type DependencyGraphNodeClassKey = 'node';\n\nconst useStyles = makeStyles(\n theme => ({\n node: {\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n }),\n { name: 'BackstageDependencyGraphNode' },\n);\n\nexport type GraphNode<T> = dagre.Node<Types.DependencyNode<T>>;\n\nexport type NodeComponentProps<T> = {\n node: GraphNode<T>;\n render?: Types.RenderNodeFunction<T>;\n setNode: dagre.graphlib.Graph['setNode'];\n};\n\nconst renderDefault = (props: Types.RenderNodeProps) => (\n <DefaultNode {...props} />\n);\n\nexport function Node<T>({\n render = renderDefault,\n setNode,\n node,\n}: NodeComponentProps<T>) {\n const { width, height, x = 0, y = 0 } = node;\n const nodeProps: Types.DependencyNode<T> = node;\n const classes = useStyles();\n const nodeRef = useRef<SVGGElement | null>(null);\n\n useLayoutEffect(() => {\n // set the node width to the actual rendered width to properly layout graph\n if (nodeRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n nodeRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setNode(node.id, {\n ...node,\n height: renderedHeight,\n width: renderedWidth,\n });\n }\n }\n }, [node, width, height, setNode]);\n\n return (\n <g\n ref={nodeRef}\n data-testid={NODE_TEST_ID}\n className={classes.node}\n transform={`translate(${x - width / 2},${y - height / 2})`}\n >\n {render({ node: nodeProps })}\n </g>\n );\n}\n","/*\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\nexport const ARROW_MARKER_ID = 'arrow-marker';\n\nexport const NODE_TEST_ID = 'node';\nexport const EDGE_TEST_ID = 'edge';\nexport const LABEL_TEST_ID = 'label';\n","/*\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 makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DependencyGraphTypes as Types } from './types';\n\n/** @public */\nexport type DependencyGraphDefaultLabelClassKey = 'text';\n\nconst useStyles = makeStyles(\n theme => ({\n text: {\n fill: theme.palette.textContrast,\n },\n }),\n { name: 'BackstageDependencyGraphDefaultLabel' },\n);\n\n/** @public */\nexport function DefaultLabel({ edge: { label } }: Types.RenderLabelProps) {\n const classes = useStyles();\n return (\n <text className={classes.text} textAnchor=\"middle\">\n {label}\n </text>\n );\n}\n","/*\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 { useRef, useLayoutEffect, useMemo } from 'react';\nimport * as d3Shape from 'd3-shape';\nimport isFinite from 'lodash/isFinite';\nimport makeStyles from '@material-ui/core/styles/makeStyles';\nimport { DependencyGraphTypes as Types } from './types';\nimport { ARROW_MARKER_ID, EDGE_TEST_ID, LABEL_TEST_ID } from './constants';\nimport { DefaultLabel } from './DefaultLabel';\nimport dagre from '@dagrejs/dagre';\n\n/* Based on: https://github.com/dagrejs/dagre/wiki#configuring-the-layout */\nexport type EdgeProperties = {\n label?: string;\n width?: number;\n height?: number;\n labeloffset?: number;\n labelpos?: Types.LabelPosition;\n minlen?: number;\n weight?: number;\n};\nexport type GraphEdge<T> = Types.DependencyEdge<T> &\n dagre.GraphEdge &\n EdgeProperties;\n\n/** @public */\nexport type DependencyGraphEdgeClassKey = 'path' | 'label';\n\nconst useStyles = makeStyles(\n theme => ({\n path: {\n strokeWidth: 1.3,\n stroke: theme.palette.textSubtle,\n fill: 'none',\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n label: {\n transition: `${theme.transitions.duration.shortest}ms`,\n },\n }),\n { name: 'BackstageDependencyGraphEdge' },\n);\n\ntype EdgePoint = dagre.GraphEdge['points'][0];\n\n/** @public */\nexport type EdgeComponentProps<T = unknown> = {\n id: dagre.Edge;\n edge: GraphEdge<T>;\n render?: Types.RenderLabelFunction<T>;\n setEdge: (\n id: dagre.Edge,\n edge: Types.DependencyEdge<T>,\n ) => dagre.graphlib.Graph<{}>;\n curve: 'curveStepBefore' | 'curveMonotoneX';\n showArrowHeads?: boolean;\n};\n\nconst renderDefault = (props: Types.RenderLabelProps<unknown>) => (\n <DefaultLabel {...props} />\n);\n\nexport function Edge<EdgeData>({\n render = renderDefault,\n setEdge,\n id,\n edge,\n curve,\n showArrowHeads,\n}: EdgeComponentProps<EdgeData>) {\n const { x = 0, y = 0, width, height, points } = edge;\n const labelProps: Types.DependencyEdge<EdgeData> = edge;\n const classes = useStyles();\n\n const labelRef = useRef<SVGGElement>(null);\n\n useLayoutEffect(() => {\n // set the label width to the actual rendered width to properly layout graph\n if (labelRef.current) {\n let { height: renderedHeight, width: renderedWidth } =\n labelRef.current.getBBox();\n renderedHeight = Math.round(renderedHeight);\n renderedWidth = Math.round(renderedWidth);\n\n if (renderedHeight !== height || renderedWidth !== width) {\n setEdge(id, {\n ...edge,\n height: renderedHeight,\n width: renderedWidth,\n });\n }\n }\n }, [edge, height, width, setEdge, id]);\n\n let path: string = '';\n\n const createPath = useMemo(\n () =>\n d3Shape\n .line<EdgePoint>()\n .x(d => d.x)\n .y(d => d.y)\n .curve(d3Shape[curve]),\n [curve],\n );\n\n if (points) {\n const finitePoints = points.filter(\n (point: EdgePoint) => isFinite(point.x) && isFinite(point.y),\n );\n path = createPath(finitePoints) || '';\n }\n\n return (\n <>\n {path && (\n <path\n data-testid={EDGE_TEST_ID}\n className={classes.path}\n markerEnd={showArrowHeads ? `url(#${ARROW_MARKER_ID})` : undefined}\n d={path}\n />\n )}\n {labelProps.label ? (\n <g\n ref={labelRef}\n data-testid={LABEL_TEST_ID}\n className={classes.label}\n transform={`translate(${x},${y})`}\n >\n {render({ edge: labelProps })}\n </g>\n ) : null}\n </>\n );\n}\n","/*\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 const [settled, setSettled] = useState(false);\n const [transitionsReady, setTransitionsReady] = useState(false);\n const settledRef = useRef(false);\n const pendingInitialFlush = useRef(false);\n const measuredLayoutCount = useRef(0);\n\n useEffect(() => {\n if (settled && !transitionsReady) {\n const frame = requestAnimationFrame(() => {\n setTransitionsReady(true);\n });\n return () => cancelAnimationFrame(frame);\n }\n return undefined;\n }, [settled, transitionsReady]);\n\n // Fallback: if getBBox() returns zero dimensions (e.g. in jsdom or hidden\n // containers), setNode is never called and the normal settlement path never\n // triggers. This timeout ensures the graph still becomes visible.\n useEffect(() => {\n if (graphNodes.length > 0 && !settledRef.current) {\n const timeout = setTimeout(() => {\n if (!settledRef.current) {\n settledRef.current = true;\n setSettled(true);\n }\n }, 500);\n return () => clearTimeout(timeout);\n }\n return undefined;\n }, [graphNodes]);\n\n const maxWidth = Math.max(graphWidth, containerWidth);\n const maxHeight = Math.max(graphHeight, containerHeight);\n\n const dimensionsRef = useRef({\n containerWidth,\n containerHeight,\n maxWidth,\n maxHeight,\n });\n dimensionsRef.current = {\n containerWidth,\n containerHeight,\n maxWidth,\n maxHeight,\n };\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 const dims = dimensionsRef.current;\n event.transform.x = Math.min(\n 0,\n Math.max(\n event.transform.x,\n dims.maxWidth - dims.maxWidth * event.transform.k,\n ),\n );\n event.transform.y = Math.min(\n 0,\n Math.max(\n event.transform.y,\n dims.maxHeight - dims.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 const dims = dimensionsRef.current;\n if (\n dims.containerWidth !== newContainerWidth &&\n newContainerWidth <= dims.maxWidth\n ) {\n setContainerWidth(newContainerWidth);\n }\n if (\n dims.containerHeight !== newContainerHeight &&\n newContainerHeight <= dims.maxHeight\n ) {\n setContainerHeight(newContainerHeight);\n }\n }, 100),\n [measureRef, 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 if (!settledRef.current) {\n const nodeIds = graph.current.nodes();\n const hasMeasuredNodes =\n nodeIds.length > 0 &&\n nodeIds.some(id => {\n const n = graph.current.node(id);\n return n && n.width > 0 && n.height > 0;\n });\n if (hasMeasuredNodes) {\n measuredLayoutCount.current += 1;\n }\n if (measuredLayoutCount.current >= 2 || nodeIds.length === 0) {\n settledRef.current = true;\n setSettled(true);\n }\n }\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 if (!settledRef.current && !pendingInitialFlush.current) {\n pendingInitialFlush.current = true;\n queueMicrotask(() => {\n pendingInitialFlush.current = false;\n updateGraph.flush();\n });\n }\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\n ref={containerRef}\n style={{\n width: '100%',\n height: '100%',\n visibility: settled ? 'visible' : 'hidden',\n }}\n >\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 {!transitionsReady && (\n <style>{`#${DEPENDENCY_GRAPH_SVG} * { transition: none !important; }`}</style>\n )}\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={`0 0 ${graphWidth} ${graphHeight}`}\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":["useStyles","makeStyles","theme","DefaultNode","id","classes","width","setWidth","useState","height","setHeight","idRef","useRef","useLayoutEffect","renderedHeight","renderedWidth","Math","paddedWidth","padding","paddedHeight","renderDefault","props","Node","render","setNode","node","x","y","nodeRef","NODE_TEST_ID","ARROW_MARKER_ID","DefaultLabel","label","Edge","setEdge","edge","curve","showArrowHeads","points","labelRef","path","createPath","useMemo","d3Shape","d","point","isFinite","EDGE_TEST_ID","undefined","labelProps","LABEL_TEST_ID","WORKSPACE_ID","DEPENDENCY_GRAPH_SVG","DependencyGraph","edges","nodes","renderNode","direction","Types","align","nodeMargin","edgeMargin","rankMargin","paddingX","paddingY","acyclicer","ranker","labelPosition","labelOffset","edgeRanks","edgeWeight","renderEdge","renderLabel","defs","zoom","fit","allowFullscreen","svgProps","useTheme","containerWidth","setContainerWidth","containerHeight","setContainerHeight","fullScreenHandle","useFullScreenHandle","styles","t","useTranslationRef","coreComponentsTranslationRef","graph","dagre","graphWidth","setGraphWidth","graphHeight","setGraphHeight","graphNodes","setGraphNodes","graphEdges","setGraphEdges","settled","setSettled","transitionsReady","setTransitionsReady","settledRef","pendingInitialFlush","measuredLayoutCount","useEffect","frame","requestAnimationFrame","cancelAnimationFrame","timeout","setTimeout","clearTimeout","maxWidth","maxHeight","dimensionsRef","_measureRef","useMeasure","measureRef","once","scalableHeight","containerRef","debounce","root","container","d3Selection","workspace","enableZoom","d3Zoom","Infinity","event","dims","newContainerWidth","newContainerHeight","setNodesAndEdges","useCallback","currentGraphNodes","currentGraphEdges","nodeId","e","existingNode","updateGraph","newHeight","nodeIds","hasMeasuredNodes","n","queueMicrotask","FullScreen","classNames","Tooltip","IconButton","FullscreenExitIcon","FullscreenIcon"],"mappings":"iVAuBA,IAAMA,EAAYC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAChBC,AAAAA,GAAU,EACR,KAAM,CACJ,KAAMA,EAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CACjC,OAAQA,EAAM,OAAO,CAAC,OAAO,CAAC,KAAK,AACrC,EACA,KAAM,CACJ,KAAMA,EAAM,OAAO,CAAC,OAAO,CAAC,YAAY,AAC1C,CACF,GACA,CAAE,KAAM,qCAAsC,GAIzC,SAASC,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