@backstage/plugin-techdocs 1.1.1 → 1.2.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.
@@ -1,15 +1,13 @@
1
- import { createApiRef, useApi, configApiRef, createRouteRef, useRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
1
+ import { createApiRef, useApi, useAnalytics, configApiRef, createRouteRef, useRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, fetchApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
2
2
  import { ResponseError, NotFoundError } from '@backstage/errors';
3
3
  import { EventSourcePolyfill } from 'event-source-polyfill';
4
4
  import React, { useReducer, useRef, useMemo, createContext, useContext, useState, useEffect, useCallback, Children } from 'react';
5
- import { useParams, useNavigate as useNavigate$1, useOutlet, Routes, Route } from 'react-router-dom';
6
- import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage, useTechDocsAddons, TechDocsAddonLocations, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider, techdocsApiRef as techdocsApiRef$1 } from '@backstage/plugin-techdocs-react';
5
+ import { useParams, useNavigate as useNavigate$1, useOutlet, Routes, Route, useRoutes } from 'react-router-dom';
6
+ import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage, SHADOW_DOM_STYLE_LOAD_EVENT, useShadowDomStylesLoading, useTechDocsAddons, TechDocsAddonLocations, TechDocsShadowDom, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider, techdocsApiRef as techdocsApiRef$1 } from '@backstage/plugin-techdocs-react';
7
7
  import useAsync from 'react-use/lib/useAsync';
8
8
  import useAsyncRetry from 'react-use/lib/useAsyncRetry';
