@backstage/plugin-techdocs 1.2.1-next.2 → 1.3.1-next.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.
@@ -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
 
@@ -898,7 +930,7 @@ var layout = ({ theme, sidebar }) => `
898
930
  scrollbar-width: thin;
899
931
  }
900
932
  .md-sidebar .md-sidebar__scrollwrap {
901
- width: calc(16rem - 10px);
933
+ width: calc(12.1rem);
902
934
  }
903
935
  .md-sidebar--secondary {
904
936
  right: ${theme.spacing(3)}px;
@@ -1005,7 +1037,7 @@ var layout = ({ theme, sidebar }) => `
1005
1037
  .md-sidebar--primary {
1006
1038
  width: 12.1rem !important;
1007
1039
  z-index: 200;
1008
- left: ${sidebar.isPinned ? "calc(-12.1rem + 242px)" : "calc(-12.1rem + 72px)"} !important;
1040
+ left: ${sidebar.isPinned ? `calc(-12.1rem + ${SIDEBAR_WIDTH})` : "calc(-12.1rem + 72px)"} !important;
1009
1041
  }
1010
1042
  .md-sidebar--secondary:not([hidden]) {
1011
1043
  display: none;
@@ -1230,10 +1262,13 @@ const useRuleStyles = () => {
1230
1262
  };
1231
1263
  const useStylesTransformer = () => {
1232
1264
  const styles = useRuleStyles();
1233
- return useCallback((dom) => {
1234
- dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1235
- return dom;
1236
- }, [styles]);
1265
+ return useCallback(
1266
+ (dom) => {
1267
+ dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1268
+ return dom;
1269
+ },
1270
+ [styles]
1271
+ );
1237
1272
  };
1238
1273
 
1239
1274
  const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
@@ -1255,12 +1290,21 @@ const addBaseUrl = ({
1255
1290
  const elemAttribute = elem.getAttribute(attributeName);
1256
1291
  if (!elemAttribute)
1257
1292
  return;
1258
- const newValue = await techdocsStorageApi.getBaseUrl(elemAttribute, entityId, path);
1293
+ const newValue = await techdocsStorageApi.getBaseUrl(
1294
+ elemAttribute,
1295
+ entityId,
1296
+ path
1297
+ );
1259
1298
  if (isSvgNeedingInlining(attributeName, elemAttribute, apiOrigin)) {
1260
1299
  try {
1261
1300
  const svg = await fetch(newValue, { credentials: "include" });
1262
1301
  const svgContent = await svg.text();
1263
- elem.setAttribute(attributeName, `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(svgContent)))}`);
1302
+ elem.setAttribute(
1303
+ attributeName,
1304
+ `data:image/svg+xml;base64,${btoa(
1305
+ unescape(encodeURIComponent(svgContent))
1306
+ )}`
1307
+ );
1264
1308
  } catch (e) {
1265
1309
  elem.setAttribute("alt", `Error: ${elemAttribute}`);
1266
1310
  }
@@ -1284,7 +1328,9 @@ const addBaseUrl = ({
1284
1328
  const addGitFeedbackLink = (scmIntegrationsApi) => {
1285
1329
  return (dom) => {
1286
1330
  var _a;
1287
- const sourceAnchor = dom.querySelector('[title="Edit this page"]');
1331
+ const sourceAnchor = dom.querySelector(
1332
+ '[title="Edit this page"]'
1333
+ );
1288
1334
  if (!sourceAnchor || !sourceAnchor.href) {
1289
1335
  return dom;
1290
1336
  }
@@ -1295,10 +1341,12 @@ const addGitFeedbackLink = (scmIntegrationsApi) => {
1295
1341
  }
1296
1342
  const title = ((_a = dom.querySelector("article>h1")) == null ? void 0 : _a.childNodes[0].textContent) || "";
1297
1343
  const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
1298
- const issueDesc = encodeURIComponent(`Page source:
1344
+ const issueDesc = encodeURIComponent(
1345
+ `Page source:
1299
1346
  ${sourceAnchor.href}
1300
1347
 
1301
- Feedback:`);
1348
+ Feedback:`
1349
+ );
1302
1350
  const gitUrl = (integration == null ? void 0 : integration.type) === "github" ? replaceGitHubUrlType(sourceURL.href, "blob") : sourceURL.href;
1303
1351
  const gitInfo = parseGitUrl(gitUrl);
1304
1352
  const repoPath = `/${gitInfo.organization}/${gitInfo.name}`;
@@ -1324,7 +1372,9 @@ Feedback:`);
1324
1372
 
1325
1373
  const addSidebarToggle = () => {
1326
1374
  return (dom) => {
1327
- const mkdocsToggleSidebar = dom.querySelector('.md-header label[for="__drawer"]');
1375
+ const mkdocsToggleSidebar = dom.querySelector(
1376
+ '.md-header label[for="__drawer"]'
1377
+ );
1328
1378
  const article = dom.querySelector("article");
1329
1379
  if (!mkdocsToggleSidebar || !article) {
1330
1380
  return dom;
@@ -1351,8 +1401,13 @@ const rewriteDocLinks = () => {
1351
1401
  elem.setAttribute("target", "_blank");
1352
1402
  }
1353
1403
  try {
1354
- const normalizedWindowLocation = normalizeUrl(window.location.href);
1355
- elem.setAttribute(attributeName, new URL(elemAttribute, normalizedWindowLocation).toString());
1404
+ const normalizedWindowLocation = normalizeUrl(
1405
+ window.location.href
1406
+ );
1407
+ elem.setAttribute(
1408
+ attributeName,
1409
+ new URL(elemAttribute, normalizedWindowLocation).toString()
1410
+ );
1356
1411
  } catch (_e) {
1357
1412
  elem.replaceWith(elem.textContent || elemAttribute);
1358
1413
  }
@@ -1433,11 +1488,14 @@ const copyToClipboard = (theme) => {
1433
1488
  const text = code.textContent || "";
1434
1489
  const container = document.createElement("div");
1435
1490
  (_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);
1491
+ ReactDOM.render(
1492
+ /* @__PURE__ */ React.createElement(ThemeProvider, {
1493
+ theme
1494
+ }, /* @__PURE__ */ React.createElement(CopyToClipboardButton, {
1495
+ text
1496
+ })),
1497
+ container
1498
+ );
1441
1499
  }
1442
1500
  return dom;
1443
1501
  };
@@ -1466,10 +1524,16 @@ const onCssReady = ({
1466
1524
  }) => {
1467
1525
  return (dom) => {
1468
1526
  onLoading();
1469
- dom.addEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, function handleShadowDomStyleLoad() {
1470
- onLoaded();
1471
- dom.removeEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, handleShadowDomStyleLoad);
1472
- });
1527
+ dom.addEventListener(
1528
+ SHADOW_DOM_STYLE_LOAD_EVENT,
1529
+ function handleShadowDomStyleLoad() {
1530
+ onLoaded();
1531
+ dom.removeEventListener(
1532
+ SHADOW_DOM_STYLE_LOAD_EVENT,
1533
+ handleShadowDomStyleLoad
1534
+ );
1535
+ }
1536
+ );
1473
1537
  return dom;
1474
1538
  };
1475
1539
  };
@@ -1564,70 +1628,78 @@ const useTechDocsReaderDom = (entityRef) => {
1564
1628
  updateSidebarPosition();
1565
1629
  }
1566
1630
  }, [state, isStyleLoading, updateFooterWidth, updateSidebarPosition]);
1567
- const preRender = useCallback((rawContent, contentPath) => transform(rawContent, [
1568
- sanitizerTransformer,
1569
- addBaseUrl({
1631
+ const preRender = useCallback(
1632
+ (rawContent, contentPath) => transform(rawContent, [
1633
+ sanitizerTransformer,
1634
+ addBaseUrl({
1635
+ techdocsStorageApi,
1636
+ entityId: entityRef,
1637
+ path: contentPath
1638
+ }),
1639
+ rewriteDocLinks(),
1640
+ addSidebarToggle(),
1641
+ removeMkdocsHeader(),
1642
+ simplifyMkdocsFooter(),
1643
+ addGitFeedbackLink(scmIntegrationsApi),
1644
+ stylesTransformer
1645
+ ]),
1646
+ [
1647
+ entityRef,
1648
+ scmIntegrationsApi,
1570
1649
  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");
1650
+ sanitizerTransformer,
1651
+ stylesTransformer
1652
+ ]
1653
+ );
1654
+ const postRender = useCallback(
1655
+ async (transformedElement) => transform(transformedElement, [
1656
+ scrollIntoAnchor(),
1657
+ copyToClipboard(theme),
1658
+ addLinkClickListener({
1659
+ baseUrl: window.location.origin,
1660
+ onClick: (event, url) => {
1661
+ var _a;
1662
+ const modifierActive = event.ctrlKey || event.metaKey;
1663
+ const parsedUrl = new URL(url);
1664
+ if (parsedUrl.hash) {
1665
+ if (modifierActive) {
1666
+ window.open(`${parsedUrl.pathname}${parsedUrl.hash}`, "_blank");
1667
+ } else {
1668
+ navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
1669
+ (_a = transformedElement == null ? void 0 : transformedElement.querySelector(`#${parsedUrl.hash.slice(1)}`)) == null ? void 0 : _a.scrollIntoView();
1670
+ }
1606
1671
  } else {
1607
- navigate(parsedUrl.pathname);
1672
+ if (modifierActive) {
1673
+ window.open(parsedUrl.pathname, "_blank");
1674
+ } else {
1675
+ navigate(parsedUrl.pathname);
1676
+ }
1608
1677
  }
1609
1678
  }
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]);
1679
+ }),
1680
+ onCssReady({
1681
+ onLoading: () => {
1682
+ },
1683
+ onLoaded: () => {
1684
+ var _a;
1685
+ (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1686
+ }
1687
+ }),
1688
+ onCssReady({
1689
+ onLoading: () => {
1690
+ const sidebars = Array.from(
1691
+ transformedElement.querySelectorAll(".md-sidebar")
1692
+ );
1693
+ sidebars.forEach((element) => {
1694
+ element.style.setProperty("opacity", "0");
1695
+ });
1696
+ },
1697
+ onLoaded: () => {
1698
+ }
1699
+ })
1700
+ ]),
1701
+ [theme, navigate]
1702
+ );
1631
1703
  useEffect(() => {
1632
1704
  if (!rawPage)
1633
1705
  return () => {
@@ -1641,7 +1713,9 @@ const useTechDocsReaderDom = (entityRef) => {
1641
1713
  return;
1642
1714
  }
1643
1715
  window.scroll({ top: 0 });
1644
- const postTransformedDomElement = await postRender(preTransformedDomElement);
1716
+ const postTransformedDomElement = await postRender(
1717
+ preTransformedDomElement
1718
+ );
1645
1719
  setDom(postTransformedDomElement);
1646
1720
  });
1647
1721
  return () => {
@@ -1654,19 +1728,35 @@ const useTechDocsReaderDom = (entityRef) => {
1654
1728
  const TechDocsReaderPageContentAddons = () => {
1655
1729
  const addons = useTechDocsAddons();
1656
1730
  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"]');
1731
+ const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1732
+ '[data-md-component="content"]'
1733
+ );
1734
+ const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1735
+ 'div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]'
1736
+ );
1737
+ let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector(
1738
+ '[data-techdocs-addons-location="primary sidebar"]'
1739
+ );
1660
1740
  if (!primarySidebarAddonLocation) {
1661
1741
  primarySidebarAddonLocation = document.createElement("div");
1662
- primarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "primary sidebar");
1742
+ primarySidebarAddonLocation.setAttribute(
1743
+ "data-techdocs-addons-location",
1744
+ "primary sidebar"
1745
+ );
1663
1746
  primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1664
1747
  }
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"]');
1748
+ const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector(
1749
+ 'div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]'
1750
+ );
1751
+ let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector(
1752
+ '[data-techdocs-addons-location="secondary sidebar"]'
1753
+ );
1667
1754
  if (!secondarySidebarAddonLocation) {
1668
1755
  secondarySidebarAddonLocation = document.createElement("div");
1669
- secondarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "secondary sidebar");
1756
+ secondarySidebarAddonLocation.setAttribute(
1757
+ "data-techdocs-addons-location",
1758
+ "secondary sidebar"
1759
+ );
1670
1760
  secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1671
1761
  }
