@backstage/plugin-techdocs 1.2.1-next.3 → 1.3.1-next.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.
@@ -92,7 +92,9 @@ class TechDocsStorageClient {
92
92
  const { kind, namespace, name } = entityId;
93
93
  const storageUrl = await this.getStorageUrl();
94
94
  const url = `${storageUrl}/${namespace}/${kind}/${name}/${path}`;
95
- const request = await this.fetchApi.fetch(`${url.endsWith("/") ? url : `${url}/`}index.html`);
95
+ const request = await this.fetchApi.fetch(
96
+ `${url.endsWith("/") ? url : `${url}/`}index.html`
97
+ );
96
98
  let errorMessage = "";
97
99
  switch (request.status) {
98
100
  case 404:
@@ -147,7 +149,10 @@ class TechDocsStorageClient {
147
149
  const { kind, namespace, name } = entityId;
148
150
  const apiOrigin = await this.getApiOrigin();
149
151
  const newBaseUrl = `${apiOrigin}/static/docs/${namespace}/${kind}/${name}/${path}`;
150
- return new URL(oldBaseUrl, newBaseUrl.endsWith("/") ? newBaseUrl : `${newBaseUrl}/`).toString();
152
+ return new URL(
153
+ oldBaseUrl,
154
+ newBaseUrl.endsWith("/") ? newBaseUrl : `${newBaseUrl}/`
155
+ ).toString();
151
156
  }
152
157
  }
153
158
 
@@ -228,7 +233,10 @@ function useReaderState(kind, namespace, name, path) {
228
233
  const { retry: contentReload } = useAsyncRetry(async () => {
229
234
  dispatch({ type: "contentLoading" });
230
235
  try {
231
- const entityDocs = await techdocsStorageApi.getEntityDocs({ kind, namespace, name }, path);
236
+ const entityDocs = await techdocsStorageApi.getEntityDocs(
237
+ { kind, namespace, name },
238
+ path
239
+ );
232
240
  dispatch({ type: "content", content: entityDocs, path });
233
241
  return entityDocs;
234
242
  } catch (e) {
@@ -248,13 +256,16 @@ function useReaderState(kind, namespace, name, path) {
248
256
  dispatch({ type: "sync", state: "BUILDING" });
249
257
  }, 1e3);
250
258
  try {
251
- const result = await techdocsStorageApi.syncEntityDocs({
252
- kind,
253
- namespace,
254
- name
255
- }, (log) => {
256
- dispatch({ type: "buildLog", log });
257
- });
259
+ const result = await techdocsStorageApi.syncEntityDocs(
260
+ {
261
+ kind,
262
+ namespace,
263
+ name
264
+ },
265
+ (log) => {
266
+ dispatch({ type: "buildLog", log });
267
+ }
268
+ );
258
269
  switch (result) {
259
270
  case "updated":
260
271
  if (!contentRef.current.content) {
@@ -281,11 +292,14 @@ function useReaderState(kind, namespace, name, path) {
281
292
  clearTimeout(buildingTimeout);
282
293
  }
283
294
  }, [kind, name, namespace, techdocsStorageApi, dispatch, contentRef]);
284
- const displayState = useMemo(() => calculateDisplayState({
285
- activeSyncState: state.activeSyncState,
286
- contentLoading: state.contentLoading,
287
- content: state.content
288
- }), [state.activeSyncState, state.content, state.contentLoading]);
295
+ const displayState = useMemo(
296
+ () => calculateDisplayState({
297
+ activeSyncState: state.activeSyncState,
298
+ contentLoading: state.contentLoading,
299
+ content: state.content
300
+ }),
301
+ [state.activeSyncState, state.content, state.contentLoading]
302
+ );
289
303
  return {
290
304
  state: displayState,
291
305
  contentReload,
@@ -510,25 +524,27 @@ const TechDocsSearch = (props) => {
510
524
  }));
511
525
  };
512
526
 
513
- const useDrawerStyles = makeStyles((theme) => createStyles({
514
- paper: {
515
- width: "100%",
516
- [theme.breakpoints.up("sm")]: {
517
- width: "75%"
527
+ const useDrawerStyles = makeStyles(
528
+ (theme) => createStyles({
529
+ paper: {
530
+ width: "100%",
531
+ [theme.breakpoints.up("sm")]: {
532
+ width: "75%"
533
+ },
534
+ [theme.breakpoints.up("md")]: {
535
+ width: "50%"
536
+ },
537
+ padding: theme.spacing(2.5)
518
538
  },
519
- [theme.breakpoints.up("md")]: {
520
- width: "50%"
539
+ root: {
540
+ height: "100%",
541
+ overflow: "hidden"
521
542
  },
522
- padding: theme.spacing(2.5)
523
- },
524
- root: {
525
- height: "100%",
526
- overflow: "hidden"
527
- },
528
- logs: {
529
- background: theme.palette.background.default
530
- }
531
- }));
543
+ logs: {
544
+ background: theme.palette.background.default
545
+ }
546
+ })
547
+ );
532
548
  const TechDocsBuildLogsDrawerContent = ({
533
549
  buildLog,
534
550
  onClose
@@ -714,21 +730,24 @@ const useSanitizerConfig = () => {
714
730
  };
715
731
  const useSanitizerTransformer = () => {
716
732
  const config = useSanitizerConfig();
717
- return useCallback(async (dom) => {
718
- const hosts = config == null ? void 0 : config.getOptionalStringArray("allowedIframeHosts");
719
- DOMPurify.addHook("beforeSanitizeElements", removeUnsafeLinks);
720
- const tags = ["link"];
721
- if (hosts) {
722
- tags.push("iframe");
723
- DOMPurify.addHook("beforeSanitizeElements", removeUnsafeIframes(hosts));
724
- }
725
- return DOMPurify.sanitize(dom.innerHTML, {
726
- ADD_TAGS: tags,
727
- FORBID_TAGS: ["style"],
728
- WHOLE_DOCUMENT: true,
729
- RETURN_DOM: true
730
- });
731
- }, [config]);
733
+ return useCallback(
734
+ async (dom) => {
735
+ const hosts = config == null ? void 0 : config.getOptionalStringArray("allowedIframeHosts");
736
+ DOMPurify.addHook("beforeSanitizeElements", removeUnsafeLinks);
737
+ const tags = ["link"];
738
+ if (hosts) {
739
+ tags.push("iframe");
740
+ DOMPurify.addHook("beforeSanitizeElements", removeUnsafeIframes(hosts));
741
+ }
742
+ return DOMPurify.sanitize(dom.innerHTML, {
743
+ ADD_TAGS: tags,
744
+ FORBID_TAGS: ["style"],
745
+ WHOLE_DOCUMENT: true,
746
+ RETURN_DOM: true
747
+ });
748
+ },
749
+ [config]
750
+ );
732
751
  };
733
752
 
734
753
  var variables = ({ theme }) => `
@@ -743,20 +762,32 @@ var variables = ({ theme }) => `
743
762
  --md-default-fg-color: ${theme.palette.text.primary};
744
763
  --md-default-fg-color--light: ${theme.palette.text.secondary};
745
764
  --md-default-fg-color--lighter: ${lighten(theme.palette.text.secondary, 0.7)};
746
- --md-default-fg-color--lightest: ${lighten(theme.palette.text.secondary, 0.3)};
765
+ --md-default-fg-color--lightest: ${lighten(
766
+ theme.palette.text.secondary,
767
+ 0.3
768
+ )};
747
769
 
748
770
  /* BACKGROUND */
749
771
  --md-default-bg-color:${theme.palette.background.default};
750
772
  --md-default-bg-color--light: ${theme.palette.background.paper};
751
- --md-default-bg-color--lighter: ${lighten(theme.palette.background.paper, 0.7)};
752
- --md-default-bg-color--lightest: ${lighten(theme.palette.background.paper, 0.3)};
773
+ --md-default-bg-color--lighter: ${lighten(
774
+ theme.palette.background.paper,
775
+ 0.7
776
+ )};
777
+ --md-default-bg-color--lightest: ${lighten(
778
+ theme.palette.background.paper,
779
+ 0.3
780
+ )};
753
781
 
754
782
  /* PRIMARY */
755
783
  --md-primary-fg-color: ${theme.palette.primary.main};
756
784
  --md-primary-fg-color--light: ${theme.palette.primary.light};
757
785
  --md-primary-fg-color--dark: ${theme.palette.primary.dark};
758
786
  --md-primary-bg-color: ${theme.palette.primary.contrastText};
759
- --md-primary-bg-color--light: ${lighten(theme.palette.primary.contrastText, 0.7)};
787
+ --md-primary-bg-color--light: ${lighten(
788
+ theme.palette.primary.contrastText,
789
+ 0.7
790
+ )};
760
791
 
761
792
  /* ACCENT */
762
793
  --md-accent-fg-color: var(--md-primary-fg-color);
@@ -853,6 +884,7 @@ body {
853
884
  }
854
885
  `;
855
886
 
887
+ const SIDEBAR_WIDTH = "224px";
856
888
  var layout = ({ theme, sidebar }) => `
857
889
  /*================== Layout ==================*/
858
890
 
@@ -884,6 +916,11 @@ var layout = ({ theme, sidebar }) => `
884
916
  height: 20px !important;
885
917
  }
886
918
 
919
+ .md-nav__item--active > .md-nav__link, a.md-nav__link--active {
920
+ text-decoration: underline;
921
+ color: var(--md-typeset-a-color);
922
+ }
923
+
887
924
  .md-main__inner {
888
925
  margin-top: 0;
889
926
  }
@@ -898,7 +935,7 @@ var layout = ({ theme, sidebar }) => `
898
935
  scrollbar-width: thin;
899
936
  }
900
937
  .md-sidebar .md-sidebar__scrollwrap {
901
- width: calc(16rem - 10px);
938
+ width: calc(12.1rem);
902
939
  }
903
940
  .md-sidebar--secondary {
904
941
  right: ${theme.spacing(3)}px;
@@ -1005,7 +1042,7 @@ var layout = ({ theme, sidebar }) => `
1005
1042
  .md-sidebar--primary {
1006
1043
  width: 12.1rem !important;
1007
1044
  z-index: 200;
1008
- left: ${sidebar.isPinned ? "calc(-12.1rem + 242px)" : "calc(-12.1rem + 72px)"} !important;
1045
+ left: ${sidebar.isPinned ? `calc(-12.1rem + ${SIDEBAR_WIDTH})` : "calc(-12.1rem + 72px)"} !important;
1009
1046
  }
1010
1047
  .md-sidebar--secondary:not([hidden]) {
1011
1048
  display: none;
@@ -1230,10 +1267,13 @@ const useRuleStyles = () => {
1230
1267
  };
1231
1268
  const useStylesTransformer = () => {
1232
1269
  const styles = useRuleStyles();
1233
- return useCallback((dom) => {
1234
- dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1235
- return dom;
1236
- }, [styles]);
1270
+ return useCallback(
1271
+ (dom) => {
1272
+ dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1273
+ return dom;
1274
+ },
1275
+ [styles]
1276
+ );
1237
1277
  };
1238
1278
 
1239
1279
  const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
@@ -1255,12 +1295,21 @@ const addBaseUrl = ({
1255
1295
  const elemAttribute = elem.getAttribute(attributeName);
1256
1296
  if (!elemAttribute)
1257
1297
  return;
1258
- const newValue = await techdocsStorageApi.getBaseUrl(elemAttribute, entityId, path);
1298
+ const newValue = await techdocsStorageApi.getBaseUrl(
1299
+ elemAttribute,
1300
+ entityId,
1301
+ path
1302
+ );
1259
1303
  if (isSvgNeedingInlining(attributeName, elemAttribute, apiOrigin)) {
1260
1304
  try {
1261
1305
  const svg = await fetch(newValue, { credentials: "include" });
1262
1306
  const svgContent = await svg.text();
1263
- elem.setAttribute(attributeName, `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(svgContent)))}`);
1307
+ elem.setAttribute(
1308
+ attributeName,
1309
+ `data:image/svg+xml;base64,${btoa(
1310
+ unescape(encodeURIComponent(svgContent))
1311
+ )}`
1312
+ );
1264
1313
  } catch (e) {
1265
1314
  elem.setAttribute("alt", `Error: ${elemAttribute}`);
1266
1315
  }
@@ -1284,7 +1333,9 @@ const addBaseUrl = ({
1284
1333
  const addGitFeedbackLink = (scmIntegrationsApi) => {
1285
1334
  return (dom) => {
1286
1335
  var _a;
1287
- const sourceAnchor = dom.querySelector('[title="Edit this page"]');
1336
+ const sourceAnchor = dom.querySelector(
1337
+ '[title="Edit this page"]'
1338
+ );
1288
1339
  if (!sourceAnchor || !sourceAnchor.href) {
1289
1340
  return dom;
1290
1341
  }
@@ -1295,10 +1346,12 @@ const addGitFeedbackLink = (scmIntegrationsApi) => {
1295
1346
  }
1296
1347
  const title = ((_a = dom.querySelector("article>h1")) == null ? void 0 : _a.childNodes[0].textContent) || "";
1297
1348
  const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
1298
- const issueDesc = encodeURIComponent(`Page source:
1349
+ const issueDesc = encodeURIComponent(
1350
+ `Page source:
1299
1351
  ${sourceAnchor.href}
1300
1352
 
1301
- Feedback:`);
1353
+ Feedback:`
1354
+ );
1302
1355
  const gitUrl = (integration == null ? void 0 : integration.type) === "github" ? replaceGitHubUrlType(sourceURL.href, "blob") : sourceURL.href;
1303
1356
  const gitInfo = parseGitUrl(gitUrl);
1304
1357
  const repoPath = `/${gitInfo.organization}/${gitInfo.name}`;
@@ -1324,7 +1377,9 @@ Feedback:`);
1324
1377
 
1325
1378
  const addSidebarToggle = () => {
1326
1379
  return (dom) => {
1327
- const mkdocsToggleSidebar = dom.querySelector('.md-header label[for="__drawer"]');
1380
+ const mkdocsToggleSidebar = dom.querySelector(
1381
+ '.md-header label[for="__drawer"]'
1382
+ );
1328
1383
  const article = dom.querySelector("article");
1329
1384
  if (!mkdocsToggleSidebar || !article) {
1330
1385
  return dom;
@@ -1351,8 +1406,13 @@ const rewriteDocLinks = () => {
1351
1406
  elem.setAttribute("target", "_blank");
1352
1407
  }
1353
1408
  try {
1354
- const normalizedWindowLocation = normalizeUrl(window.location.href);
1355
- elem.setAttribute(attributeName, new URL(elemAttribute, normalizedWindowLocation).toString());
1409
+ const normalizedWindowLocation = normalizeUrl(
1410
+ window.location.href
1411
+ );
1412
+ elem.setAttribute(
1413
+ attributeName,
1414
+ new URL(elemAttribute, normalizedWindowLocation).toString()
1415
+ );
1356
1416
  } catch (_e) {
1357
1417
  elem.replaceWith(elem.textContent || elemAttribute);
1358
1418
  }
@@ -1433,11 +1493,14 @@ const copyToClipboard = (theme) => {
1433
1493
  const text = code.textContent || "";
1434
1494
  const container = document.createElement("div");
1435
1495
  (_a = code == null ? void 0 : code.parentElement) == null ? void 0 : _a.prepend(container);
1436
- ReactDOM.render(/* @__PURE__ */ React.createElement(ThemeProvider, {
1437
- theme
1438
- }, /* @__PURE__ */ React.createElement(CopyToClipboardButton, {
1439
- text
1440
- })), container);
1496
+ ReactDOM.render(
1497
+ /* @__PURE__ */ React.createElement(ThemeProvider, {
1498
+ theme
1499
+ }, /* @__PURE__ */ React.createElement(CopyToClipboardButton, {
1500
+ text
1501
+ })),
1502
+ container
1503
+ );
1441
1504
  }
1442
1505
  return dom;
1443
1506
  };
@@ -1466,10 +1529,16 @@ const onCssReady = ({
1466
1529
  }) => {
1467
1530
  return (dom) => {
1468
1531
  onLoading();
1469
- dom.addEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, function handleShadowDomStyleLoad() {
1470
- onLoaded();
1471
- dom.removeEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, handleShadowDomStyleLoad);
1472
- });
1532
+ dom.addEventListener(
1533
+ SHADOW_DOM_STYLE_LOAD_EVENT,
1534
+ function handleShadowDomStyleLoad() {
1535
+ onLoaded();
1536
+ dom.removeEventListener(
1537
+ SHADOW_DOM_STYLE_LOAD_EVENT,
1538
+ handleShadowDomStyleLoad
1539
+ );
1540
+ }
1541
+ );
1473
1542
  return dom;
1474
1543
  };
1475
1544
  };
@@ -1564,70 +1633,78 @@ const useTechDocsReaderDom = (entityRef) => {
1564
1633
  updateSidebarPosition();
1565
1634
  }
1566
1635
  }, [state, isStyleLoading, updateFooterWidth, updateSidebarPosition]);
1567
- const preRender = useCallback((rawContent, contentPath) => transform(rawContent, [
1568
- sanitizerTransformer,
1569
- addBaseUrl({
1636
+ const preRender = useCallback(
1637
+ (rawContent, contentPath) => transform(rawContent, [
1638
+ sanitizerTransformer,
1639
+ addBaseUrl({
1640
+ techdocsStorageApi,
1641
+ entityId: entityRef,
1642
+ path: contentPath
1643
+ }),
1644
+ rewriteDocLinks(),
1645
+ addSidebarToggle(),
1646
+ removeMkdocsHeader(),
1647
+ simplifyMkdocsFooter(),
1648
+ addGitFeedbackLink(scmIntegrationsApi),
1649
+ stylesTransformer
1650
+ ]),
1651
+ [
1652
+ entityRef,
1653
+ scmIntegrationsApi,
1570
1654
  techdocsStorageApi,
1571
- entityId: entityRef,
1572
- path: contentPath
1573
- }),
1574
- rewriteDocLinks(),
1575
- addSidebarToggle(),
1576
- removeMkdocsHeader(),
1577
- simplifyMkdocsFooter(),
1578
- addGitFeedbackLink(scmIntegrationsApi),
1579
- stylesTransformer
1580
- ]), [
1581
- entityRef,
1582
- scmIntegrationsApi,
1583
- techdocsStorageApi,
1584
- sanitizerTransformer,
1585
- stylesTransformer
1586
- ]);
1587
- const postRender = useCallback(async (transformedElement) => transform(transformedElement, [
1588
- scrollIntoAnchor(),
1589
- copyToClipboard(theme),
1590
- addLinkClickListener({
1591
- baseUrl: window.location.origin,
1592
- onClick: (event, url) => {
1593
- var _a;
1594
- const modifierActive = event.ctrlKey || event.metaKey;
1595
- const parsedUrl = new URL(url);
1596
- if (parsedUrl.hash) {
1597
- if (modifierActive) {
1598
- window.open(`${parsedUrl.pathname}${parsedUrl.hash}`, "_blank");
1599
- } else {
1600
- navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
1601
- (_a = transformedElement == null ? void 0 : transformedElement.querySelector(`#${parsedUrl.hash.slice(1)}`)) == null ? void 0 : _a.scrollIntoView();
1602
- }
1603
- } else {
1604
- if (modifierActive) {
1605
- window.open(parsedUrl.pathname, "_blank");
1655
+ sanitizerTransformer,
1656
+ stylesTransformer
1657
+ ]
1658
+ );
1659
+ const postRender = useCallback(
1660
+ async (transformedElement) => transform(transformedElement, [
1661
+ scrollIntoAnchor(),
1662
+ copyToClipboard(theme),
1663
+ addLinkClickListener({
1664
+ baseUrl: window.location.origin,
1665
+ onClick: (event, url) => {
1666
+ var _a;
1667
+ const modifierActive = event.ctrlKey || event.metaKey;
1668
+ const parsedUrl = new URL(url);
1669
+ if (parsedUrl.hash) {
1670
+ if (modifierActive) {
1671
+ window.open(`${parsedUrl.pathname}${parsedUrl.hash}`, "_blank");
1672
+ } else {
1673
+ navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
1674
+ (_a = transformedElement == null ? void 0 : transformedElement.querySelector(`#${parsedUrl.hash.slice(1)}`)) == null ? void 0 : _a.scrollIntoView();
1675
+ }
1606
1676
  } else {
1607
- navigate(parsedUrl.pathname);
1677
+ if (modifierActive) {
1678
+ window.open(parsedUrl.pathname, "_blank");
1679
+ } else {
1680
+ navigate(parsedUrl.pathname);
1681
+ }
1608
1682
  }
1609
1683
  }
1610
- }
1611
- }),
1612
- onCssReady({
1613
- onLoading: () => {
1614
- },
1615
- onLoaded: () => {
1616
- var _a;
1617
- (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1618
- }
1619
- }),
1620
- onCssReady({
1621
- onLoading: () => {
1622
- const sidebars = Array.from(transformedElement.querySelectorAll(".md-sidebar"));
1623
- sidebars.forEach((element) => {
1624
- element.style.setProperty("opacity", "0");
1625
- });
1626
- },
1627
- onLoaded: () => {
1628
- }
1629
- })
1630
- ]), [theme, navigate]);
1684
+ }),
1685
+ onCssReady({
1686
+ onLoading: () => {
1687
+ },
1688
+ onLoaded: () => {
1689
+ var _a;
1690
+ (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1691
+ }
1692
+ }),
1693
+ onCssReady({
1694
+ onLoading: () => {
1695
+ const sidebars = Array.from(
1696
+ transformedElement.querySelectorAll(".md-sidebar")
1697
+ );
1698
+ sidebars.forEach((element) => {
1699
+ element.style.setProperty("opacity", "0");
1700
+ });
1701
+ },
1702
+ onLoaded: () => {
1703
+ }
1704
+ })
1705
+ ]),
1706
+ [theme, navigate]
1707
+ );
1631
1708
  useEffect(() => {
1632
1709
  if (!rawPage)
1633
1710
  return () => {
@@ -1641,7 +1718,9 @@ const useTechDocsReaderDom = (entityRef) => {
1641
1718
  return;
1642
1719
  }
1643
1720
  window.scroll({ top: 0 });
1644
- const postTransformedDomElement = await postRender(preTransformedDomElement);
1721
+ const postTransformedDomElement = await postRender(
1722
+ preTransformedDomElement
1723
+ );
1645
1724
  setDom(postTransformedDomElement);
1646
1725
  });
1647
1726
  return () => {
@@ -1654,19 +1733,35 @@ const useTechDocsReaderDom = (entityRef) => {
1654
1733
  const TechDocsReaderPageContentAddons = () => {
1655
1734
  const addons = useTechDocsAddons();
1656
1735
  const { shadowRoot } = useTechDocsReaderPage();
1657
- const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('[data-md-component="content"]');
1658
- const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]');
1659
- let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector('[data-techdocs-addons-location="primary sidebar"]');
1736
+ const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1737
+ '[data-md-component="content"]'
1738
+ );
1739
+ const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1740
+ 'div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]'
1741
+ );
1742
+ let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector(
1743
+ '[data-techdocs-addons-location="primary sidebar"]'
1744
+ );
1660
1745
  if (!primarySidebarAddonLocation) {
1661
1746
  primarySidebarAddonLocation = document.createElement("div");
1662
- primarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "primary sidebar");
1747
+ primarySidebarAddonLocation.setAttribute(
1748
+ "data-techdocs-addons-location",
1749
+ "primary sidebar"
1750
+ );
1663
1751
  primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1664
1752
  }
1665
- const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]');
1666
- let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector('[data-techdocs-addons-location="secondary sidebar"]');
1753
+ const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1754
+ 'div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]'
1755
+ );
1756
+ let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector(
1757
+ '[data-techdocs-addons-location="secondary sidebar"]'
1758
+ );
1667
1759
  if (!secondarySidebarAddonLocation) {
1668
1760
  secondarySidebarAddonLocation = document.createElement("div");
1669
- secondarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "secondary sidebar");
1761
+ secondarySidebarAddonLocation.setAttribute(
1762
+ "data-techdocs-addons-location",
1763
+ "secondary sidebar"
1764
+ );
1670
1765
  secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1671
1766
  }
1672
1767
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, {
@@ -1687,55 +1782,60 @@ const useStyles$1 = makeStyles({
1687
1782
  }
1688
1783
  }
1689
1784
  });
1690
- const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
1691
- var _a;
1692
- const { withSearch = true, onReady } = props;
1693
- const classes = useStyles$1();
1694
- const {
1695
- entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1696
- entityRef,
1697
- setShadowRoot
1698
- } = useTechDocsReaderPage();
1699
- const dom = useTechDocsReaderDom(entityRef);
1700
- const handleAppend = useCallback((newShadowRoot) => {
1701
- setShadowRoot(newShadowRoot);
1702
- if (onReady instanceof Function) {
1703
- onReady();
1785
+ const TechDocsReaderPageContent = withTechDocsReaderProvider(
1786
+ (props) => {
1787
+ var _a;
1788
+ const { withSearch = true, onReady } = props;
1789
+ const classes = useStyles$1();
1790
+ const {
1791
+ entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1792
+ entityRef,
1793
+ setShadowRoot
1794
+ } = useTechDocsReaderPage();
1795
+ const dom = useTechDocsReaderDom(entityRef);
1796
+ const handleAppend = useCallback(
1797
+ (newShadowRoot) => {
1798
+ setShadowRoot(newShadowRoot);
1799
+ if (onReady instanceof Function) {
1800
+ onReady();
1801
+ }
1802
+ },
1803
+ [setShadowRoot, onReady]
1804
+ );
1805
+ if (entityMetadataLoading === false && !entityMetadata)
1806
+ return /* @__PURE__ */ React.createElement(ErrorPage, {
1807
+ status: "404",
1808
+ statusMessage: "PAGE NOT FOUND"
1809
+ });
1810
+ if (!dom) {
1811
+ return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
1812
+ container: true
1813
+ }, /* @__PURE__ */ React.createElement(Grid, {
1814
+ xs: 12,
1815
+ item: true
1816
+ }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
1704
1817
  }
1705
- }, [setShadowRoot, onReady]);
1706
- if (entityMetadataLoading === false && !entityMetadata)
1707
- return /* @__PURE__ */ React.createElement(ErrorPage, {
1708
- status: "404",
1709
- statusMessage: "PAGE NOT FOUND"
1710
- });
1711
- if (!dom) {
1712
1818
  return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
1713
1819
  container: true
1714
1820
  }, /* @__PURE__ */ React.createElement(Grid, {
1715
1821
  xs: 12,
1716
1822
  item: true
1717
- }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
1823
+ }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null)), withSearch && /* @__PURE__ */ React.createElement(Grid, {
1824
+ className: classes.search,
1825
+ xs: "auto",
1826
+ item: true
1827
+ }, /* @__PURE__ */ React.createElement(TechDocsSearch, {
1828
+ entityId: entityRef,
1829
+ entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
1830
+ })), /* @__PURE__ */ React.createElement(Grid, {
1831
+ xs: 12,
1832
+ item: true
1833
+ }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
1834
+ element: dom,
1835
+ onAppend: handleAppend
1836
+ }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1718
1837
  }
1719
- return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
1720
- container: true
1721
- }, /* @__PURE__ */ React.createElement(Grid, {
1722
- xs: 12,
1723
- item: true
1724
- }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null)), withSearch && /* @__PURE__ */ React.createElement(Grid, {
1725
- className: classes.search,
1726
- xs: "auto",
1727
- item: true
1728
- }, /* @__PURE__ */ React.createElement(TechDocsSearch, {
1729
- entityId: entityRef,
1730
- entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
1731
- })), /* @__PURE__ */ React.createElement(Grid, {
1732
- xs: 12,
1733
- item: true
1734
- }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
1735
- element: dom,
1736
- onAppend: handleAppend
1737
- }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1738
- });
1838
+ );
1739
1839
  const Reader = TechDocsReaderPageContent;