9
- import { Link, LogViewer, ErrorPage, Progress, SidebarPinStateContext, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
10
- import { create } from 'jss';
11
- import { makeStyles, ListItemText, ListItem, Divider, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button, Drawer, Grid, Typography, withStyles, Tooltip, ThemeProvider, SvgIcon, useTheme, Portal, Toolbar, Box, Menu, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
12
- import { jssPreset, StylesProvider, withStyles as withStyles$1 } from '@material-ui/styles';
9
+ import { Link, LogViewer, ErrorPage, useSidebarPinState, Content, HeaderLabel, Header, Page, ItemCardGrid, ItemCardHeader, Button as Button$1, WarningPanel, CodeSnippet, Progress, SubvalueCell, Table, EmptyState, PageWithHeader, ContentHeader, SupportButton, MissingAnnotationEmptyState } from '@backstage/core-components';
10
+ import { makeStyles, ListItemText, ListItem, ListItemIcon, Divider, TextField, InputAdornment, IconButton, CircularProgress, createStyles, Button, Drawer, Grid, Typography, lighten, alpha, useTheme, withStyles, Tooltip, ThemeProvider, SvgIcon, useMediaQuery, Portal, Toolbar, Box, Menu, Card, CardMedia, CardContent, CardActions } from '@material-ui/core';
13
11
  import { HighlightedSearchResultText, SearchContextProvider, useSearch } from '@backstage/plugin-search-react';
14
12
  import SearchIcon from '@material-ui/icons/Search';
15
13
  import Autocomplete from '@material-ui/lab/Autocomplete';
@@ -17,14 +15,13 @@ import { useNavigate, useOutlet as useOutlet$1 } from 'react-router';
17
15
  import useDebounce from 'react-use/lib/useDebounce';
18
16
  import { Alert, Skeleton } from '@material-ui/lab';
19
17
  import Close from '@material-ui/icons/Close';
20
- import { lighten, alpha } from '@material-ui/core/styles';
21
18
  import { scmIntegrationsApiRef } from '@backstage/integration-react';
19
+ import DOMPurify from 'dompurify';
22
20
  import { replaceGitHubUrlType } from '@backstage/integration';
23
21
  import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
24
22
  import ReactDOM from 'react-dom';
25
23
  import parseGitUrl from 'git-url-parse';
26
24
  import MenuIcon from '@material-ui/icons/Menu';
27
- import DOMPurify from 'dompurify';
28
25
  import Helmet from 'react-helmet';
29
26
  import CodeIcon from '@material-ui/icons/Code';
30
27
  import { getEntityRelations, EntityRefLink, EntityRefLinks, useEntityList, humanizeEntityRef, useStarredEntities, CATALOG_FILTER_EXISTS, EntityListProvider, CatalogFilterLayout, UserListPicker, EntityOwnerPicker, EntityTagPicker, useEntity } from '@backstage/plugin-catalog-react';
@@ -33,6 +30,7 @@ import SettingsIcon from '@material-ui/icons/Settings';
33
30
  import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
34
31
  import { capitalize } from 'lodash';
35
32
  import ShareIcon from '@material-ui/icons/Share';
33
+ import { withStyles as withStyles$1 } from '@material-ui/styles';
36
34
  import Star from '@material-ui/icons/Star';
37
35
  import StarBorder from '@material-ui/icons/StarBorder';
38
36
 
@@ -329,12 +327,21 @@ const TechDocsSearchResultListItem = (props) => {
329
327
  const {
330
328
  result,
331
329
  highlight,
330
+ rank,
332
331
  lineClamp = 5,
333
332
  asListItem = true,
334
333
  asLink = true,
335
- title
334
+ title,
335
+ icon
336
336
  } = props;
337
337
  const classes = useStyles$4();
338
+ const analytics = useAnalytics();
339
+ const handleClick = () => {
340
+ analytics.captureEvent("discover", result.title, {
341
+ attributes: { to: result.location },
342
+ value: rank
343
+ });
344
+ };
338
345
  const TextItem = () => {
339
346
  const resultTitle = (highlight == null ? void 0 : highlight.fields.title) ? /* @__PURE__ */ React.createElement(HighlightedSearchResultText, {
340
347
  text: highlight.fields.title,
@@ -370,12 +377,15 @@ const TechDocsSearchResultListItem = (props) => {
370
377
  });
371
378
  };
372
379
  const LinkWrapper = ({ children }) => asLink ? /* @__PURE__ */ React.createElement(Link, {
373
- to: result.location
380
+ noTrack: true,
381
+ to: result.location,
382
+ onClick: handleClick
374
383
  }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
375
384
  const ListItemWrapper = ({ children }) => asListItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ListItem, {
376
- alignItems: "flex-start",
385
+ alignItems: "flex-start"
386
+ }, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement("div", {
377
387
  className: classes.flexContainer
378
- }, children), /* @__PURE__ */ React.createElement(Divider, {
388
+ }, children)), /* @__PURE__ */ React.createElement(Divider, {
379
389
  component: "li"
380
390
  })) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
381
391
  return /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(ListItemWrapper, null, /* @__PURE__ */ React.createElement(TextItem, null)));
@@ -387,7 +397,7 @@ const useStyles$3 = makeStyles({
387
397
  }
388
398
  });
389
399
  const TechDocsSearchBar = (props) => {
390
- const { entityId, debounceTime = 150 } = props;
400
+ const { entityId, entityTitle, debounceTime = 150 } = props;
391
401
  const [open, setOpen] = useState(false);
392
402
  const navigate = useNavigate();
393
403
  const {
@@ -467,7 +477,7 @@ const TechDocsSearchBar = (props) => {
467
477
  "data-testid": "techdocs-search-bar-input",
468
478
  variant: "outlined",
469
479
  fullWidth: true,
470
- placeholder: `Search ${entityId.name} docs`,
480
+ placeholder: `Search ${entityTitle || entityId.name} docs`,
471
481
  value,
472
482
  onChange: handleQuery,
473
483
  InputProps: {
@@ -599,7 +609,6 @@ const TechDocsStateIndicator = () => {
599
609
  syncErrorMessage,
600
610
  buildLog
601
611
  } = useTechDocsReader();
602
- const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */ React.createElement(Progress, null) : null;
603
612
  if (state === "INITIAL_BUILD") {
604
613
  StateAlert = /* @__PURE__ */ React.createElement(Alert, {
605
614
  classes: { root: classes.root },
@@ -659,7 +668,570 @@ const TechDocsStateIndicator = () => {
659
668
  errorMessage: contentErrorMessage
660
669
  }));
661
670
  }
662
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ReaderProgress, StateAlert);
671
+ return StateAlert;
672
+ };
673
+
674
+ const MKDOCS_CSS = /main\.[A-Fa-f0-9]{8}\.min\.css$/;
675
+ const GOOGLE_FONTS = /^https:\/\/fonts\.googleapis\.com/;
676
+ const GSTATIC_FONTS = /^https:\/\/fonts\.gstatic\.com/;
677
+ const isLink = (node) => node.nodeName === "LINK";
678
+ const isSafe$1 = (node) => {
679
+ const href = (node == null ? void 0 : node.getAttribute("href")) || "";
680
+ const isMkdocsCss = href.match(MKDOCS_CSS);
681
+ const isGoogleFonts = href.match(GOOGLE_FONTS);
682
+ const isGstaticFonts = href.match(GSTATIC_FONTS);
683
+ return isMkdocsCss || isGoogleFonts || isGstaticFonts;
684
+ };
685
+ const removeUnsafeLinks = (node) => {
686
+ if (isLink(node) && !isSafe$1(node)) {
687
+ node.remove();
688
+ }
689
+ return node;
690
+ };
691
+
692
+ const isIframe = (node) => node.nodeName === "IFRAME";
693
+ const isSafe = (node, hosts) => {
694
+ const src = node.getAttribute("src") || "";
695
+ try {
696
+ const { host } = new URL(src);
697
+ return hosts.includes(host);
698
+ } catch {
699
+ return false;
700
+ }
701
+ };
702
+ const removeUnsafeIframes = (hosts) => (node) => {
703
+ if (isIframe(node) && !isSafe(node, hosts)) {
704
+ node.remove();
705
+ }
706
+ return node;
707
+ };
708
+
709
+ const useSanitizerConfig = () => {
710
+ const configApi = useApi(configApiRef);
711
+ return useMemo(() => {
712
+ return configApi.getOptionalConfig("techdocs.sanitizer");
713
+ }, [configApi]);
714
+ };
715
+ const useSanitizerTransformer = () => {
716
+ 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]);
732
+ };
733
+
734
+ var variables = ({ theme }) => `
735
+ /*================== Variables ==================*/
736
+ /*
737
+ As the MkDocs output is rendered in shadow DOM, the CSS variable definitions on the root selector are not applied. Instead, they have to be applied on :host.
738
+ As there is no way to transform the served main*.css yet (for example in the backend), we have to copy from main*.css and modify them.
739
+ */
740
+
741
+ :host {
742
+ /* FONT */
743
+ --md-default-fg-color: ${theme.palette.text.primary};
744
+ --md-default-fg-color--light: ${theme.palette.text.secondary};
745
+ --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)};
747
+
748
+ /* BACKGROUND */
749
+ --md-default-bg-color:${theme.palette.background.default};
750
+ --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)};
753
+
754
+ /* PRIMARY */
755
+ --md-primary-fg-color: ${theme.palette.primary.main};
756
+ --md-primary-fg-color--light: ${theme.palette.primary.light};
757
+ --md-primary-fg-color--dark: ${theme.palette.primary.dark};
758
+ --md-primary-bg-color: ${theme.palette.primary.contrastText};
759
+ --md-primary-bg-color--light: ${lighten(theme.palette.primary.contrastText, 0.7)};
760
+
761
+ /* ACCENT */
762
+ --md-accent-fg-color: var(--md-primary-fg-color);
763
+
764
+ /* SHADOW */
765
+ --md-shadow-z1: ${theme.shadows[1]};
766
+ --md-shadow-z2: ${theme.shadows[2]};
767
+ --md-shadow-z3: ${theme.shadows[3]};
768
+
769
+ /* EXTENSIONS */
770
+ --md-admonition-fg-color: var(--md-default-fg-color);
771
+ --md-admonition-bg-color: var(--md-default-bg-color);
772
+ /* Admonitions and others are using SVG masks to define icons. These masks are defined as CSS variables. */
773
+ --md-admonition-icon--note: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>');
774
+ --md-admonition-icon--abstract: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 5h16v2H4V5m0 4h16v2H4V9m0 4h16v2H4v-2m0 4h10v2H4v-2z"/></svg>');
775
+ --md-admonition-icon--info: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10A10 10 0 0012 2z"/></svg>');
776
+ --md-admonition-icon--tip: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.55 11.2c-.23-.3-.5-.56-.76-.82-.65-.6-1.4-1.03-2.03-1.66C13.3 7.26 13 4.85 13.91 3c-.91.23-1.75.75-2.45 1.32-2.54 2.08-3.54 5.75-2.34 8.9.04.1.08.2.08.33 0 .22-.15.42-.35.5-.22.1-.46.04-.64-.12a.83.83 0 01-.15-.17c-1.1-1.43-1.28-3.48-.53-5.12C5.89 10 5 12.3 5.14 14.47c.04.5.1 1 .27 1.5.14.6.4 1.2.72 1.73 1.04 1.73 2.87 2.97 4.84 3.22 2.1.27 4.35-.12 5.96-1.6 1.8-1.66 2.45-4.32 1.5-6.6l-.13-.26c-.2-.46-.47-.87-.8-1.25l.05-.01m-3.1 6.3c-.28.24-.73.5-1.08.6-1.1.4-2.2-.16-2.87-.82 1.19-.28 1.89-1.16 2.09-2.05.17-.8-.14-1.46-.27-2.23-.12-.74-.1-1.37.18-2.06.17.38.37.76.6 1.06.76 1 1.95 1.44 2.2 2.8.04.14.06.28.06.43.03.82-.32 1.72-.92 2.27h.01z"/></svg>');
777
+ --md-admonition-icon--success: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
778
+ --md-admonition-icon--question: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.07 11.25l-.9.92C13.45 12.89 13 13.5 13 15h-2v-.5c0-1.11.45-2.11 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41a2 2 0 00-2-2 2 2 0 00-2 2H8a4 4 0 014-4 4 4 0 014 4 3.2 3.2 0 01-.93 2.25M13 19h-2v-2h2M12 2A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10c0-5.53-4.5-10-10-10z"/></svg>');
779
+ --md-admonition-icon--warning: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14h-2v-4h2m0 8h-2v-2h2M1 21h22L12 2 1 21z"/></svg>');
780
+ --md-admonition-icon--failure: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12 6.47 2 12 2m3.59 5L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41 15.59 7z"/></svg>');
781
+ --md-admonition-icon--danger: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.5 20l4.86-9.73H13V4l-5 9.73h3.5V20M12 2c2.75 0 5.1 1 7.05 2.95C21 6.9 22 9.25 22 12s-1 5.1-2.95 7.05C17.1 21 14.75 22 12 22s-5.1-1-7.05-2.95C3 17.1 2 14.75 2 12s1-5.1 2.95-7.05C6.9 3 9.25 2 12 2z"/></svg>');
782
+ --md-admonition-icon--bug: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 12h-4v-2h4m0 6h-4v-2h4m6-6h-2.81a5.985 5.985 0 00-1.82-1.96L17 4.41 15.59 3l-2.17 2.17a6.002 6.002 0 00-2.83 0L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8z"/></svg>');
783
+ --md-admonition-icon--example: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 01.75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25z"/></svg>');
784
+ --md-admonition-icon--quote: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4z"/></svg>');
785
+ --md-footnotes-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.42L5.83 13H21V7h-2z"/></svg>');
786
+ --md-details-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
787
+ --md-tasklist-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>');
788
+ --md-tasklist-icon--checked: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
789
+ --md-nav-icon--prev: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>');
790
+ --md-nav-icon--next: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
791
+ --md-toc-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>');
792
+ --md-clipboard-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1z"/></svg>');
793
+ --md-search-result-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h7c-.41-.25-.8-.56-1.14-.9-.33-.33-.61-.7-.86-1.1H6V4h7v5h5v1.18c.71.16 1.39.43 2 .82V8l-6-6m6.31 16.9c1.33-2.11.69-4.9-1.4-6.22-2.11-1.33-4.91-.68-6.22 1.4-1.34 2.11-.69 4.89 1.4 6.22 1.46.93 3.32.93 4.79.02L22 23.39 23.39 22l-3.08-3.1m-3.81.1a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5z"/></svg>');
794
+ --md-source-forks-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5z"/></svg>');
795
+ --md-source-repositories-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 1 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 0 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 0 1 1-1h8zM5 12.25v3.25a.25.25 0 0 0 .4.2l1.45-1.087a.25.25 0 0 1 .3 0L8.6 15.7a.25.25 0 0 0 .4-.2v-3.25a.25.25 0 0 0-.25-.25h-3.5a.25.25 0 0 0-.25.25z"/></svg>');
796
+ --md-source-stars-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.75.75 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694v.001z"/></svg>');
797
+ --md-source-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 0 1 .25-.25h5.025a.25.25 0 0 1 .177.073l6.25 6.25a.25.25 0 0 1 0 .354l-5.025 5.025a.25.25 0 0 1-.354 0l-6.25-6.25a.25.25 0 0 1-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.75 1.75 0 0 1 1 7.775zM6 5a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>');
798
+ --md-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m310.6 246.6-127.1 128c-7.1 6.3-15.3 9.4-23.5 9.4s-16.38-3.125-22.63-9.375l-127.1-128C.224 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75s3.12 25.75-6.08 34.85z"/></svg>');
799
+ }
800
+
801
+ :host > * {
802
+ /* CODE */
803
+ --md-code-fg-color: ${theme.palette.text.primary};
804
+ --md-code-bg-color: ${theme.palette.background.paper};
805
+ --md-code-hl-color: ${alpha(theme.palette.warning.main, 0.5)};
806
+ --md-code-hl-keyword-color: ${theme.palette.type === "dark" ? theme.palette.primary.light : theme.palette.primary.dark};
807
+ --md-code-hl-function-color: ${theme.palette.type === "dark" ? theme.palette.secondary.light : theme.palette.secondary.dark};
808
+ --md-code-hl-string-color: ${theme.palette.type === "dark" ? theme.palette.success.light : theme.palette.success.dark};
809
+ --md-code-hl-number-color: ${theme.palette.type === "dark" ? theme.palette.error.light : theme.palette.error.dark};
810
+ --md-code-hl-constant-color: var(--md-code-hl-function-color);
811
+ --md-code-hl-special-color: var(--md-code-hl-function-color);
812
+ --md-code-hl-name-color: var(--md-code-fg-color);
813
+ --md-code-hl-comment-color: var(--md-default-fg-color--light);
814
+ --md-code-hl-generic-color: var(--md-default-fg-color--light);
815
+ --md-code-hl-variable-color: var(--md-default-fg-color--light);
816
+ --md-code-hl-operator-color: var(--md-default-fg-color--light);
817
+ --md-code-hl-punctuation-color: var(--md-default-fg-color--light);
818
+
819
+ /* TYPESET */
820
+ --md-typeset-font-size: 1rem;
821
+ --md-typeset-color: var(--md-default-fg-color);
822
+ --md-typeset-a-color: var(--md-accent-fg-color);
823
+ --md-typeset-table-color: ${theme.palette.text.primary};
824
+ --md-typeset-del-color: ${theme.palette.type === "dark" ? alpha(theme.palette.error.dark, 0.5) : alpha(theme.palette.error.light, 0.5)};
825
+ --md-typeset-ins-color: ${theme.palette.type === "dark" ? alpha(theme.palette.success.dark, 0.5) : alpha(theme.palette.success.light, 0.5)};
826
+ --md-typeset-mark-color: ${theme.palette.type === "dark" ? alpha(theme.palette.warning.dark, 0.5) : alpha(theme.palette.warning.light, 0.5)};
827
+ }
828
+
829
+ @media screen and (max-width: 76.1875em) {
830
+ :host > * {
831
+ /* TYPESET */
832
+ --md-typeset-font-size: .9rem;
833
+ }
834
+ }
835
+
836
+ @media screen and (max-width: 600px) {
837
+ :host > * {
838
+ /* TYPESET */
839
+ --md-typeset-font-size: .7rem;
840
+ }
841
+ }
842
+ `;
843
+
844
+ var reset = ({ theme }) => `
845
+ /*================== Reset ==================*/
846
+
847
+ body {
848
+ --md-text-color: var(--md-default-fg-color);
849
+ --md-text-link-color: var(--md-accent-fg-color);
850
+ --md-text-font-family: ${theme.typography.fontFamily};
851
+ font-family: var(--md-text-font-family);
852
+ background-color: unset;
853
+ }
854
+ `;
855
+
856
+ var layout = ({ theme, sidebar }) => `
857
+ /*================== Layout ==================*/
858
+
859
+ .md-grid {
860
+ max-width: 100%;
861
+ margin: 0;
862
+ }
863
+
864
+ .md-nav {
865
+ font-size: calc(var(--md-typeset-font-size) * 0.9);
866
+ }
867
+ .md-nav__link {
868
+ display: flex;
869
+ align-items: center;
870
+ justify-content: space-between;
871
+ }
872
+ .md-nav__icon {
873
+ height: 20px !important;
874
+ width: 20px !important;
875
+ margin-left:${theme.spacing(1)}px;
876
+ }
877
+ .md-nav__icon svg {
878
+ margin: 0;
879
+ width: 20px !important;
880
+ height: 20px !important;
881
+ }
882
+ .md-nav__icon:after {
883
+ width: 20px !important;
884
+ height: 20px !important;
885
+ }
886
+
887
+ .md-main__inner {
888
+ margin-top: 0;
889
+ }
890
+
891
+ .md-sidebar {
892
+ bottom: 75px;
893
+ position: fixed;
894
+ width: 16rem;
895
+ overflow-y: auto;
896
+ overflow-x: hidden;
897
+ scrollbar-color: rgb(193, 193, 193) #eee;
898
+ scrollbar-width: thin;
899
+ }
900
+ .md-sidebar .md-sidebar__scrollwrap {
901
+ width: calc(16rem - 10px);
902
+ }
903
+ .md-sidebar--secondary {
904
+ right: ${theme.spacing(3)}px;
905
+ }
906
+ .md-sidebar::-webkit-scrollbar {
907
+ width: 5px;
908
+ }
909
+ .md-sidebar::-webkit-scrollbar-button {
910
+ width: 5px;
911
+ height: 5px;
912
+ }
913
+ .md-sidebar::-webkit-scrollbar-track {
914
+ background: #eee;
915
+ border: 1 px solid rgb(250, 250, 250);
916
+ box-shadow: 0px 0px 3px #dfdfdf inset;
917
+ border-radius: 3px;
918
+ }
919
+ .md-sidebar::-webkit-scrollbar-thumb {
920
+ width: 5px;
921
+ background: rgb(193, 193, 193);
922
+ border: transparent;
923
+ border-radius: 3px;
924
+ }
925
+ .md-sidebar::-webkit-scrollbar-thumb:hover {
926
+ background: rgb(125, 125, 125);
927
+ }
928
+
929
+ .md-content {
930
+ max-width: calc(100% - 16rem * 2);
931
+ margin-left: 16rem;
932
+ margin-bottom: 50px;
933
+ }
934
+
935
+ .md-footer {
936
+ position: fixed;
937
+ bottom: 0px;
938
+ }
939
+ .md-footer__title {
940
+ background-color: unset;
941
+ }
942
+ .md-footer-nav__link {
943
+ width: 16rem;
944
+ }
945
+
946
+ .md-dialog {
947
+ background-color: unset;
948
+ }
949
+
950
+ @media screen and (min-width: 76.25em) {
951
+ .md-sidebar {
952
+ height: auto;
953
+ }
954
+ }
955
+
956
+ @media screen and (max-width: 76.1875em) {
957
+ .md-nav {
958
+ transition: none !important;
959
+ background-color: var(--md-default-bg-color)
960
+ }
961
+ .md-nav--primary .md-nav__title {
962
+ cursor: auto;
963
+ color: var(--md-default-fg-color);
964
+ font-weight: 700;
965
+ white-space: normal;
966
+ line-height: 1rem;
967
+ height: auto;
968
+ display: flex;
969
+ flex-flow: column;
970
+ row-gap: 1.6rem;
971
+ padding: 1.2rem .8rem .8rem;
972
+ background-color: var(--md-default-bg-color);
973
+ }
974
+ .md-nav--primary .md-nav__title~.md-nav__list {
975
+ box-shadow: none;
976
+ }
977
+ .md-nav--primary .md-nav__title ~ .md-nav__list > :first-child {
978
+ border-top: none;
979
+ }
980
+ .md-nav--primary .md-nav__title .md-nav__button {
981
+ display: none;
982
+ }
983
+ .md-nav--primary .md-nav__title .md-nav__icon {
984
+ color: var(--md-default-fg-color);
985
+ position: static;
986
+ height: auto;
987
+ margin: 0 0 0 -0.2rem;
988
+ }
989
+ .md-nav--primary > .md-nav__title [for="none"] {
990
+ padding-top: 0;
991
+ }
992
+ .md-nav--primary .md-nav__item {
993
+ border-top: none;
994
+ }
995
+ .md-nav--primary :is(.md-nav__title,.md-nav__item) {
996
+ font-size : var(--md-typeset-font-size);
997
+ }
998
+ .md-nav .md-source {
999
+ display: none;
1000
+ }
1001
+
1002
+ .md-sidebar {
1003
+ height: 100%;
1004
+ }
1005
+ .md-sidebar--primary {
1006
+ width: 12.1rem !important;
1007
+ z-index: 200;
1008
+ left: ${sidebar.isPinned ? "calc(-12.1rem + 242px)" : "calc(-12.1rem + 72px)"} !important;
1009
+ }
1010
+ .md-sidebar--secondary:not([hidden]) {
1011
+ display: none;
1012
+ }
1013
+
1014
+ .md-content {
1015
+ max-width: 100%;
1016
+ margin-left: 0;
1017
+ }
1018
+
1019
+ .md-header__button {
1020
+ margin: 0.4rem 0;
1021
+ margin-left: 0.4rem;
1022
+ padding: 0;
1023
+ }
1024
+
1025
+ .md-overlay {
1026
+ left: 0;
1027
+ }
1028
+
1029
+ .md-footer {
1030
+ position: static;
1031
+ padding-left: 0;
1032
+ }
1033
+ .md-footer-nav__link {
1034
+ /* footer links begin to overlap at small sizes without setting width */
1035
+ width: 50%;
1036
+ }
1037
+ }
1038
+
1039
+ @media screen and (max-width: 600px) {
1040
+ .md-sidebar--primary {
1041
+ left: -12.1rem !important;
1042
+ width: 12.1rem;
1043
+ }
1044
+ }
1045
+ `;
1046
+
1047
+ const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
1048
+ var typeset = ({ theme }) => `
1049
+ /*================== Typeset ==================*/
1050
+
1051
+ .md-typeset {
1052
+ font-size: var(--md-typeset-font-size);
1053
+ }
1054
+
1055
+ ${headings.reduce((style, heading) => {
1056
+ const styles = theme.typography[heading];
1057
+ const { lineHeight, fontFamily, fontWeight, fontSize } = styles;
1058
+ const calculate = (value) => {
1059
+ let factor = 1;
1060
+ if (typeof value === "number") {
1061
+ factor = value / 16 * 0.6;
1062
+ }
1063
+ if (typeof value === "string") {
1064
+ factor = value.replace("rem", "");
1065
+ }
1066
+ return `calc(${factor} * var(--md-typeset-font-size))`;
1067
+ };
1068
+ return style.concat(`
1069
+ .md-typeset ${heading} {
1070
+ color: var(--md-default-fg-color);
1071
+ line-height: ${lineHeight};
1072
+ font-family: ${fontFamily};
1073
+ font-weight: ${fontWeight};
1074
+ font-size: ${calculate(fontSize)};
1075
+ }
1076
+ `);
1077
+ }, "")}
1078
+
1079
+ .md-typeset .md-content__button {
1080
+ color: var(--md-default-fg-color);
1081
+ }
1082
+
1083
+ .md-typeset hr {
1084
+ border-bottom: 0.05rem dotted ${theme.palette.divider};
1085
+ }
1086
+
1087
+ .md-typeset details {
1088
+ font-size: var(--md-typeset-font-size) !important;
1089
+ }
1090
+ .md-typeset details summary {
1091
+ padding-left: 2.5rem !important;
1092
+ }
1093
+ .md-typeset details summary:before,
1094
+ .md-typeset details summary:after {
1095
+ top: 50% !important;
1096
+ width: 20px !important;
1097
+ height: 20px !important;
1098
+ transform: rotate(0deg) translateY(-50%) !important;
1099
+ }
1100
+ .md-typeset details[open] > summary:after {
1101
+ transform: rotate(90deg) translateX(-50%) !important;
1102
+ }
1103
+
1104
+ .md-typeset blockquote {
1105
+ color: var(--md-default-fg-color--light);
1106
+ border-left: 0.2rem solid var(--md-default-fg-color--light);
1107
+ }
1108
+
1109
+ .md-typeset table:not([class]) {
1110
+ font-size: var(--md-typeset-font-size);
1111
+ border: 1px solid var(--md-default-fg-color);
1112
+ border-bottom: none;
1113
+ border-collapse: collapse;
1114
+ }
1115
+ .md-typeset table:not([class]) th {
1116
+ font-weight: bold;
1117
+ }
1118
+ .md-typeset table:not([class]) td, .md-typeset table:not([class]) th {
1119
+ border-bottom: 1px solid var(--md-default-fg-color);
1120
+ }
1121
+
1122
+ .md-typeset pre > code::-webkit-scrollbar-thumb {
1123
+ background-color: hsla(0, 0%, 0%, 0.32);
1124
+ }
1125
+ .md-typeset pre > code::-webkit-scrollbar-thumb:hover {
1126
+ background-color: hsla(0, 0%, 0%, 0.87);
1127
+ }
1128
+ `;
1129
+
1130
+ var animations = () => `
1131
+ /*================== Animations ==================*/
1132
+ /*
1133
+ Disable CSS animations on link colors as they lead to issues in dark mode.
1134
+ The dark mode color theme is applied later and theirfore there is always an animation from light to dark mode when navigation between pages.
1135
+ */
1136
+ .md-dialog, .md-nav__link, .md-footer__link, .md-typeset a, .md-typeset a::before, .md-typeset .headerlink {
1137
+ transition: none;
1138
+ }
1139
+ `;
1140
+
1141
+ var extensions = ({ theme }) => `
1142
+ /*================== Extensions ==================*/
1143
+
1144
+ /* HIGHLIGHT */
1145
+ .highlight .md-clipboard:after {
1146
+ content: unset;
1147
+ }
1148
+
1149
+ .highlight .nx {
1150
+ color: ${theme.palette.type === "dark" ? "#ff53a3" : "#ec407a"};
1151
+ }
1152
+
1153
+ /* CODE HILITE */
1154
+ .codehilite .gd {
1155
+ background-color: ${theme.palette.type === "dark" ? "rgba(248,81,73,0.65)" : "#fdd"};
1156
+ }
1157
+
1158
+ .codehilite .gi {
1159
+ background-color: ${theme.palette.type === "dark" ? "rgba(46,160,67,0.65)" : "#dfd"};
1160
+ }
1161
+
1162
+ /* TABBED */
1163
+ .tabbed-set>input:nth-child(1):checked~.tabbed-labels>:nth-child(1),
1164
+ .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
1165
+ .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
1166
+ .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
1167
+ .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
1168
+ .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
1169
+ .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
1170
+ .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
1171
+ .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
1172
+ .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),
1173
+ .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),
1174
+ .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),
1175
+ .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),
1176
+ .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),
1177
+ .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),
1178
+ .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),
1179
+ .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),
1180
+ .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),
1181
+ .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),
1182
+ .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20) {
1183
+ color: var(--md-accent-fg-color);
1184
+ border-color: var(--md-accent-fg-color);
1185
+ }
1186
+
1187
+ /* TASK-LIST */
1188
+ .task-list-control .task-list-indicator::before {
1189
+ background-color: ${theme.palette.action.disabledBackground};
1190
+ }
1191
+ .task-list-control [type="checkbox"]:checked + .task-list-indicator:before {
1192
+ background-color: ${theme.palette.success.main};
1193
+ }
1194
+
1195
+ /* ADMONITION */
1196
+ .admonition {
1197
+ font-size: var(--md-typeset-font-size) !important;
1198
+ }
1199
+ .admonition .admonition-title {
1200
+ padding-left: 2.5rem !important;
1201
+ }
1202
+
1203
+ .admonition .admonition-title:before {
1204
+ top: 50% !important;
1205
+ width: 20px !important;
1206
+ height: 20px !important;
1207
+ transform: translateY(-50%) !important;
1208
+ }
1209
+ `;
1210
+
1211
+ const rules = [
1212
+ variables,
1213
+ reset,
1214
+ layout,
1215
+ typeset,
1216
+ animations,
1217
+ extensions
1218
+ ];
1219
+
1220
+ const useSidebar = () => useSidebarPinState();
1221
+ const useRuleStyles = () => {
1222
+ const sidebar = useSidebar();
1223
+ const theme = useTheme();
1224
+ return useMemo(() => {
1225
+ const options = { theme, sidebar };
1226
+ return rules.reduce((styles, rule) => styles + rule(options), "");
1227
+ }, [theme, sidebar]);
1228
+ };
1229
+ const useStylesTransformer = () => {
1230
+ const styles = useRuleStyles();
1231
+ return useCallback((dom) => {
1232
+ dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1233
+ return dom;
1234
+ }, [styles]);
663
1235
  };
664
1236
 
665
1237
  const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
@@ -887,88 +1459,15 @@ const simplifyMkdocsFooter = () => {
887
1459
  };
888
1460
 
889
1461
  const onCssReady = ({
890
- docStorageUrl,
891
1462
  onLoading,
892
1463
  onLoaded
893
1464
  }) => {
894
1465
  return (dom) => {
895
- const cssPages = Array.from(dom.querySelectorAll('head > link[rel="stylesheet"]')).filter((elem) => {
896
- var _a;
897
- return (_a = elem.getAttribute("href")) == null ? void 0 : _a.startsWith(docStorageUrl);
1466
+ onLoading();
1467
+ dom.addEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, function handleShadowDomStyleLoad() {
1468
+ onLoaded();
1469
+ dom.removeEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, handleShadowDomStyleLoad);
898
1470
  });
899
- let count = cssPages.length;
900
- if (count > 0) {
901
- onLoading(dom);
902
- }
903
- cssPages.forEach((cssPage) => cssPage.addEventListener("load", () => {
904
- count -= 1;
905
- if (count === 0) {
906
- onLoaded(dom);
907
- }
908
- }));
909
- return dom;
910
- };
911
- };
912
-
913
- const TECHDOCS_CSS = /main\.[A-Fa-f0-9]{8}\.min\.css$/;
914
- const GOOGLE_FONTS = /^https:\/\/fonts\.googleapis\.com/;
915
- const GSTATIC_FONTS = /^https:\/\/fonts\.gstatic\.com/;
916
- const safeLinksHook = (node) => {
917
- if (node.nodeName && node.nodeName === "LINK") {
918
- const href = node.getAttribute("href") || "";
919
- if (href.match(TECHDOCS_CSS)) {
920
- node.setAttribute("rel", "stylesheet");
921
- }
922
- if (href.match(GOOGLE_FONTS)) {
923
- node.setAttribute("rel", "stylesheet");
924
- }
925
- if (href.match(GSTATIC_FONTS)) {
926
- node.setAttribute("rel", "preconnect");
927
- }
928
- }
929
- return node;
930
- };
931
- const filterIframeHook = (allowedIframeHosts) => (node) => {
932
- if (node.nodeName === "IFRAME") {
933
- const src = node.getAttribute("src");
934
- if (!src) {
935
- node.remove();
936
- return node;
937
- }
938
- try {
939
- const srcUrl = new URL(src);
940
- const isMatch = allowedIframeHosts.some((host) => srcUrl.host === host);
941
- if (!isMatch) {
942
- node.remove();
943
- }
944
- } catch (error) {
945
- console.warn(`Invalid iframe src, ${error}`);
946
- node.remove();
947
- }
948
- }
949
- return node;
950
- };
951
- const sanitizeDOM = (config) => {
952
- const allowedIframeHosts = (config == null ? void 0 : config.getOptionalStringArray("allowedIframeHosts")) || [];
953
- return (dom) => {
954
- DOMPurify.addHook("afterSanitizeAttributes", safeLinksHook);
955
- const addTags = ["link"];
956
- if (allowedIframeHosts.length > 0) {
957
- DOMPurify.addHook("beforeSanitizeElements", filterIframeHook(allowedIframeHosts));
958
- addTags.push("iframe");
959
- }
960
- return DOMPurify.sanitize(dom.innerHTML, {
961
- ADD_TAGS: addTags,
962
- FORBID_TAGS: ["style"],
963
- WHOLE_DOCUMENT: true,
964
- RETURN_DOM: true
965
- });
966
- };
967
- };
968
-
969
- const injectCss = ({ css }) => {
970
- return (dom) => {
971
- dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${css}</style>`);
972
1471
  return dom;
973
1472
  };
974
1473
  };
@@ -1001,44 +1500,43 @@ const transform = async (html, transformers) => {
1001
1500
  return dom;
1002
1501
  };
1003
1502
 
1004
- const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
1503
+ const MOBILE_MEDIA_QUERY = "screen and (max-width: 76.1875em)";
1005
1504
  const useTechDocsReaderDom = (entityRef) => {
1006
1505
  const navigate = useNavigate$1();
1007
1506
  const theme = useTheme();
1507
+ const isMobileMedia = useMediaQuery(MOBILE_MEDIA_QUERY);
1508
+ const sanitizerTransformer = useSanitizerTransformer();
1509
+ const stylesTransformer = useStylesTransformer();
1008
1510
  const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
1009
1511
  const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
1010
- const techdocsSanitizer = useApi(configApiRef);
1011
- const { namespace, kind, name } = entityRef;
1012
1512
  const { state, path, content: rawPage } = useTechDocsReader();
1013
- const isDarkTheme = theme.palette.type === "dark";
1014
- const [sidebars, setSidebars] = useState();
1015
1513
  const [dom, setDom] = useState(null);
1016
- const { isPinned } = useContext(SidebarPinStateContext);
1514
+ const isStyleLoading = useShadowDomStylesLoading(dom);
1017
1515
  const updateSidebarPosition = useCallback(() => {
1018
- if (!dom || !sidebars)
1516
+ if (!dom)
1019
1517
  return;
1020
- const mdTabs = dom.querySelector(".md-container > .md-tabs");
1021
- const sidebarsCollapsed = window.matchMedia("screen and (max-width: 76.1875em)").matches;
1022
- const newTop = Math.max(dom.getBoundingClientRect().top, 0);
1023
- sidebars.forEach((sidebar) => {
1024
- if (sidebarsCollapsed) {
1025
- sidebar.style.top = "0px";
1026
- } else if (mdTabs) {
1027
- sidebar.style.top = `${newTop + mdTabs.getBoundingClientRect().height}px`;
1518
+ const sidebars = dom.querySelectorAll(".md-sidebar");
1519
+ sidebars.forEach((element) => {
1520
+ var _a, _b;
1521
+ if (isMobileMedia) {
1522
+ element.style.top = "0px";
1028
1523
  } else {
1029
- sidebar.style.top = `${newTop}px`;
1524
+ const domTop = (_a = dom.getBoundingClientRect().top) != null ? _a : 0;
1525
+ const tabs = dom.querySelector(".md-container > .md-tabs");
1526
+ const tabsHeight = (_b = tabs == null ? void 0 : tabs.getBoundingClientRect().height) != null ? _b : 0;
1527
+ element.style.top = `${Math.max(domTop, 0) + tabsHeight}px`;
1030
1528
  }
1529
+ element.style.setProperty("opacity", "1");
1031
1530
  });
1032
- }, [dom, sidebars]);
1531
+ }, [dom, isMobileMedia]);
1033
1532
  useEffect(() => {
1034
- updateSidebarPosition();
1035
- window.addEventListener("scroll", updateSidebarPosition, true);
1036
1533
  window.addEventListener("resize", updateSidebarPosition);
1534
+ window.addEventListener("scroll", updateSidebarPosition, true);
1037
1535
  return () => {
1038
- window.removeEventListener("scroll", updateSidebarPosition, true);
1039
1536
  window.removeEventListener("resize", updateSidebarPosition);
1537
+ window.removeEventListener("scroll", updateSidebarPosition, true);
1040
1538
  };
1041
- }, [updateSidebarPosition, state]);
1539
+ }, [dom, updateSidebarPosition]);
1042
1540
  const updateFooterWidth = useCallback(() => {
1043
1541
  if (!dom)
1044
1542
  return;
@@ -1048,21 +1546,22 @@ const useTechDocsReaderDom = (entityRef) => {
1048
1546
  }
1049
1547
  }, [dom]);
1050
1548
  useEffect(() => {
1051
- updateFooterWidth();
1052
1549
  window.addEventListener("resize", updateFooterWidth);
1053
1550
  return () => {
1054
1551
  window.removeEventListener("resize", updateFooterWidth);
1055
1552
  };
1056
- });
1553
+ }, [dom, updateFooterWidth]);
1554
+ useEffect(() => {
1555
+ if (!isStyleLoading) {
1556
+ updateFooterWidth();
1557
+ updateSidebarPosition();
1558
+ }
1559
+ }, [state, isStyleLoading, updateFooterWidth, updateSidebarPosition]);
1057
1560
  const preRender = useCallback((rawContent, contentPath) => transform(rawContent, [
1058
- sanitizeDOM(techdocsSanitizer.getOptionalConfig("techdocs.sanitizer")),
1561
+ sanitizerTransformer,
1059
1562
  addBaseUrl({
1060
1563
  techdocsStorageApi,
1061
- entityId: {
1062
- kind,
1063
- name,
1064
- namespace
1065
- },
1564
+ entityId: entityRef,
1066
1565
  path: contentPath
1067
1566
  }),
1068
1567
  rewriteDocLinks(),
@@ -1070,487 +1569,13 @@ const useTechDocsReaderDom = (entityRef) => {
1070
1569
  removeMkdocsHeader(),
1071
1570
  simplifyMkdocsFooter(),
1072
1571
  addGitFeedbackLink(scmIntegrationsApi),
1073
- injectCss({
1074
- css: `
1075
- /*
1076
- As the MkDocs output is rendered in shadow DOM, the CSS variable definitions on the root selector are not applied. Instead, they have to be applied on :host.
1077
- As there is no way to transform the served main*.css yet (for example in the backend), we have to copy from main*.css and modify them.
1078
- */
1079
- :host {
1080
- /* FONT */
1081
- --md-default-fg-color: ${theme.palette.text.primary};
1082
- --md-default-fg-color--light: ${theme.palette.text.secondary};
1083
- --md-default-fg-color--lighter: ${lighten(theme.palette.text.secondary, 0.7)};
1084
- --md-default-fg-color--lightest: ${lighten(theme.palette.text.secondary, 0.3)};
1085
-
1086
- /* BACKGROUND */
1087
- --md-default-bg-color:${theme.palette.background.default};
1088
- --md-default-bg-color--light: ${theme.palette.background.paper};
1089
- --md-default-bg-color--lighter: ${lighten(theme.palette.background.paper, 0.7)};
1090
- --md-default-bg-color--lightest: ${lighten(theme.palette.background.paper, 0.3)};
1091
-
1092
- /* PRIMARY */
1093
- --md-primary-fg-color: ${theme.palette.primary.main};
1094
- --md-primary-fg-color--light: ${theme.palette.primary.light};
1095
- --md-primary-fg-color--dark: ${theme.palette.primary.dark};
1096
- --md-primary-bg-color: ${theme.palette.primary.contrastText};
1097
- --md-primary-bg-color--light: ${lighten(theme.palette.primary.contrastText, 0.7)};
1098
-
1099
- /* ACCENT */
1100
- --md-accent-fg-color: var(--md-primary-fg-color);
1101
-
1102
- /* SHADOW */
1103
- --md-shadow-z1: ${theme.shadows[1]};
1104
- --md-shadow-z2: ${theme.shadows[2]};
1105
- --md-shadow-z3: ${theme.shadows[3]};
1106
-
1107
- /* EXTENSIONS */
1108
- --md-admonition-fg-color: var(--md-default-fg-color);
1109
- --md-admonition-bg-color: var(--md-default-bg-color);
1110
- /* Admonitions and others are using SVG masks to define icons. These masks are defined as CSS variables. */
1111
- --md-admonition-icon--note: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>');
1112
- --md-admonition-icon--abstract: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 5h16v2H4V5m0 4h16v2H4V9m0 4h16v2H4v-2m0 4h10v2H4v-2z"/></svg>');
1113
- --md-admonition-icon--info: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10A10 10 0 0012 2z"/></svg>');
1114
- --md-admonition-icon--tip: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.55 11.2c-.23-.3-.5-.56-.76-.82-.65-.6-1.4-1.03-2.03-1.66C13.3 7.26 13 4.85 13.91 3c-.91.23-1.75.75-2.45 1.32-2.54 2.08-3.54 5.75-2.34 8.9.04.1.08.2.08.33 0 .22-.15.42-.35.5-.22.1-.46.04-.64-.12a.83.83 0 01-.15-.17c-1.1-1.43-1.28-3.48-.53-5.12C5.89 10 5 12.3 5.14 14.47c.04.5.1 1 .27 1.5.14.6.4 1.2.72 1.73 1.04 1.73 2.87 2.97 4.84 3.22 2.1.27 4.35-.12 5.96-1.6 1.8-1.66 2.45-4.32 1.5-6.6l-.13-.26c-.2-.46-.47-.87-.8-1.25l.05-.01m-3.1 6.3c-.28.24-.73.5-1.08.6-1.1.4-2.2-.16-2.87-.82 1.19-.28 1.89-1.16 2.09-2.05.17-.8-.14-1.46-.27-2.23-.12-.74-.1-1.37.18-2.06.17.38.37.76.6 1.06.76 1 1.95 1.44 2.2 2.8.04.14.06.28.06.43.03.82-.32 1.72-.92 2.27h.01z"/></svg>');
1115
- --md-admonition-icon--success: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
1116
- --md-admonition-icon--question: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.07 11.25l-.9.92C13.45 12.89 13 13.5 13 15h-2v-.5c0-1.11.45-2.11 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41a2 2 0 00-2-2 2 2 0 00-2 2H8a4 4 0 014-4 4 4 0 014 4 3.2 3.2 0 01-.93 2.25M13 19h-2v-2h2M12 2A10 10 0 002 12a10 10 0 0010 10 10 10 0 0010-10c0-5.53-4.5-10-10-10z"/></svg>');
1117
- --md-admonition-icon--warning: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14h-2v-4h2m0 8h-2v-2h2M1 21h22L12 2 1 21z"/></svg>');
1118
- --md-admonition-icon--failure: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12 6.47 2 12 2m3.59 5L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41 15.59 7z"/></svg>');
1119
- --md-admonition-icon--danger: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.5 20l4.86-9.73H13V4l-5 9.73h3.5V20M12 2c2.75 0 5.1 1 7.05 2.95C21 6.9 22 9.25 22 12s-1 5.1-2.95 7.05C17.1 21 14.75 22 12 22s-5.1-1-7.05-2.95C3 17.1 2 14.75 2 12s1-5.1 2.95-7.05C6.9 3 9.25 2 12 2z"/></svg>');
1120
- --md-admonition-icon--bug: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 12h-4v-2h4m0 6h-4v-2h4m6-6h-2.81a5.985 5.985 0 00-1.82-1.96L17 4.41 15.59 3l-2.17 2.17a6.002 6.002 0 00-2.83 0L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8z"/></svg>');
1121
- --md-admonition-icon--example: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 01.75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25z"/></svg>');
1122
- --md-admonition-icon--quote: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4z"/></svg>');
1123
- --md-footnotes-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.42L5.83 13H21V7h-2z"/></svg>');
1124
- --md-details-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
1125
- --md-tasklist-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg>');
1126
- --md-tasklist-icon--checked: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
1127
- --md-nav-icon--prev: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>');
1128
- --md-nav-icon--next: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>');
1129
- --md-toc-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>');
1130
- --md-clipboard-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1z"/></svg>');
1131
- --md-search-result-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h7c-.41-.25-.8-.56-1.14-.9-.33-.33-.61-.7-.86-1.1H6V4h7v5h5v1.18c.71.16 1.39.43 2 .82V8l-6-6m6.31 16.9c1.33-2.11.69-4.9-1.4-6.22-2.11-1.33-4.91-.68-6.22 1.4-1.34 2.11-.69 4.89 1.4 6.22 1.46.93 3.32.93 4.79.02L22 23.39 23.39 22l-3.08-3.1m-3.81.1a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5z"/></svg>');
1132
- --md-source-forks-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5z"/></svg>');
1133
- --md-source-repositories-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 1 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 0 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 0 1 1-1h8zM5 12.25v3.25a.25.25 0 0 0 .4.2l1.45-1.087a.25.25 0 0 1 .3 0L8.6 15.7a.25.25 0 0 0 .4-.2v-3.25a.25.25 0 0 0-.25-.25h-3.5a.25.25 0 0 0-.25.25z"/></svg>');
1134
- --md-source-stars-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.75.75 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694v.001z"/></svg>');
1135
- --md-source-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 0 1 .25-.25h5.025a.25.25 0 0 1 .177.073l6.25 6.25a.25.25 0 0 1 0 .354l-5.025 5.025a.25.25 0 0 1-.354 0l-6.25-6.25a.25.25 0 0 1-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 0 1 0 2.474l-5.026 5.026a1.75 1.75 0 0 1-2.474 0l-6.25-6.25A1.75 1.75 0 0 1 1 7.775zM6 5a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>');
1136
- --md-version-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="m310.6 246.6-127.1 128c-7.1 6.3-15.3 9.4-23.5 9.4s-16.38-3.125-22.63-9.375l-127.1-128C.224 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75s3.12 25.75-6.08 34.85z"/></svg>');
1137
- }
1138
-
1139
- :host > * {
1140
- /* CODE */
1141
- --md-code-fg-color: ${theme.palette.text.primary};
1142
- --md-code-bg-color: ${theme.palette.background.paper};
1143
- --md-code-hl-color: ${alpha(theme.palette.warning.main, 0.5)};
1144
- --md-code-hl-keyword-color: ${isDarkTheme ? theme.palette.primary.light : theme.palette.primary.dark};
1145
- --md-code-hl-function-color: ${isDarkTheme ? theme.palette.secondary.light : theme.palette.secondary.dark};
1146
- --md-code-hl-string-color: ${isDarkTheme ? theme.palette.success.light : theme.palette.success.dark};
1147
- --md-code-hl-number-color: ${isDarkTheme ? theme.palette.error.light : theme.palette.error.dark};
1148
- --md-code-hl-constant-color: var(--md-code-hl-function-color);
1149
- --md-code-hl-special-color: var(--md-code-hl-function-color);
1150
- --md-code-hl-name-color: var(--md-code-fg-color);
1151
- --md-code-hl-comment-color: var(--md-default-fg-color--light);
1152
- --md-code-hl-generic-color: var(--md-default-fg-color--light);
1153
- --md-code-hl-variable-color: var(--md-default-fg-color--light);
1154
- --md-code-hl-operator-color: var(--md-default-fg-color--light);
1155
- --md-code-hl-punctuation-color: var(--md-default-fg-color--light);
1156
-
1157
- /* TYPESET */
1158
- --md-typeset-font-size: 1rem;
1159
- --md-typeset-color: var(--md-default-fg-color);
1160
- --md-typeset-a-color: var(--md-accent-fg-color);
1161
- --md-typeset-table-color: ${theme.palette.text.primary};
1162
- --md-typeset-del-color: ${isDarkTheme ? alpha(theme.palette.error.dark, 0.5) : alpha(theme.palette.error.light, 0.5)};
1163
- --md-typeset-ins-color: ${isDarkTheme ? alpha(theme.palette.success.dark, 0.5) : alpha(theme.palette.success.light, 0.5)};
1164
- --md-typeset-mark-color: ${isDarkTheme ? alpha(theme.palette.warning.dark, 0.5) : alpha(theme.palette.warning.light, 0.5)};
1165
- }
1166
-
1167
- @media screen and (max-width: 76.1875em) {
1168
- :host > * {
1169
- /* TYPESET */
1170
- --md-typeset-font-size: .9rem;
1171
- }
1172
- }
1173
-
1174
- @media screen and (max-width: 600px) {
1175
- :host > * {
1176
- /* TYPESET */
1177
- --md-typeset-font-size: .7rem;
1178
- }
1179
- }
1180
- `
1181
- }),
1182
- injectCss({
1183
- css: `
1184
- body {
1185
- --md-text-color: var(--md-default-fg-color);
1186
- --md-text-link-color: var(--md-accent-fg-color);
1187
- --md-text-font-family: ${theme.typography.fontFamily};
1188
- font-family: var(--md-text-font-family);
1189
- background-color: unset;
1190
- }
1191
- `
1192
- }),
1193
- injectCss({
1194
- css: `
1195
- .md-grid {
1196
- max-width: 100%;
1197
- margin: 0;
1198
- }
1199
-
1200
- .md-nav {
1201
- font-size: calc(var(--md-typeset-font-size) * 0.9);
1202
- }
1203
- .md-nav__link {
1204
- display: flex;
1205
- align-items: center;
1206
- justify-content: space-between;
1207
- }
1208
- .md-nav__icon {
1209
- height: 20px !important;
1210
- width: 20px !important;
1211
- margin-left:${theme.spacing(1)}px;
1212
- }
1213
- .md-nav__icon svg {
1214
- margin: 0;
1215
- width: 20px !important;
1216
- height: 20px !important;
1217
- }
1218
- .md-nav__icon:after {
1219
- width: 20px !important;
1220
- height: 20px !important;
1221
- }
1222
-
1223
- .md-main__inner {
1224
- margin-top: 0;
1225
- }
1226
-
1227
- .md-sidebar {
1228
- bottom: 75px;
1229
- position: fixed;
1230
- width: 16rem;
1231
- overflow-y: auto;
1232
- overflow-x: hidden;
1233
- scrollbar-color: rgb(193, 193, 193) #eee;
1234
- scrollbar-width: thin;
1235
- }
1236
- .md-sidebar .md-sidebar__scrollwrap {
1237
- width: calc(16rem - 10px);
1238
- }
1239
- .md-sidebar--secondary {
1240
- right: ${theme.spacing(3)}px;
1241
- }
1242
- .md-sidebar::-webkit-scrollbar {
1243
- width: 5px;
1244
- }
1245
- .md-sidebar::-webkit-scrollbar-button {
1246
- width: 5px;
1247
- height: 5px;
1248
- }
1249
- .md-sidebar::-webkit-scrollbar-track {
1250
- background: #eee;
1251
- border: 1 px solid rgb(250, 250, 250);
1252
- box-shadow: 0px 0px 3px #dfdfdf inset;
1253
- border-radius: 3px;
1254
- }
1255
- .md-sidebar::-webkit-scrollbar-thumb {
1256
- width: 5px;
1257
- background: rgb(193, 193, 193);
1258
- border: transparent;
1259
- border-radius: 3px;
1260
- }
1261
- .md-sidebar::-webkit-scrollbar-thumb:hover {
1262
- background: rgb(125, 125, 125);
1263
- }
1264
-
1265
- .md-content {
1266
- max-width: calc(100% - 16rem * 2);
1267
- margin-left: 16rem;
1268
- margin-bottom: 50px;
1269
- }
1270
-
1271
- .md-footer {
1272
- position: fixed;
1273
- bottom: 0px;
1274
- }
1275
- .md-footer__title {
1276
- background-color: unset;
1277
- }
1278
- .md-footer-nav__link {
1279
- width: 16rem;
1280
- }
1281
-
1282
- .md-dialog {
1283
- background-color: unset;
1284
- }
1285
-
1286
- @media screen and (min-width: 76.25em) {
1287
- .md-sidebar {
1288
- height: auto;
1289
- }
1290
- }
1291
-
1292
- @media screen and (max-width: 76.1875em) {
1293
- .md-nav {
1294
- transition: none !important;
1295
- background-color: var(--md-default-bg-color)
1296
- }
1297
- .md-nav--primary .md-nav__title {
1298
- cursor: auto;
1299
- color: var(--md-default-fg-color);
1300
- font-weight: 700;
1301
- white-space: normal;
1302
- line-height: 1rem;
1303
- height: auto;
1304
- display: flex;
1305
- flex-flow: column;
1306
- row-gap: 1.6rem;
1307
- padding: 1.2rem .8rem .8rem;
1308
- background-color: var(--md-default-bg-color);
1309
- }
1310
- .md-nav--primary .md-nav__title~.md-nav__list {
1311
- box-shadow: none;
1312
- }
1313
- .md-nav--primary .md-nav__title ~ .md-nav__list > :first-child {
1314
- border-top: none;
1315
- }
1316
- .md-nav--primary .md-nav__title .md-nav__button {
1317
- display: none;
1318
- }
1319
- .md-nav--primary .md-nav__title .md-nav__icon {
1320
- color: var(--md-default-fg-color);
1321
- position: static;
1322
- height: auto;
1323
- margin: 0 0 0 -0.2rem;
1324
- }
1325
- .md-nav--primary > .md-nav__title [for="none"] {
1326
- padding-top: 0;
1327
- }
1328
- .md-nav--primary .md-nav__item {
1329
- border-top: none;
1330
- }
1331
- .md-nav--primary :is(.md-nav__title,.md-nav__item) {
1332
- font-size : var(--md-typeset-font-size);
1333
- }
1334
- .md-nav .md-source {
1335
- display: none;
1336
- }
1337
-
1338
- .md-sidebar {
1339
- height: 100%;
1340
- }
1341
- .md-sidebar--primary {
1342
- width: 12.1rem !important;
1343
- z-index: 200;
1344
- left: ${isPinned ? "calc(-12.1rem + 242px)" : "calc(-12.1rem + 72px)"} !important;
1345
- }
1346
- .md-sidebar--secondary:not([hidden]) {
1347
- display: none;
1348
- }
1349
-
1350
- .md-content {
1351
- max-width: 100%;
1352
- margin-left: 0;
1353
- }
1354
-
1355
- .md-header__button {
1356
- margin: 0.4rem 0;
1357
- margin-left: 0.4rem;
1358
- padding: 0;
1359
- }
1360
-
1361
- .md-overlay {
1362
- left: 0;
1363
- }
1364
-
1365
- .md-footer {
1366
- position: static;
1367
- padding-left: 0;
1368
- }
1369
- .md-footer-nav__link {
1370
- /* footer links begin to overlap at small sizes without setting width */
1371
- width: 50%;
1372
- }
1373
- }
1374
-
1375
- @media screen and (max-width: 600px) {
1376
- .md-sidebar--primary {
1377
- left: -12.1rem !important;
1378
- width: 12.1rem;
1379
- }
1380
- }
1381
- `
1382
- }),
1383
- injectCss({
1384
- css: `
1385
- .md-typeset {
1386
- font-size: var(--md-typeset-font-size);
1387
- }
1388
-
1389
- ${headings.reduce((style, heading) => {
1390
- const styles = theme.typography[heading];
1391
- const { lineHeight, fontFamily, fontWeight, fontSize } = styles;
1392
- const calculate = (value) => {
1393
- let factor = 1;
1394
- if (typeof value === "number") {
1395
- factor = value / 16 * 0.6;
1396
- }
1397
- if (typeof value === "string") {
1398
- factor = value.replace("rem", "");
1399
- }
1400
- return `calc(${factor} * var(--md-typeset-font-size))`;
1401
- };
1402
- return style.concat(`
1403
- .md-typeset ${heading} {
1404
- color: var(--md-default-fg-color);
1405
- line-height: ${lineHeight};
1406
- font-family: ${fontFamily};
1407
- font-weight: ${fontWeight};
1408
- font-size: ${calculate(fontSize)};
1409
- }
1410
- `);
1411
- }, "")}
1412
-
1413
- .md-typeset .md-content__button {
1414
- color: var(--md-default-fg-color);
1415
- }
1416
-
1417
- .md-typeset hr {
1418
- border-bottom: 0.05rem dotted ${theme.palette.divider};
1419
- }
1420
-
1421
- .md-typeset details {
1422
- font-size: var(--md-typeset-font-size) !important;
1423
- }
1424
- .md-typeset details summary {
1425
- padding-left: 2.5rem !important;
1426
- }
1427
- .md-typeset details summary:before,
1428
- .md-typeset details summary:after {
1429
- top: 50% !important;
1430
- width: 20px !important;
1431
- height: 20px !important;
1432
- transform: rotate(0deg) translateY(-50%) !important;
1433
- }
1434
- .md-typeset details[open] > summary:after {
1435
- transform: rotate(90deg) translateX(-50%) !important;
1436
- }
1437
-
1438
- .md-typeset blockquote {
1439
- color: var(--md-default-fg-color--light);
1440
- border-left: 0.2rem solid var(--md-default-fg-color--light);
1441
- }
1442
-
1443
- .md-typeset table:not([class]) {
1444
- font-size: var(--md-typeset-font-size);
1445
- border: 1px solid var(--md-default-fg-color);
1446
- border-bottom: none;
1447
- border-collapse: collapse;
1448
- }
1449
- .md-typeset table:not([class]) th {
1450
- font-weight: bold;
1451
- }
1452
- .md-typeset table:not([class]) td, .md-typeset table:not([class]) th {
1453
- border-bottom: 1px solid var(--md-default-fg-color);
1454
- }
1455
-
1456
- .md-typeset pre > code::-webkit-scrollbar-thumb {
1457
- background-color: hsla(0, 0%, 0%, 0.32);
1458
- }
1459
- .md-typeset pre > code::-webkit-scrollbar-thumb:hover {
1460
- background-color: hsla(0, 0%, 0%, 0.87);
1461
- }
1462
- `
1463
- }),
1464
- injectCss({
1465
- css: `
1466
- /*
1467
- Disable CSS animations on link colors as they lead to issues in dark mode.
1468
- The dark mode color theme is applied later and theirfore there is always an animation from light to dark mode when navigation between pages.
1469
- */
1470
- .md-dialog, .md-nav__link, .md-footer__link, .md-typeset a, .md-typeset a::before, .md-typeset .headerlink {
1471
- transition: none;
1472
- }
1473
- `
1474
- }),
1475
- injectCss({
1476
- css: `
1477
- /* HIGHLIGHT */
1478
- .highlight .md-clipboard:after {
1479
- content: unset;
1480
- }
1481
-
1482
- .highlight .nx {
1483
- color: ${isDarkTheme ? "#ff53a3" : "#ec407a"};
1484
- }
1485
-
1486
- /* CODE HILITE */
1487
- .codehilite .gd {
1488
- background-color: ${isDarkTheme ? "rgba(248,81,73,0.65)" : "#fdd"};
1489
- }
1490
-
1491
- .codehilite .gi {
1492
- background-color: ${isDarkTheme ? "rgba(46,160,67,0.65)" : "#dfd"};
1493
- }
1494
-
1495
- /* TABBED */
1496
- .tabbed-set>input:nth-child(1):checked~.tabbed-labels>:nth-child(1),
1497
- .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
1498
- .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
1499
- .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
1500
- .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
1501
- .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
1502
- .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
1503
- .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
1504
- .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
1505
- .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),
1506
- .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),
1507
- .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),
1508
- .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),
1509
- .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),
1510
- .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),
1511
- .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),
1512
- .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),
1513
- .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),
1514
- .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),
1515
- .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20) {
1516
- color: var(--md-accent-fg-color);
1517
- border-color: var(--md-accent-fg-color);
1518
- }
1519
-
1520
- /* TASK-LIST */
1521
- .task-list-control .task-list-indicator::before {
1522
- background-color: ${theme.palette.action.disabledBackground};
1523
- }
1524
- .task-list-control [type="checkbox"]:checked + .task-list-indicator:before {
1525
- background-color: ${theme.palette.success.main};
1526
- }
1527
-
1528
- /* ADMONITION */
1529
- .admonition {
1530
- font-size: var(--md-typeset-font-size) !important;
1531
- }
1532
- .admonition .admonition-title {
1533
- padding-left: 2.5rem !important;
1534
- }
1535
-
1536
- .admonition .admonition-title:before {
1537
- top: 50% !important;
1538
- width: 20px !important;
1539
- height: 20px !important;
1540
- transform: translateY(-50%) !important;
1541
- }
1542
- `
1543
- })
1572
+ stylesTransformer
1544
1573
  ]), [
1545
- kind,
1546
- name,
1547
- namespace,
1574
+ entityRef,
1548
1575
  scmIntegrationsApi,
1549
- techdocsSanitizer,
1550
1576
  techdocsStorageApi,
1551
- theme,
1552
- isDarkTheme,
1553
- isPinned
1577
+ sanitizerTransformer,
1578
+ stylesTransformer
1554
1579
  ]);
1555
1580
  const postRender = useCallback(async (transformedElement) => transform(transformedElement, [
1556
1581
  scrollIntoAnchor(),
@@ -1578,18 +1603,24 @@ const useTechDocsReaderDom = (entityRef) => {
1578
1603
  }
1579
1604
  }),
1580
1605
  onCssReady({
1581
- docStorageUrl: await techdocsStorageApi.getApiOrigin(),
1582
- onLoading: (renderedElement) => {
1583
- renderedElement.style.setProperty("opacity", "0");
1606
+ onLoading: () => {
1584
1607
  },
1585
- onLoaded: (renderedElement) => {
1608
+ onLoaded: () => {
1586
1609
  var _a;
1587
- renderedElement.style.removeProperty("opacity");
1588
- (_a = renderedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1589
- setSidebars(Array.from(renderedElement.querySelectorAll(".md-sidebar")));
1610
+ (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1611
+ }
1612
+ }),
1613
+ onCssReady({
1614
+ onLoading: () => {
1615
+ const sidebars = Array.from(transformedElement.querySelectorAll(".md-sidebar"));
1616
+ sidebars.forEach((element) => {
1617
+ element.style.setProperty("opacity", "0");
1618
+ });
1619
+ },
1620
+ onLoaded: () => {
1590
1621
  }
1591
1622
  })
1592
- ]), [theme, navigate, techdocsStorageApi]);
1623
+ ]), [theme, navigate]);
1593
1624
  useEffect(() => {
1594
1625
  if (!rawPage)
1595
1626
  return () => {
@@ -1613,6 +1644,33 @@ const useTechDocsReaderDom = (entityRef) => {
1613
1644
  return dom;
1614
1645
  };
1615
1646
 
1647
+ const TechDocsReaderPageContentAddons = () => {
1648
+ const addons = useTechDocsAddons();
1649
+ const { shadowRoot } = useTechDocsReaderPage();
1650
+ const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('[data-md-component="content"]');
1651
+ const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]');
1652
+ let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector('[data-techdocs-addons-location="primary sidebar"]');
1653
+ if (!primarySidebarAddonLocation) {
1654
+ primarySidebarAddonLocation = document.createElement("div");
1655
+ primarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "primary sidebar");
1656
+ primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1657
+ }
1658
+ const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]');
1659
+ let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector('[data-techdocs-addons-location="secondary sidebar"]');
1660
+ if (!secondarySidebarAddonLocation) {
1661
+ secondarySidebarAddonLocation = document.createElement("div");
1662
+ secondarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "secondary sidebar");
1663
+ secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1664
+ }
1665
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, {
1666
+ container: primarySidebarAddonLocation
1667
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, {
1668
+ container: contentElement
1669
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, {
1670
+ container: secondarySidebarAddonLocation
1671
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar)));
1672
+ };
1673
+
1616
1674
  const useStyles$1 = makeStyles({
1617
1675
  search: {
1618
1676
  width: "100%",
@@ -1623,43 +1681,21 @@ const useStyles$1 = makeStyles({
1623
1681
  }
1624
1682
  });
1625
1683
  const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
1684
+ var _a;
1626
1685
  const { withSearch = true, onReady } = props;
1627
1686
  const classes = useStyles$1();
1628
- const addons = useTechDocsAddons();
1629
1687
  const {
1630
1688
  entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1631
1689
  entityRef,
1632
- shadowRoot,
1633
1690
  setShadowRoot
1634
1691
  } = useTechDocsReaderPage();
1635
1692
  const dom = useTechDocsReaderDom(entityRef);
1636
- const [jss, setJss] = useState(create({
1637
- ...jssPreset(),
1638
- insertionPoint: void 0
1639
- }));
1640
- const ref = useCallback((shadowHost) => {
1641
- var _a;
1642
- if (!dom || !shadowHost)
1643
- return;
1644
- setJss(create({
1645
- ...jssPreset(),
1646
- insertionPoint: dom.querySelector("head") || void 0
1647
- }));
1648
- const newShadowRoot = (_a = shadowHost.shadowRoot) != null ? _a : shadowHost.attachShadow({ mode: "open" });
1649
- newShadowRoot.innerHTML = "";
1650
- newShadowRoot.appendChild(dom);
1693
+ const handleAppend = useCallback((newShadowRoot) => {
1651
1694
  setShadowRoot(newShadowRoot);
1652
1695
  if (onReady instanceof Function) {
1653
1696
  onReady();
1654
1697
  }
1655
- }, [dom, setShadowRoot, onReady]);
1656
- const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('[data-md-component="content"]');
1657
- const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]');
1658
- const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]');
1659
- const primarySidebarAddonLocation = document.createElement("div");
1660
- primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1661
- const secondarySidebarAddonLocation = document.createElement("div");
1662
- secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1698
+ }, [setShadowRoot, onReady]);
1663
1699
  if (entityMetadataLoading === false && !entityMetadata)
1664
1700
  return /* @__PURE__ */ React.createElement(ErrorPage, {
1665
1701
  status: "404",
@@ -1683,23 +1719,15 @@ const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
1683
1719
  xs: "auto",
1684
1720
  item: true
1685
1721
  }, /* @__PURE__ */ React.createElement(TechDocsSearch, {
1686
- entityId: entityRef
1722
+ entityId: entityRef,
1723
+ entityTitle: (_a = entityMetadata == null ? void 0 : entityMetadata.metadata) == null ? void 0 : _a.title
1687
1724
  })), /* @__PURE__ */ React.createElement(Grid, {
1688
1725
  xs: 12,
1689
1726
  item: true
1690
- }, /* @__PURE__ */ React.createElement(StylesProvider, {
1691
- jss,
1692
- sheetsManager: /* @__PURE__ */ new Map()
1693
- }, /* @__PURE__ */ React.createElement("div", {
1694
- ref,
1695
- "data-testid": "techdocs-native-shadowroot"
1696
- }), /* @__PURE__ */ React.createElement(Portal, {
1697
- container: primarySidebarAddonLocation
1698
- }, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, {
1699
- container: contentElement
1700
- }, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, {
1701
- container: secondarySidebarAddonLocation
1702
- }, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar))))));
1727
+ }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
1728
+ element: dom,
1729
+ onAppend: handleAppend
1730
+ }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1703
1731
  });
1704
1732
  const Reader = TechDocsReaderPageContent;
1705
1733
 
@@ -1758,6 +1786,7 @@ const TechDocsReaderPageHeader = (props) => {
1758
1786
  value: /* @__PURE__ */ React.createElement(EntityRefLink, {
1759
1787
  color: "inherit",
1760
1788
  entityRef,
1789
+ title: entityMetadata == null ? void 0 : entityMetadata.metadata.title,
1761
1790
  defaultKind: "Component"
1762
1791
  })
1763
1792
  }), ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(HeaderLabel, {
@@ -2182,7 +2211,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
2182
2211
  }));
2183
2212
  const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
2184
2213
  name: "TechDocsCustomHome",
2185
- component: () => import('./TechDocsCustomHome-cd82e45b.esm.js').then((m) => m.TechDocsCustomHome),
2214
+ component: () => import('./TechDocsCustomHome-5d481b98.esm.js').then((m) => m.TechDocsCustomHome),
2186
2215
  mountPoint: rootRouteRef
2187
2216
  }));
2188
2217
  const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
@@ -2192,7 +2221,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
2192
2221
  }));
2193
2222
  const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
2194
2223
  name: "TechDocsReaderPage",
2195
- component: () => import('./index-aaf89f6d.esm.js').then((m) => m.TechDocsReaderPage),
2224
+ component: () => import('./index-038d31d0.esm.js').then((m) => m.TechDocsReaderPage),
2196
2225
  mountPoint: rootDocsRouteRef
2197
2226
  }));
2198
2227
 
@@ -2233,18 +2262,27 @@ const EmbeddedDocsRouter = (props) => {
2233
2262
  var _a;
2234
2263
  const { children } = props;
2235
2264
  const { entity } = useEntity();
2265
+ const element = useRoutes([
2266
+ {
2267
+ path: "/*",
2268
+ element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
2269
+ entity
2270
+ }),
2271
+ children: [
2272
+ {
2273
+ path: "/*",
2274
+ element: children
2275
+ }
2276
+ ]
2277
+ }
2278
+ ]);
2236
2279
  const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
2237
2280
  if (!projectId) {
2238
2281
  return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
2239
2282
  annotation: TECHDOCS_ANNOTATION
2240
2283
  });
2241
2284
  }
2242
- return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2243
- path: "*",
2244
- element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
2245
- entity
2246
- })
2247
- }, children));
2285
+ return element;
2248
2286
  };
2249
2287
 
2250
2288
  var Router$1 = /*#__PURE__*/Object.freeze({
@@ -2255,4 +2293,4 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2255
2293
  });
2256
2294
 
2257
2295
  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 };
2258
- //# sourceMappingURL=index-dd16232a.esm.js.map
2296
+ //# sourceMappingURL=index-8dfcce23.esm.js.map