1672
1762
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, {
@@ -1687,55 +1777,60 @@ const useStyles$1 = makeStyles({
1687
1777
  }
1688
1778
  }
1689
1779
  });
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();
1780
+ const TechDocsReaderPageContent = withTechDocsReaderProvider(
1781
+ (props) => {
1782
+ var _a;
1783
+ const { withSearch = true, onReady } = props;
1784
+ const classes = useStyles$1();
1785
+ const {
1786
+ entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1787
+ entityRef,
1788
+ setShadowRoot
1789
+ } = useTechDocsReaderPage();
1790
+ const dom = useTechDocsReaderDom(entityRef);
1791
+ const handleAppend = useCallback(
1792
+ (newShadowRoot) => {
1793
+ setShadowRoot(newShadowRoot);
1794
+ if (onReady instanceof Function) {
1795
+ onReady();
1796
+ }
1797
+ },
1798
+ [setShadowRoot, onReady]
1799
+ );
1800
+ if (entityMetadataLoading === false && !entityMetadata)
1801
+ return /* @__PURE__ */ React.createElement(ErrorPage, {
1802
+ status: "404",
1803
+ statusMessage: "PAGE NOT FOUND"
1804
+ });
1805
+ if (!dom) {
1806
+ return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
1807
+ container: true
1808
+ }, /* @__PURE__ */ React.createElement(Grid, {
1809
+ xs: 12,
1810
+ item: true
1811
+ }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
1704
1812
  }
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
1813
  return /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
1713
1814
  container: true
1714
1815
  }, /* @__PURE__ */ React.createElement(Grid, {
1715
1816
  xs: 12,
1716
1817
  item: true
1717
- }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null))));
1818
+ }, /* @__PURE__ */ React.createElement(TechDocsStateIndicator, null)), withSearch && /* @__PURE__ */ React.createElement(Grid, {
1819
+ className: classes.search,
1820
+ xs: "auto",
1821
+ item: true
1822
+ }, /* @__PURE__ */ React.createElement(TechDocsSearch, {
1823
+ entityId: entityRef,
1824
+ entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
1825
+ })), /* @__PURE__ */ React.createElement(Grid, {
1826
+ xs: 12,
1827
+ item: true
1828
+ }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
1829
+ element: dom,
1830
+ onAppend: handleAppend
1831
+ }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1718
1832
  }
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
- });
1833
+ );
1739
1834
  const Reader = TechDocsReaderPageContent;