1740
1840
 
1741
1841
  const rootRouteRef = createRouteRef({
@@ -1853,7 +1953,9 @@ const TechDocsReaderPageSubheader = ({
1853
1953
  entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
1854
1954
  } = useTechDocsReaderPage();
1855
1955
  const addons = useTechDocsAddons();
1856
- const subheaderAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Subheader);
1956
+ const subheaderAddons = addons.renderComponentsByLocation(
1957
+ TechDocsAddonLocations.Subheader
1958
+ );
1857
1959
  const settingsAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Settings);
1858
1960
  if (!subheaderAddons && !settingsAddons)
1859
1961
  return null;
@@ -1924,7 +2026,9 @@ const TechDocsReaderPage$1 = (props) => {
1924
2026
  };
1925
2027
 
1926
2028
  function toLowerMaybe(str, config) {
1927
- return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
2029
+ return config.getOptionalBoolean(
2030
+ "techdocs.legacyUseCaseSensitiveTripletPaths"
2031
+ ) ? str : str.toLocaleLowerCase("en-US");
1928
2032
  }
1929
2033
 
1930
2034
  const DocsCardGrid = (props) => {
@@ -1943,7 +2047,10 @@ const DocsCardGrid = (props) => {
1943
2047
  title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
1944
2048
  })), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(Button$1, {
1945
2049
  to: getRouteToReaderPageFor({
1946
- namespace: toLowerMaybe((_b = entity.metadata.namespace) != null ? _b : "default", config),
2050
+ namespace: toLowerMaybe(
2051
+ (_b = entity.metadata.namespace) != null ? _b : "default",
2052
+ config
2053
+ ),
1947
2054
  kind: toLowerMaybe(entity.kind, config),
1948
2055
  name: toLowerMaybe(entity.metadata.name, config)
1949
2056
  }),
@@ -1967,10 +2074,14 @@ const EntityListDocsGrid = () => {
1967
2074
  if (loading || !entities) {
1968
2075
  return /* @__PURE__ */ React.createElement(Progress, null);
1969
2076
  }
1970
- entities.sort((a, b) => {
1971
- var _a, _b;
1972
- return ((_a = a.metadata.title) != null ? _a : a.metadata.name).localeCompare((_b = b.metadata.title) != null ? _b : b.metadata.name);
1973
- });
2077
+ entities.sort(
2078
+ (a, b) => {
2079
+ var _a, _b;
2080
+ return ((_a = a.metadata.title) != null ? _a : a.metadata.name).localeCompare(
2081
+ (_b = b.metadata.title) != null ? _b : b.metadata.name
2082
+ );
2083
+ }
2084
+ );
1974
2085
  return /* @__PURE__ */ React.createElement(DocsCardGrid, {
1975
2086
  entities
1976
2087
  });
@@ -2055,7 +2166,10 @@ const DocsTable = (props) => {
2055
2166
  entity,
2056
2167
  resolved: {
2057
2168
  docsUrl: getRouteToReaderPageFor({
2058
- namespace: toLowerMaybe((_a = entity.metadata.namespace) != null ? _a : "default", config),
2169
+ namespace: toLowerMaybe(
2170
+ (_a = entity.metadata.namespace) != null ? _a : "default",
2171
+ config
2172
+ ),
2059
2173
  kind: toLowerMaybe(entity.kind, config),
2060
2174
  name: toLowerMaybe(entity.metadata.name, config)
2061
2175
  }),
@@ -2107,7 +2221,10 @@ const EntityListDocsTable = (props) => {
2107
2221
  const title = capitalize((_b = (_a = filters.user) == null ? void 0 : _a.value) != null ? _b : "all");
2108
2222
  const defaultActions = [
2109
2223
  actionFactories.createCopyDocsUrlAction(copyToClipboard),
2110
- actionFactories.createStarEntityAction(isStarredEntity, toggleStarredEntity)
2224
+ actionFactories.createStarEntityAction(
2225
+ isStarredEntity,
2226
+ toggleStarredEntity
2227
+ )
2111
2228
  ];
2112
2229
  if (error) {
2113
2230
  return /* @__PURE__ */ React.createElement(WarningPanel, {
@@ -2159,7 +2276,7 @@ const TechDocsPicker = () => {
2159
2276
  };
2160
2277
 
2161
2278
  const DefaultTechDocsHome = (props) => {
2162
- const { initialFilter = "all", columns, actions } = props;
2279
+ const { initialFilter = "owned", columns, actions } = props;
2163
2280
  return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
2164
2281
  title: ""
2165
2282
  }, /* @__PURE__ */ React.createElement(SupportButton, null, "Discover documentation in your ecosystem.")), /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(TechDocsPicker, null), /* @__PURE__ */ React.createElement(UserListPicker, {
@@ -2208,31 +2325,47 @@ const techdocsPlugin = createPlugin({
2208
2325
  entityContent: rootCatalogDocsRouteRef
2209
2326
  }
2210
2327
  });
2211
- const TechdocsPage = techdocsPlugin.provide(createRoutableExtension({
2212
- name: "TechdocsPage",
2213
- component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
2214
- mountPoint: rootRouteRef
2215
- }));
2216
- const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
2217
- name: "EntityTechdocsContent",
2218
- component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.EmbeddedDocsRouter),
2219
- mountPoint: rootCatalogDocsRouteRef
2220
- }));
2221
- const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
2222
- name: "TechDocsCustomHome",
2223
- component: () => import('./TechDocsCustomHome-2104cf15.esm.js').then((m) => m.TechDocsCustomHome),
2224
- mountPoint: rootRouteRef
2225
- }));
2226
- const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
2227
- name: "TechDocsIndexPage",
2228
- component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then((m) => m.TechDocsIndexPage),
2229
- mountPoint: rootRouteRef
2230
- }));
2231
- const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
2232
- name: "TechDocsReaderPage",
2233
- component: () => import('./index-2eae1043.esm.js').then((m) => m.TechDocsReaderPage),
2234
- mountPoint: rootDocsRouteRef
2235
- }));
2328
+ const TechdocsPage = techdocsPlugin.provide(
2329
+ createRoutableExtension({
2330
+ name: "TechdocsPage",
2331
+ component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
2332
+ mountPoint: rootRouteRef
2333
+ })
2334
+ );
2335
+ const EntityTechdocsContent = techdocsPlugin.provide(
2336
+ createRoutableExtension({
2337
+ name: "EntityTechdocsContent",
2338
+ component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.EmbeddedDocsRouter),
2339
+ mountPoint: rootCatalogDocsRouteRef
2340
+ })
2341
+ );
2342
+ const TechDocsCustomHome = techdocsPlugin.provide(
2343
+ createRoutableExtension({
2344
+ name: "TechDocsCustomHome",
2345
+ component: () => import('./TechDocsCustomHome-b5be48dd.esm.js').then(
2346
+ (m) => m.TechDocsCustomHome
2347
+ ),
2348
+ mountPoint: rootRouteRef
2349
+ })
2350
+ );
2351
+ const TechDocsIndexPage$2 = techdocsPlugin.provide(
2352
+ createRoutableExtension({
2353
+ name: "TechDocsIndexPage",
2354
+ component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then(
2355
+ (m) => m.TechDocsIndexPage
2356
+ ),
2357
+ mountPoint: rootRouteRef
2358
+ })
2359
+ );
2360
+ const TechDocsReaderPage = techdocsPlugin.provide(
2361
+ createRoutableExtension({
2362
+ name: "TechDocsReaderPage",
2363
+ component: () => import('./index-564cb5cb.esm.js').then(
2364
+ (m) => m.TechDocsReaderPage
2365
+ ),
2366
+ mountPoint: rootDocsRouteRef
2367
+ })
2368
+ );
2236
2369
 
2237
2370
  const EntityPageDocs = ({ entity }) => {
2238
2371
  const entityRef = getCompoundEntityRef(entity);
@@ -2243,9 +2376,11 @@ const EntityPageDocs = ({ entity }) => {
2243
2376
  }));
2244
2377
  };
2245
2378
 
2246
- const TechDocsIndexPage = () => {
2379
+ const TechDocsIndexPage = (props) => {
2247
2380
  const outlet = useOutlet$1();
2248
- return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, null);
2381
+ return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, {
2382
+ ...props
2383
+ });
2249
2384
  };
2250
2385
 
2251
2386
  var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
@@ -2302,4 +2437,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2302
2437
  });
2303
2438
 
2304
2439
  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 };
2305
- //# sourceMappingURL=index-5dc523a8.esm.js.map
2440
+ //# sourceMappingURL=index-68c478ec.esm.js.map