@backstage/plugin-techdocs 1.4.0-next.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # @backstage/plugin-techdocs
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5691baea69: Add ability to configure filters when using EntityListDocsGrid
8
+
9
+ The following example will render two sections of cards grid:
10
+
11
+ - One section for documentations tagged as `recommended`
12
+ - One section for documentations tagged as `runbook`
13
+
14
+ ```js
15
+ <EntityListDocsGrid groups={{[
16
+ {
17
+ title: "Recommended Documentation",
18
+ filterPredicate: entity =>
19
+ entity?.metadata?.tags?.includes('recommended') ?? false,
20
+ },
21
+ {
22
+ title: "RunBooks Documentation",
23
+ filterPredicate: entity =>
24
+ entity?.metadata?.tags?.includes('runbook') ?? false,
25
+ }
26
+ ]}} />
27
+ ```
28
+
29
+ - 63705e73d9: Hide document description if not provided
30
+ - 847fc588a6: Updated TechDocs header to include label for source code icon and updated label to reflect Kind name
31
+
32
+ ### Patch Changes
33
+
34
+ - 9e4d8e6198: Fix logic bug that broke techdocs-cli-embedded-app
35
+ - e92aa15f01: Bumped `canvas` dependency to the latest version, which has better Node.js v18 support.
36
+ - cbe11d1e23: Tweak README
37
+ - 7573b65232: Internal refactor of imports to avoid circular dependencies
38
+ - c1784a4980: Replaces in-code uses of `GitHub` with `Github` and deprecates old versions.
39
+ - 3a1a999b7b: Include query parameters when navigating to relative links in documents
40
+ - bd2aab4726: An analytics event matching the semantics of the `click` action is now captured when users click links within a TechDocs document.
41
+ - Updated dependencies
42
+ - @backstage/plugin-catalog-react@1.2.1
43
+ - @backstage/core-components@0.12.0
44
+ - @backstage/core-plugin-api@1.1.0
45
+ - @backstage/integration@1.4.0
46
+ - @backstage/catalog-model@1.1.3
47
+ - @backstage/plugin-techdocs-react@1.0.6
48
+ - @backstage/integration-react@1.1.6
49
+ - @backstage/plugin-search-react@1.2.1
50
+ - @backstage/config@1.0.4
51
+ - @backstage/errors@1.1.3
52
+ - @backstage/theme@0.2.16
53
+ - @backstage/plugin-search-common@1.1.1
54
+
3
55
  ## 1.4.0-next.2
4
56
 
5
57
  ### Patch Changes
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import useAsync from 'react-use/lib/useAsync';
3
3
  import { makeStyles } from '@material-ui/core';
4
4
  import { catalogApiRef, CATALOG_FILTER_EXISTS, useEntityOwnership } from '@backstage/plugin-catalog-react';
5
- import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-c0c013ea.esm.js';
5
+ import { T as TechDocsPageWrapper, D as DocsTable, a as DocsCardGrid } from './index-847211c1.esm.js';
6
6
  import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader, SupportButton } from '@backstage/core-components';
7
7
  import { useApi } from '@backstage/core-plugin-api';
8
8
  import '@backstage/errors';
@@ -24,9 +24,9 @@ import '@material-ui/icons/Menu';
24
24
  import 'react-helmet';
25
25
  import '@material-ui/icons/Code';
26
26
  import '@backstage/catalog-model';
27
+ import 'lodash';
27
28
  import '@material-ui/icons/Settings';
28
29
  import 'react-use/lib/useCopyToClipboard';
29
- import 'lodash';
30
30
  import '@material-ui/icons/Share';
31
31
  import '@material-ui/styles';
32
32
  import '@material-ui/icons/Star';
@@ -127,4 +127,4 @@ const TechDocsCustomHome = (props) => {
127
127
  };
128
128
 
129
129
  export { TechDocsCustomHome };