1740
1835
 
1741
1836
  const rootRouteRef = createRouteRef({
@@ -1853,7 +1948,9 @@ const TechDocsReaderPageSubheader = ({
1853
1948
  entityMetadata: { value: entityMetadata, loading: entityMetadataLoading }
1854
1949
  } = useTechDocsReaderPage();
1855
1950
  const addons = useTechDocsAddons();
1856
- const subheaderAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Subheader);
1951
+ const subheaderAddons = addons.renderComponentsByLocation(
1952
+ TechDocsAddonLocations.Subheader
1953
+ );
1857
1954
  const settingsAddons = addons.renderComponentsByLocation(TechDocsAddonLocations.Settings);
1858
1955
  if (!subheaderAddons && !settingsAddons)
1859
1956
  return null;
@@ -1924,7 +2021,9 @@ const TechDocsReaderPage$1 = (props) => {
1924
2021
  };
1925
2022
 
1926
2023
  function toLowerMaybe(str, config) {
1927
- return config.getOptionalBoolean("techdocs.legacyUseCaseSensitiveTripletPaths") ? str : str.toLocaleLowerCase("en-US");
2024
+ return config.getOptionalBoolean(
2025
+ "techdocs.legacyUseCaseSensitiveTripletPaths"
2026
+ ) ? str : str.toLocaleLowerCase("en-US");
1928
2027
  }
1929
2028
 
1930
2029
  const DocsCardGrid = (props) => {
@@ -1943,7 +2042,10 @@ const DocsCardGrid = (props) => {
1943
2042
  title: (_a = entity.metadata.title) != null ? _a : entity.metadata.name
1944
2043
  })), /* @__PURE__ */ React.createElement(CardContent, null, entity.metadata.description), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement(Button$1, {
1945
2044
  to: getRouteToReaderPageFor({
1946
- namespace: toLowerMaybe((_b = entity.metadata.namespace) != null ? _b : "default", config),
2045
+ namespace: toLowerMaybe(
2046
+ (_b = entity.metadata.namespace) != null ? _b : "default",
2047
+ config
2048
+ ),
1947
2049
  kind: toLowerMaybe(entity.kind, config),
1948
2050
  name: toLowerMaybe(entity.metadata.name, config)
1949
2051
  }),
@@ -1967,10 +2069,14 @@ const EntityListDocsGrid = () => {
1967
2069
  if (loading || !entities) {
1968
2070
  return /* @__PURE__ */ React.createElement(Progress, null);
1969
2071
  }
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
- });
2072
+ entities.sort(
2073
+ (a, b) => {
2074
+ var _a, _b;
2075
+ return ((_a = a.metadata.title) != null ? _a : a.metadata.name).localeCompare(
2076
+ (_b = b.metadata.title) != null ? _b : b.metadata.name
2077
+ );
2078
+ }
2079
+ );
1974
2080
  return /* @__PURE__ */ React.createElement(DocsCardGrid, {
1975
2081
  entities
1976
2082
  });
@@ -2055,7 +2161,10 @@ const DocsTable = (props) => {
2055
2161
  entity,
2056
2162
  resolved: {
2057
2163
  docsUrl: getRouteToReaderPageFor({
2058
- namespace: toLowerMaybe((_a = entity.metadata.namespace) != null ? _a : "default", config),
2164
+ namespace: toLowerMaybe(
2165
+ (_a = entity.metadata.namespace) != null ? _a : "default",
2166
+ config
2167
+ ),
2059
2168
  kind: toLowerMaybe(entity.kind, config),
2060
2169
  name: toLowerMaybe(entity.metadata.name, config)
2061
2170
  }),
@@ -2107,7 +2216,10 @@ const EntityListDocsTable = (props) => {
2107
2216
  const title = capitalize((_b = (_a = filters.user) == null ? void 0 : _a.value) != null ? _b : "all");
2108
2217
  const defaultActions = [
2109
2218
  actionFactories.createCopyDocsUrlAction(copyToClipboard),
2110
- actionFactories.createStarEntityAction(isStarredEntity, toggleStarredEntity)
2219
+ actionFactories.createStarEntityAction(
2220
+ isStarredEntity,
2221
+ toggleStarredEntity
2222
+ )
2111
2223
  ];
2112
2224
  if (error) {
2113
2225
  return /* @__PURE__ */ React.createElement(WarningPanel, {
@@ -2159,7 +2271,7 @@ const TechDocsPicker = () => {
2159
2271
  };
2160
2272
 
2161
2273
  const DefaultTechDocsHome = (props) => {
2162
- const { initialFilter = "all", columns, actions } = props;
2274
+ const { initialFilter = "owned", columns, actions } = props;
2163
2275
  return /* @__PURE__ */ React.createElement(TechDocsPageWrapper, null, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
2164
2276
  title: ""
2165
2277
  }, /* @__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 +2320,47 @@ const techdocsPlugin = createPlugin({
2208
2320
  entityContent: rootCatalogDocsRouteRef
2209
2321
  }
2210
2322
  });
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
- }));
2323
+ const TechdocsPage = techdocsPlugin.provide(
2324
+ createRoutableExtension({
2325
+ name: "TechdocsPage",
2326
+ component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.Router),
2327
+ mountPoint: rootRouteRef
2328
+ })
2329
+ );
2330
+ const EntityTechdocsContent = techdocsPlugin.provide(
2331
+ createRoutableExtension({
2332
+ name: "EntityTechdocsContent",
2333
+ component: () => Promise.resolve().then(function () { return Router$1; }).then((m) => m.EmbeddedDocsRouter),
2334
+ mountPoint: rootCatalogDocsRouteRef
2335
+ })
2336
+ );
2337
+ const TechDocsCustomHome = techdocsPlugin.provide(
2338
+ createRoutableExtension({
2339
+ name: "TechDocsCustomHome",
2340
+ component: () => import('./TechDocsCustomHome-21127c89.esm.js').then(
2341
+ (m) => m.TechDocsCustomHome
2342
+ ),
2343
+ mountPoint: rootRouteRef
2344
+ })
2345
+ );
2346
+ const TechDocsIndexPage$2 = techdocsPlugin.provide(
2347
+ createRoutableExtension({
2348
+ name: "TechDocsIndexPage",
2349
+ component: () => Promise.resolve().then(function () { return TechDocsIndexPage$1; }).then(
2350
+ (m) => m.TechDocsIndexPage
2351
+ ),
2352
+ mountPoint: rootRouteRef
2353
+ })
2354
+ );
2355
+ const TechDocsReaderPage = techdocsPlugin.provide(
2356
+ createRoutableExtension({
2357
+ name: "TechDocsReaderPage",
2358
+ component: () => import('./index-9bfbfb2a.esm.js').then(
2359
+ (m) => m.TechDocsReaderPage
2360
+ ),
2361
+ mountPoint: rootDocsRouteRef
2362
+ })
2363
+ );
2236
2364
 
2237
2365
  const EntityPageDocs = ({ entity }) => {
2238
2366
  const entityRef = getCompoundEntityRef(entity);
@@ -2243,9 +2371,11 @@ const EntityPageDocs = ({ entity }) => {
2243
2371
  }));
2244
2372
  };
2245
2373
 
2246
- const TechDocsIndexPage = () => {
2374
+ const TechDocsIndexPage = (props) => {
2247
2375
  const outlet = useOutlet$1();
2248
- return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, null);
2376
+ return outlet || /* @__PURE__ */ React.createElement(DefaultTechDocsHome, {
2377
+ ...props
2378
+ });
2249
2379
  };
2250
2380
 
2251
2381
  var TechDocsIndexPage$1 = /*#__PURE__*/Object.freeze({
@@ -2302,4 +2432,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2302
2432
  });
2303
2433
 
2304
2434
  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
2435
+ //# sourceMappingURL=index-ea5d3c5d.esm.js.map