130
- //# sourceMappingURL=TechDocsCustomHome-b18e6234.esm.js.map
130
+ //# sourceMappingURL=TechDocsCustomHome-02667b22.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TechDocsCustomHome-b18e6234.esm.js","sources":["../../src/home/components/TechDocsCustomHome.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\nimport { CSSProperties } from '@material-ui/styles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\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}\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\nconst CustomPanel = ({\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 return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref': 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?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\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 <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAuCA,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,kBAAmB,EAAA,CAAA;AAExE,EAAM,MAAA,KAAA,GAAQ,OAAO,MAAO,CAAA,SAAA,CAAA,CAAA;AAE5B,EAAM,MAAA,aAAA,GAAgB,QAAS,CAAA,MAAA,CAAO,CAAU,MAAA,KAAA;AAC9C,IAAI,IAAA,MAAA,CAAO,oBAAoB,aAAe,EAAA;AAC5C,MAAA,IAAI,gBAAkB,EAAA;AACpB,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AACA,MAAA,OAAO,cAAc,MAAM,CAAA,CAAA;AAAA,KAC7B;AAEA,IAAA,OACE,OAAO,MAAO,CAAA,eAAA,KAAoB,UAClC,IAAA,MAAA,CAAO,gBAAgB,MAAM,CAAA,CAAA;AAAA,GAEhC,CAAA,CAAA;AAED,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,aAAA,EAA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ClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,0BACnC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACC,GAAK,EAAA,KAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,IACnC,KAAA;AAAA,GACF,CACD,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TechDocsCustomHome-02667b22.esm.js","sources":["../../src/home/components/TechDocsCustomHome.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\nimport { CSSProperties } from '@material-ui/styles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\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}\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\nconst CustomPanel = ({\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 return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref': 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?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\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 <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAuCA,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,kBAAmB,EAAA,CAAA;AAExE,EAAM,MAAA,KAAA,GAAQ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F,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,2CACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,IACC,aAAe,EAAA,WAAA;AAAA,IACf,QAAA,EAAU,CAAS,KAAA,KAAA,cAAA,CAAe,KAAK,CAAA;AAAA,IACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAW,MAAA;AAAA,MAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,MACnB,KAAA;AAAA,KACA,CAAA,CAAA;AAAA,GACJ,mBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,IAAQ,aAAY,EAAA,kBAAA;AAAA,GAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,0BACnC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA;AAAA,IACC,GAAK,EAAA,KAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,IACnC,KAAA;AAAA,GACF,CACD,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-c0c013ea.esm.js';
1
+ export { c as TechDocsReaderLayout, b as TechDocsReaderPage } from './index-847211c1.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'event-source-polyfill';
@@ -24,11 +24,11 @@ import 'react-helmet';
24
24
  import '@material-ui/icons/Code';
25
25
  import '@backstage/plugin-catalog-react';
26
26
  import '@backstage/catalog-model';
27
+ import 'lodash';
27
28
  import '@material-ui/icons/Settings';
28
29
  import 'react-use/lib/useCopyToClipboard';
29
- import 'lodash';
30
30
  import '@material-ui/icons/Share';
31
31
  import '@material-ui/styles';
32
32
  import '@material-ui/icons/Star';
33
33
  import '@material-ui/icons/StarBorder';
34
- //# sourceMappingURL=index-73ab5148.esm.js.map
34
+ //# sourceMappingURL=index-5ce38e4c.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-5ce38e4c.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -23,9 +23,9 @@ import Helmet from 'react-helmet';
23
23
  import CodeIcon from '@material-ui/icons/Code';
24
24
  import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList, useEntityOwnership, humanizeEntityRef, useStarredEntities, CATALOG_FILTER_EXISTS, EntityListProvider, CatalogFilterLayout, UserListPicker, EntityOwnerPicker, EntityTagPicker, useEntity } from '@backstage/plugin-catalog-react';
25
25
  import { RELATION_OWNED_BY, getCompoundEntityRef } from '@backstage/catalog-model';
26
+ import { capitalize } from 'lodash';
26
27
  import SettingsIcon from '@material-ui/icons/Settings';
27
28
  import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
28
- import { capitalize } from 'lodash';
29
29
  import ShareIcon from '@material-ui/icons/Share';
30
30
  import { withStyles as withStyles$1 } from '@material-ui/styles';
31
31
  import Star from '@material-ui/icons/Star';
@@ -1574,6 +1574,7 @@ const useTechDocsReaderDom = (entityRef) => {
1574
1574
  const isMobileMedia = useMediaQuery(MOBILE_MEDIA_QUERY);
1575
1575
  const sanitizerTransformer = useSanitizerTransformer();
1576
1576
  const stylesTransformer = useStylesTransformer();
1577
+ const analytics = useAnalytics();
1577
1578
  const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
1578
1579
  const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
1579
1580
  const { state, path, content: rawPage } = useTechDocsReader();
@@ -1660,16 +1661,19 @@ const useTechDocsReaderDom = (entityRef) => {
1660
1661
  addLinkClickListener({
1661
1662
  baseUrl: window.location.origin,
1662
1663
  onClick: (event, url) => {
1663
- var _a;
1664
+ var _a, _b;
1664
1665
  const modifierActive = event.ctrlKey || event.metaKey;
1665
1666
  const parsedUrl = new URL(url);
1666
1667
  const fullPath = `${parsedUrl.pathname}${parsedUrl.search}${parsedUrl.hash}`;
1668
+ const linkText = ((_a = event.target) == null ? void 0 : _a.innerText) || url;
1669
+ const to = url.replace(window.location.origin, "");
1670
+ analytics.captureEvent("click", linkText, { attributes: { to } });
1667
1671
  if (parsedUrl.hash) {
1668
1672
  if (modifierActive) {
1669
1673
  window.open(fullPath, "_blank");
1670
1674
  } else {
1671
1675
  navigate(fullPath);
1672
- (_a = transformedElement == null ? void 0 : transformedElement.querySelector(`[id="${parsedUrl.hash.slice(1)}"]`)) == null ? void 0 : _a.scrollIntoView();
1676
+ (_b = transformedElement == null ? void 0 : transformedElement.querySelector(`[id="${parsedUrl.hash.slice(1)}"]`)) == null ? void 0 : _b.scrollIntoView();
1673
1677
  }
1674
1678
  } else {
1675
1679
  if (modifierActive) {
@@ -1701,7 +1705,7 @@ const useTechDocsReaderDom = (entityRef) => {
1701
1705
  }
1702
1706
  })
1703
1707
  ]),
1704
- [theme, navigate]
1708
+ [theme, navigate, analytics]
1705
1709
  );
1706
1710
  useEffect(() => {
1707
1711
  if (!rawPage)
@@ -1872,7 +1876,7 @@ const TechDocsReaderPageHeader = (props) => {
1872
1876
  setSubtitle(() => {
1873
1877
  let { site_description } = metadata;
1874
1878
  if (!site_description || site_description === "None") {
1875
- site_description = "Home";
1879
+ site_description = "";
1876
1880
  }
1877
1881
  return site_description;
1878
1882
  });
@@ -1884,7 +1888,7 @@ const TechDocsReaderPageHeader = (props) => {
1884
1888
  const ownedByRelations = entityMetadata ? getEntityRelations(entityMetadata, RELATION_OWNED_BY) : [];
1885
1889
  const docsRootLink = useRouteRef(rootRouteRef)();
1886
1890
  const labels = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HeaderLabel, {
1887
- label: "Component",
1891
+ label: capitalize((entityMetadata == null ? void 0 : entityMetadata.kind) || "entity"),
1888
1892
  value: /* @__PURE__ */ React.createElement(EntityRefLink, {
1889
1893
  color: "inherit",
1890
1894
  entityRef,
@@ -1903,13 +1907,21 @@ const TechDocsReaderPageHeader = (props) => {
1903
1907
  value: lifecycle
1904
1908
  }) : null, locationMetadata && locationMetadata.type !== "dir" && locationMetadata.type !== "file" ? /* @__PURE__ */ React.createElement(HeaderLabel, {
1905
1909
  label: "",
1906
- value: /* @__PURE__ */ React.createElement("a", {
1907
- href: locationMetadata.target,
1908
- target: "_blank",
1909
- rel: "noopener noreferrer"
1910
+ value: /* @__PURE__ */ React.createElement(Grid, {
1911
+ container: true,
1912
+ direction: "column",
1913
+ alignItems: "center",
1914
+ style: { color: "#fff" }
1915
+ }, /* @__PURE__ */ React.createElement(Grid, {
1916
+ style: { padding: 0 },
1917
+ item: true
1910
1918
  }, /* @__PURE__ */ React.createElement(CodeIcon, {
1911
- style: { marginTop: "-25px", fill: "#fff" }
1912
- }))
1919
+ style: { marginTop: "-25px" }
1920
+ })), /* @__PURE__ */ React.createElement(Grid, {
1921
+ style: { padding: 0 },
1922
+ item: true
1923
+ }, "Source")),
1924
+ url: locationMetadata.target
1913
1925
  }) : null);
1914
1926
  const noEntMetadata = !entityMetadataLoading && entityMetadata === void 0;
1915
1927
  const noTdMetadata = !metadataLoading && metadata === void 0;
@@ -1919,7 +1931,7 @@ const TechDocsReaderPageHeader = (props) => {
1919
1931
  type: "Documentation",
1920
1932
  typeLink: docsRootLink,
1921
1933
  title: title || skeleton,
1922
- subtitle: subtitle || skeleton
1934
+ subtitle: subtitle === "" ? void 0 : subtitle || skeleton
1923
1935
  }, /* @__PURE__ */ React.createElement(Helmet, {
1924
1936
  titleTemplate: "%s"
1925
1937
  }, /* @__PURE__ */ React.createElement("title", null, tabTitle)), labels, children, addons.renderComponentsByLocation(TechDocsAddonLocations.Header));
@@ -2380,7 +2392,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(
2380
2392
  const TechDocsCustomHome = techdocsPlugin.provide(
2381
2393
  createRoutableExtension({
2382
2394
  name: "TechDocsCustomHome",
2383
- component: () => import('./TechDocsCustomHome-b18e6234.esm.js').then(
2395
+ component: () => import('./TechDocsCustomHome-02667b22.esm.js').then(
2384
2396
  (m) => m.TechDocsCustomHome
2385
2397
  ),
2386
2398
  mountPoint: rootRouteRef
@@ -2398,7 +2410,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(
2398
2410
  const TechDocsReaderPage = techdocsPlugin.provide(
2399
2411
  createRoutableExtension({
2400
2412
  name: "TechDocsReaderPage",
2401
- component: () => import('./index-73ab5148.esm.js').then(
2413
+ component: () => import('./index-5ce38e4c.esm.js').then(
2402
2414
  (m) => m.TechDocsReaderPage
2403
2415
  ),
2404
2416
  mountPoint: rootDocsRouteRef
@@ -2475,4 +2487,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2475
2487
  });
2476
2488
 
2477
2489
  export { DocsTable as D, EntityTechdocsContent as E, Reader as R, TechDocsPageWrapper as T, DocsCardGrid as a, TechDocsReaderPage$1 as b, TechDocsReaderLayout as c, TechDocsCustomHome as d, TechDocsIndexPage$2 as e, TechdocsPage as f, TechDocsReaderPage as g, techdocsStorageApiRef as h, techdocsApiRef as i, TechDocsClient as j, TechDocsStorageClient as k, TechDocsReaderProvider as l, TechDocsReaderPageHeader as m, TechDocsReaderPageContent as n, TechDocsReaderPageSubheader as o, TechDocsSearchResultListItem as p, TechDocsSearch as q, EntityListDocsGrid as r, EntityListDocsTable as s, techdocsPlugin as t, DefaultTechDocsHome as u, TechDocsPicker as v, isTechDocsAvailable as w, Router as x, EmbeddedDocsRouter as y };
2478
- //# sourceMappingURL=index-c0c013ea.esm.js.map
2490
+ //# sourceMappingURL=index-847211c1.esm.js.map