@backstage/plugin-techdocs 1.1.1-next.2 → 1.1.2-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.
@@ -1,13 +1,13 @@
1
1
  import { createApiRef, useApi, 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
- import React, { useState, useEffect, useReducer, useRef, useMemo, createContext, useContext, useCallback, Children } from 'react';
5
- import { useParams, useNavigate as useNavigate$1, useOutlet, Routes, Route } from 'react-router-dom';
6
- 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';
7
- import { techdocsStorageApiRef as techdocsStorageApiRef$1, useTechDocsReaderPage, useTechDocsAddons, TechDocsAddonLocations, TECHDOCS_ADDONS_WRAPPER_KEY, TechDocsReaderPageProvider, techdocsApiRef as techdocsApiRef$1 } from '@backstage/plugin-techdocs-react';
8
- import { create } from 'jss';
9
- 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';
10
- import { jssPreset, StylesProvider, withStyles as withStyles$1 } from '@material-ui/styles';
4
+ import React, { useReducer, useRef, useMemo, createContext, useContext, useState, useEffect, useCallback, Children } from '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
+ import useAsync from 'react-use/lib/useAsync';
8
+ import useAsyncRetry from 'react-use/lib/useAsyncRetry';
9
+ import { Link, LogViewer, ErrorPage, SidebarPinStateContext, 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, 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';
11
11
  import { HighlightedSearchResultText, SearchContextProvider, useSearch } from '@backstage/plugin-search-react';
12
12
  import SearchIcon from '@material-ui/icons/Search';
13
13
  import Autocomplete from '@material-ui/lab/Autocomplete';
@@ -15,16 +15,13 @@ import { useNavigate, useOutlet as useOutlet$1 } from 'react-router';
15
15
  import useDebounce from 'react-use/lib/useDebounce';
16
16
  import { Alert, Skeleton } from '@material-ui/lab';
17
17
  import Close from '@material-ui/icons/Close';
18
- import useAsync from 'react-use/lib/useAsync';
19
- import useAsyncRetry from 'react-use/lib/useAsyncRetry';
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
 
@@ -153,6 +151,169 @@ class TechDocsStorageClient {
153
151
  }
154
152
  }
155
153
 
154
+ function calculateDisplayState({
155
+ contentLoading,
156
+ content,
157
+ activeSyncState
158
+ }) {
159
+ if (contentLoading) {
160
+ return "CHECKING";
161
+ }
162
+ if (activeSyncState === "BUILD_READY_RELOAD") {
163
+ return "CHECKING";
164
+ }
165
+ if (!content && activeSyncState === "CHECKING") {
166
+ return "CHECKING";
167
+ }
168
+ if (!content && activeSyncState === "BUILDING") {
169
+ return "INITIAL_BUILD";
170
+ }
171
+ if (!content) {
172
+ return "CONTENT_NOT_FOUND";
173
+ }
174
+ if (activeSyncState === "BUILDING") {
175
+ return "CONTENT_STALE_REFRESHING";
176
+ }
177
+ if (activeSyncState === "BUILD_READY") {
178
+ return "CONTENT_STALE_READY";
179
+ }
180
+ if (activeSyncState === "ERROR") {
181
+ return "CONTENT_STALE_ERROR";
182
+ }
183
+ return "CONTENT_FRESH";
184
+ }
185
+ function reducer(oldState, action) {
186
+ const newState = { ...oldState };
187
+ switch (action.type) {
188
+ case "sync":
189
+ if (action.state === "CHECKING") {
190
+ newState.buildLog = [];
191
+ }
192
+ newState.activeSyncState = action.state;
193
+ newState.syncError = action.syncError;
194
+ break;
195
+ case "contentLoading":
196
+ newState.contentLoading = true;
197
+ newState.contentError = void 0;
198
+ break;
199
+ case "content":
200
+ if (typeof action.path === "string") {
201
+ newState.path = action.path;
202
+ }
203
+ newState.contentLoading = false;
204
+ newState.content = action.content;
205
+ newState.contentError = action.contentError;
206
+ break;
207
+ case "buildLog":
208
+ newState.buildLog = newState.buildLog.concat(action.log);
209
+ break;
210
+ default:
211
+ throw new Error();
212
+ }
213
+ if (["BUILD_READY", "BUILD_READY_RELOAD"].includes(newState.activeSyncState) && ["contentLoading", "content"].includes(action.type)) {
214
+ newState.activeSyncState = "UP_TO_DATE";
215
+ newState.buildLog = [];
216
+ }
217
+ return newState;
218
+ }
219
+ function useReaderState(kind, namespace, name, path) {
220
+ var _a, _b;
221
+ const [state, dispatch] = useReducer(reducer, {
222
+ activeSyncState: "CHECKING",
223
+ path,
224
+ contentLoading: true,
225
+ buildLog: []
226
+ });
227
+ const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
228
+ const { retry: contentReload } = useAsyncRetry(async () => {
229
+ dispatch({ type: "contentLoading" });
230
+ try {
231
+ const entityDocs = await techdocsStorageApi.getEntityDocs({ kind, namespace, name }, path);
232
+ dispatch({ type: "content", content: entityDocs, path });
233
+ return entityDocs;
234
+ } catch (e) {
235
+ dispatch({ type: "content", contentError: e, path });
236
+ }
237
+ return void 0;
238
+ }, [techdocsStorageApi, kind, namespace, name, path]);
239
+ const contentRef = useRef({
240
+ content: void 0,
241
+ reload: () => {
242
+ }
243
+ });
244
+ contentRef.current = { content: state.content, reload: contentReload };
245
+ useAsync(async () => {
246
+ dispatch({ type: "sync", state: "CHECKING" });
247
+ const buildingTimeout = setTimeout(() => {
248
+ dispatch({ type: "sync", state: "BUILDING" });
249
+ }, 1e3);
250
+ try {
251
+ const result = await techdocsStorageApi.syncEntityDocs({
252
+ kind,
253
+ namespace,
254
+ name
255
+ }, (log) => {
256
+ dispatch({ type: "buildLog", log });
257
+ });
258
+ switch (result) {
259
+ case "updated":
260
+ if (!contentRef.current.content) {
261
+ contentRef.current.reload();
262
+ dispatch({ type: "sync", state: "BUILD_READY_RELOAD" });
263
+ } else {
264
+ dispatch({ type: "sync", state: "BUILD_READY" });
265
+ }
266
+ break;
267
+ case "cached":
268
+ dispatch({ type: "sync", state: "UP_TO_DATE" });
269
+ break;
270
+ default:
271
+ dispatch({
272
+ type: "sync",
273
+ state: "ERROR",
274
+ syncError: new Error("Unexpected return state")
275
+ });
276
+ break;
277
+ }
278
+ } catch (e) {
279
+ dispatch({ type: "sync", state: "ERROR", syncError: e });
280
+ } finally {
281
+ clearTimeout(buildingTimeout);
282
+ }
283
+ }, [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]);
289
+ return {
290
+ state: displayState,
291
+ contentReload,
292
+ path: state.path,
293
+ content: state.content,
294
+ contentErrorMessage: (_a = state.contentError) == null ? void 0 : _a.toString(),
295
+ syncErrorMessage: (_b = state.syncError) == null ? void 0 : _b.toString(),
296
+ buildLog: state.buildLog
297
+ };
298
+ }
299
+
300
+ const TechDocsReaderContext = createContext({});
301
+ const useTechDocsReader = () => useContext(TechDocsReaderContext);
302
+ const TechDocsReaderProvider = ({
303
+ children
304
+ }) => {
305
+ const { "*": path = "" } = useParams();
306
+ const { entityRef } = useTechDocsReaderPage();
307
+ const { kind, namespace, name } = entityRef;
308
+ const value = useReaderState(kind, namespace, name, path);
309
+ return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
310
+ value
311
+ }, children instanceof Function ? children(value) : children);
312
+ };
313
+ const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
314
+ ...props
315
+ }));
316
+
156
317
  const useStyles$4 = makeStyles({
157
318
  flexContainer: {
158
319
  flexWrap: "wrap"
@@ -436,7 +597,6 @@ const TechDocsStateIndicator = () => {
436
597
  syncErrorMessage,
437
598
  buildLog
438
599
  } = useTechDocsReader();
439
- const ReaderProgress = state === "CHECKING" ? /* @__PURE__ */ React.createElement(Progress, null) : null;
440
600
  if (state === "INITIAL_BUILD") {
441
601
  StateAlert = /* @__PURE__ */ React.createElement(Alert, {
442
602
  classes: { root: classes.root },
@@ -496,171 +656,571 @@ const TechDocsStateIndicator = () => {
496
656
  errorMessage: contentErrorMessage
497
657
  }));
498
658
  }
499
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ReaderProgress, StateAlert);
659
+ return StateAlert;
500
660
  };
501
661
 
502
- function calculateDisplayState({
503
- contentLoading,
504
- content,
505
- activeSyncState
506
- }) {
507
- if (contentLoading) {
508
- return "CHECKING";
662
+ const MKDOCS_CSS = /main\.[A-Fa-f0-9]{8}\.min\.css$/;
663
+ const GOOGLE_FONTS = /^https:\/\/fonts\.googleapis\.com/;
664
+ const GSTATIC_FONTS = /^https:\/\/fonts\.gstatic\.com/;
665
+ const isLink = (node) => node.nodeName === "LINK";
666
+ const isSafe$1 = (node) => {
667
+ const href = (node == null ? void 0 : node.getAttribute("href")) || "";
668
+ const isMkdocsCss = href.match(MKDOCS_CSS);
669
+ const isGoogleFonts = href.match(GOOGLE_FONTS);
670
+ const isGstaticFonts = href.match(GSTATIC_FONTS);
671
+ return isMkdocsCss || isGoogleFonts || isGstaticFonts;
672
+ };
673
+ const removeUnsafeLinks = (node) => {
674
+ if (isLink(node) && !isSafe$1(node)) {
675
+ node.remove();
509
676
  }
510
- if (activeSyncState === "BUILD_READY_RELOAD") {
511
- return "CHECKING";
677
+ return node;
678
+ };
679
+
680
+ const isIframe = (node) => node.nodeName === "IFRAME";
681
+ const isSafe = (node, hosts) => {
682
+ const src = node.getAttribute("src") || "";
683
+ try {
684
+ const { host } = new URL(src);
685
+ return hosts.includes(host);
686
+ } catch {
687
+ return false;
512
688
  }
513
- if (!content && activeSyncState === "CHECKING") {
514
- return "CHECKING";
689
+ };
690
+ const removeUnsafeIframes = (hosts) => (node) => {
691
+ if (isIframe(node) && !isSafe(node, hosts)) {
692
+ node.remove();
515
693
  }
516
- if (!content && activeSyncState === "BUILDING") {
517
- return "INITIAL_BUILD";
694
+ return node;
695
+ };
696
+
697
+ const useSanitizerConfig = () => {
698
+ const configApi = useApi(configApiRef);
699
+ return useMemo(() => {
700
+ return configApi.getOptionalConfig("techdocs.sanitizer");
701
+ }, [configApi]);
702
+ };
703
+ const useSanitizerTransformer = () => {
704
+ const config = useSanitizerConfig();
705
+ return useCallback(async (dom) => {
706
+ const hosts = config == null ? void 0 : config.getOptionalStringArray("allowedIframeHosts");
707
+ DOMPurify.addHook("beforeSanitizeElements", removeUnsafeLinks);
708
+ const tags = ["link"];
709
+ if (hosts) {
710
+ tags.push("iframe");
711
+ DOMPurify.addHook("beforeSanitizeElements", removeUnsafeIframes(hosts));
712
+ }
713
+ return DOMPurify.sanitize(dom.innerHTML, {
714
+ ADD_TAGS: tags,
715
+ FORBID_TAGS: ["style"],
716
+ WHOLE_DOCUMENT: true,
717
+ RETURN_DOM: true
718
+ });
719
+ }, [config]);
720
+ };
721
+
722
+ var variables = ({ theme }) => `
723
+ /*================== Variables ==================*/
724
+ /*
725
+ 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.
726
+ 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.
727
+ */
728
+
729
+ :host {
730
+ /* FONT */
731
+ --md-default-fg-color: ${theme.palette.text.primary};
732
+ --md-default-fg-color--light: ${theme.palette.text.secondary};
733
+ --md-default-fg-color--lighter: ${lighten(theme.palette.text.secondary, 0.7)};
734
+ --md-default-fg-color--lightest: ${lighten(theme.palette.text.secondary, 0.3)};
735
+
736
+ /* BACKGROUND */
737
+ --md-default-bg-color:${theme.palette.background.default};
738
+ --md-default-bg-color--light: ${theme.palette.background.paper};
739
+ --md-default-bg-color--lighter: ${lighten(theme.palette.background.paper, 0.7)};
740
+ --md-default-bg-color--lightest: ${lighten(theme.palette.background.paper, 0.3)};
741
+
742
+ /* PRIMARY */
743
+ --md-primary-fg-color: ${theme.palette.primary.main};
744
+ --md-primary-fg-color--light: ${theme.palette.primary.light};
745
+ --md-primary-fg-color--dark: ${theme.palette.primary.dark};
746
+ --md-primary-bg-color: ${theme.palette.primary.contrastText};
747
+ --md-primary-bg-color--light: ${lighten(theme.palette.primary.contrastText, 0.7)};
748
+
749
+ /* ACCENT */
750
+ --md-accent-fg-color: var(--md-primary-fg-color);
751
+
752
+ /* SHADOW */
753
+ --md-shadow-z1: ${theme.shadows[1]};
754
+ --md-shadow-z2: ${theme.shadows[2]};
755
+ --md-shadow-z3: ${theme.shadows[3]};
756
+
757
+ /* EXTENSIONS */
758
+ --md-admonition-fg-color: var(--md-default-fg-color);
759
+ --md-admonition-bg-color: var(--md-default-bg-color);
760
+ /* Admonitions and others are using SVG masks to define icons. These masks are defined as CSS variables. */
761
+ --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>');
762
+ --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>');
763
+ --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>');
764
+ --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>');
765
+ --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>');
766
+ --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>');
767
+ --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>');
768
+ --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>');
769
+ --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>');
770
+ --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>');
771
+ --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>');
772
+ --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>');
773
+ --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>');
774
+ --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>');
775
+ --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>');
776
+ --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>');
777
+ --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>');
778
+ --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>');
779
+ --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>');
780
+ --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>');
781
+ --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>');
782
+ --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>');
783
+ --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>');
784
+ --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>');
785
+ --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>');
786
+ --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>');
787
+ }
788
+
789
+ :host > * {
790
+ /* CODE */
791
+ --md-code-fg-color: ${theme.palette.text.primary};
792
+ --md-code-bg-color: ${theme.palette.background.paper};
793
+ --md-code-hl-color: ${alpha(theme.palette.warning.main, 0.5)};
794
+ --md-code-hl-keyword-color: ${theme.palette.type === "dark" ? theme.palette.primary.light : theme.palette.primary.dark};
795
+ --md-code-hl-function-color: ${theme.palette.type === "dark" ? theme.palette.secondary.light : theme.palette.secondary.dark};
796
+ --md-code-hl-string-color: ${theme.palette.type === "dark" ? theme.palette.success.light : theme.palette.success.dark};
797
+ --md-code-hl-number-color: ${theme.palette.type === "dark" ? theme.palette.error.light : theme.palette.error.dark};
798
+ --md-code-hl-constant-color: var(--md-code-hl-function-color);
799
+ --md-code-hl-special-color: var(--md-code-hl-function-color);
800
+ --md-code-hl-name-color: var(--md-code-fg-color);
801
+ --md-code-hl-comment-color: var(--md-default-fg-color--light);
802
+ --md-code-hl-generic-color: var(--md-default-fg-color--light);
803
+ --md-code-hl-variable-color: var(--md-default-fg-color--light);
804
+ --md-code-hl-operator-color: var(--md-default-fg-color--light);
805
+ --md-code-hl-punctuation-color: var(--md-default-fg-color--light);
806
+
807
+ /* TYPESET */
808
+ --md-typeset-font-size: 1rem;
809
+ --md-typeset-color: var(--md-default-fg-color);
810
+ --md-typeset-a-color: var(--md-accent-fg-color);
811
+ --md-typeset-table-color: ${theme.palette.text.primary};
812
+ --md-typeset-del-color: ${theme.palette.type === "dark" ? alpha(theme.palette.error.dark, 0.5) : alpha(theme.palette.error.light, 0.5)};
813
+ --md-typeset-ins-color: ${theme.palette.type === "dark" ? alpha(theme.palette.success.dark, 0.5) : alpha(theme.palette.success.light, 0.5)};
814
+ --md-typeset-mark-color: ${theme.palette.type === "dark" ? alpha(theme.palette.warning.dark, 0.5) : alpha(theme.palette.warning.light, 0.5)};
815
+ }
816
+
817
+ @media screen and (max-width: 76.1875em) {
818
+ :host > * {
819
+ /* TYPESET */
820
+ --md-typeset-font-size: .9rem;
518
821
  }
519
- if (!content) {
520
- return "CONTENT_NOT_FOUND";
822
+ }
823
+
824
+ @media screen and (max-width: 600px) {
825
+ :host > * {
826
+ /* TYPESET */
827
+ --md-typeset-font-size: .7rem;
521
828
  }
522
- if (activeSyncState === "BUILDING") {
523
- return "CONTENT_STALE_REFRESHING";
829
+ }
830
+ `;
831
+
832
+ var reset = ({ theme }) => `
833
+ /*================== Reset ==================*/
834
+
835
+ body {
836
+ --md-text-color: var(--md-default-fg-color);
837
+ --md-text-link-color: var(--md-accent-fg-color);
838
+ --md-text-font-family: ${theme.typography.fontFamily};
839
+ font-family: var(--md-text-font-family);
840
+ background-color: unset;
841
+ }
842
+ `;
843
+
844
+ var layout = ({ theme, sidebar }) => `
845
+ /*================== Layout ==================*/
846
+
847
+ .md-grid {
848
+ max-width: 100%;
849
+ margin: 0;
850
+ }
851
+
852
+ .md-nav {
853
+ font-size: calc(var(--md-typeset-font-size) * 0.9);
854
+ }
855
+ .md-nav__link {
856
+ display: flex;
857
+ align-items: center;
858
+ justify-content: space-between;
859
+ }
860
+ .md-nav__icon {
861
+ height: 20px !important;
862
+ width: 20px !important;
863
+ margin-left:${theme.spacing(1)}px;
864
+ }
865
+ .md-nav__icon svg {
866
+ margin: 0;
867
+ width: 20px !important;
868
+ height: 20px !important;
869
+ }
870
+ .md-nav__icon:after {
871
+ width: 20px !important;
872
+ height: 20px !important;
873
+ }
874
+
875
+ .md-main__inner {
876
+ margin-top: 0;
877
+ }
878
+
879
+ .md-sidebar {
880
+ bottom: 75px;
881
+ position: fixed;
882
+ width: 16rem;
883
+ overflow-y: auto;
884
+ overflow-x: hidden;
885
+ scrollbar-color: rgb(193, 193, 193) #eee;
886
+ scrollbar-width: thin;
887
+ }
888
+ .md-sidebar .md-sidebar__scrollwrap {
889
+ width: calc(16rem - 10px);
890
+ }
891
+ .md-sidebar--secondary {
892
+ right: ${theme.spacing(3)}px;
893
+ }
894
+ .md-sidebar::-webkit-scrollbar {
895
+ width: 5px;
896
+ }
897
+ .md-sidebar::-webkit-scrollbar-button {
898
+ width: 5px;
899
+ height: 5px;
900
+ }
901
+ .md-sidebar::-webkit-scrollbar-track {
902
+ background: #eee;
903
+ border: 1 px solid rgb(250, 250, 250);
904
+ box-shadow: 0px 0px 3px #dfdfdf inset;
905
+ border-radius: 3px;
906
+ }
907
+ .md-sidebar::-webkit-scrollbar-thumb {
908
+ width: 5px;
909
+ background: rgb(193, 193, 193);
910
+ border: transparent;
911
+ border-radius: 3px;
912
+ }
913
+ .md-sidebar::-webkit-scrollbar-thumb:hover {
914
+ background: rgb(125, 125, 125);
915
+ }
916
+
917
+ .md-content {
918
+ max-width: calc(100% - 16rem * 2);
919
+ margin-left: 16rem;
920
+ margin-bottom: 50px;
921
+ }
922
+
923
+ .md-footer {
924
+ position: fixed;
925
+ bottom: 0px;
926
+ }
927
+ .md-footer__title {
928
+ background-color: unset;
929
+ }
930
+ .md-footer-nav__link {
931
+ width: 16rem;
932
+ }
933
+
934
+ .md-dialog {
935
+ background-color: unset;
936
+ }
937
+
938
+ @media screen and (min-width: 76.25em) {
939
+ .md-sidebar {
940
+ height: auto;
524
941
  }
525
- if (activeSyncState === "BUILD_READY") {
526
- return "CONTENT_STALE_READY";
942
+ }
943
+
944
+ @media screen and (max-width: 76.1875em) {
945
+ .md-nav {
946
+ transition: none !important;
947
+ background-color: var(--md-default-bg-color)
527
948
  }
528
- if (activeSyncState === "ERROR") {
529
- return "CONTENT_STALE_ERROR";
949
+ .md-nav--primary .md-nav__title {
950
+ cursor: auto;
951
+ color: var(--md-default-fg-color);
952
+ font-weight: 700;
953
+ white-space: normal;
954
+ line-height: 1rem;
955
+ height: auto;
956
+ display: flex;
957
+ flex-flow: column;
958
+ row-gap: 1.6rem;
959
+ padding: 1.2rem .8rem .8rem;
960
+ background-color: var(--md-default-bg-color);
530
961
  }
531
- return "CONTENT_FRESH";
532
- }
533
- function reducer(oldState, action) {
534
- const newState = { ...oldState };
535
- switch (action.type) {
536
- case "sync":
537
- if (action.state === "CHECKING") {
538
- newState.buildLog = [];
539
- }
540
- newState.activeSyncState = action.state;
541
- newState.syncError = action.syncError;
542
- break;
543
- case "contentLoading":
544
- newState.contentLoading = true;
545
- newState.contentError = void 0;
546
- break;
547
- case "content":
548
- if (typeof action.path === "string") {
549
- newState.path = action.path;
550
- }
551
- newState.contentLoading = false;
552
- newState.content = action.content;
553
- newState.contentError = action.contentError;
554
- break;
555
- case "buildLog":
556
- newState.buildLog = newState.buildLog.concat(action.log);
557
- break;
558
- default:
559
- throw new Error();
962
+ .md-nav--primary .md-nav__title~.md-nav__list {
963
+ box-shadow: none;
964
+ }
965
+ .md-nav--primary .md-nav__title ~ .md-nav__list > :first-child {
966
+ border-top: none;
967
+ }
968
+ .md-nav--primary .md-nav__title .md-nav__button {
969
+ display: none;
970
+ }
971
+ .md-nav--primary .md-nav__title .md-nav__icon {
972
+ color: var(--md-default-fg-color);
973
+ position: static;
974
+ height: auto;
975
+ margin: 0 0 0 -0.2rem;
976
+ }
977
+ .md-nav--primary > .md-nav__title [for="none"] {
978
+ padding-top: 0;
560
979
  }
561
- if (["BUILD_READY", "BUILD_READY_RELOAD"].includes(newState.activeSyncState) && ["contentLoading", "content"].includes(action.type)) {
562
- newState.activeSyncState = "UP_TO_DATE";
563
- newState.buildLog = [];
980
+ .md-nav--primary .md-nav__item {
981
+ border-top: none;
982
+ }
983
+ .md-nav--primary :is(.md-nav__title,.md-nav__item) {
984
+ font-size : var(--md-typeset-font-size);
985
+ }
986
+ .md-nav .md-source {
987
+ display: none;
988
+ }
989
+
990
+ .md-sidebar {
991
+ height: 100%;
992
+ }
993
+ .md-sidebar--primary {
994
+ width: 12.1rem !important;
995
+ z-index: 200;
996
+ left: ${sidebar.isPinned ? "calc(-12.1rem + 242px)" : "calc(-12.1rem + 72px)"} !important;
997
+ }
998
+ .md-sidebar--secondary:not([hidden]) {
999
+ display: none;
1000
+ }
1001
+
1002
+ .md-content {
1003
+ max-width: 100%;
1004
+ margin-left: 0;
1005
+ }
1006
+
1007
+ .md-header__button {
1008
+ margin: 0.4rem 0;
1009
+ margin-left: 0.4rem;
1010
+ padding: 0;
1011
+ }
1012
+
1013
+ .md-overlay {
1014
+ left: 0;
1015
+ }
1016
+
1017
+ .md-footer {
1018
+ position: static;
1019
+ padding-left: 0;
1020
+ }
1021
+ .md-footer-nav__link {
1022
+ /* footer links begin to overlap at small sizes without setting width */
1023
+ width: 50%;
564
1024
  }
565
- return newState;
566
1025
  }
567
- function useReaderState(kind, namespace, name, path) {
568
- var _a, _b;
569
- const [state, dispatch] = useReducer(reducer, {
570
- activeSyncState: "CHECKING",
571
- path,
572
- contentLoading: true,
573
- buildLog: []
574
- });
575
- const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
576
- const { retry: contentReload } = useAsyncRetry(async () => {
577
- dispatch({ type: "contentLoading" });
578
- try {
579
- const entityDocs = await techdocsStorageApi.getEntityDocs({ kind, namespace, name }, path);
580
- dispatch({ type: "content", content: entityDocs, path });
581
- return entityDocs;
582
- } catch (e) {
583
- dispatch({ type: "content", contentError: e, path });
584
- }
585
- return void 0;
586
- }, [techdocsStorageApi, kind, namespace, name, path]);
587
- const contentRef = useRef({
588
- content: void 0,
589
- reload: () => {
1026
+
1027
+ @media screen and (max-width: 600px) {
1028
+ .md-sidebar--primary {
1029
+ left: -12.1rem !important;
1030
+ width: 12.1rem;
1031
+ }
1032
+ }
1033
+ `;
1034
+
1035
+ const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
1036
+ var typeset = ({ theme }) => `
1037
+ /*================== Typeset ==================*/
1038
+
1039
+ .md-typeset {
1040
+ font-size: var(--md-typeset-font-size);
1041
+ }
1042
+
1043
+ ${headings.reduce((style, heading) => {
1044
+ const styles = theme.typography[heading];
1045
+ const { lineHeight, fontFamily, fontWeight, fontSize } = styles;
1046
+ const calculate = (value) => {
1047
+ let factor = 1;
1048
+ if (typeof value === "number") {
1049
+ factor = value / 16 * 0.6;
590
1050
  }
591
- });
592
- contentRef.current = { content: state.content, reload: contentReload };
593
- useAsync(async () => {
594
- dispatch({ type: "sync", state: "CHECKING" });
595
- const buildingTimeout = setTimeout(() => {
596
- dispatch({ type: "sync", state: "BUILDING" });
597
- }, 1e3);
598
- try {
599
- const result = await techdocsStorageApi.syncEntityDocs({
600
- kind,
601
- namespace,
602
- name
603
- }, (log) => {
604
- dispatch({ type: "buildLog", log });
605
- });
606
- switch (result) {
607
- case "updated":
608
- if (!contentRef.current.content) {
609
- contentRef.current.reload();
610
- dispatch({ type: "sync", state: "BUILD_READY_RELOAD" });
611
- } else {
612
- dispatch({ type: "sync", state: "BUILD_READY" });
613
- }
614
- break;
615
- case "cached":
616
- dispatch({ type: "sync", state: "UP_TO_DATE" });
617
- break;
618
- default:
619
- dispatch({
620
- type: "sync",
621
- state: "ERROR",
622
- syncError: new Error("Unexpected return state")
623
- });
624
- break;
625
- }
626
- } catch (e) {
627
- dispatch({ type: "sync", state: "ERROR", syncError: e });
628
- } finally {
629
- clearTimeout(buildingTimeout);
1051
+ if (typeof value === "string") {
1052
+ factor = value.replace("rem", "");
630
1053
  }
631
- }, [kind, name, namespace, techdocsStorageApi, dispatch, contentRef]);
632
- const displayState = useMemo(() => calculateDisplayState({
633
- activeSyncState: state.activeSyncState,
634
- contentLoading: state.contentLoading,
635
- content: state.content
636
- }), [state.activeSyncState, state.content, state.contentLoading]);
637
- return {
638
- state: displayState,
639
- contentReload,
640
- path: state.path,
641
- content: state.content,
642
- contentErrorMessage: (_a = state.contentError) == null ? void 0 : _a.toString(),
643
- syncErrorMessage: (_b = state.syncError) == null ? void 0 : _b.toString(),
644
- buildLog: state.buildLog
1054
+ return `calc(${factor} * var(--md-typeset-font-size))`;
645
1055
  };
1056
+ return style.concat(`
1057
+ .md-typeset ${heading} {
1058
+ color: var(--md-default-fg-color);
1059
+ line-height: ${lineHeight};
1060
+ font-family: ${fontFamily};
1061
+ font-weight: ${fontWeight};
1062
+ font-size: ${calculate(fontSize)};
1063
+ }
1064
+ `);
1065
+ }, "")}
1066
+
1067
+ .md-typeset .md-content__button {
1068
+ color: var(--md-default-fg-color);
646
1069
  }
647
1070
 
648
- const TechDocsReaderContext = createContext({});
649
- const useTechDocsReader = () => useContext(TechDocsReaderContext);
650
- const TechDocsReaderProvider = ({
651
- children
652
- }) => {
653
- const { "*": path = "" } = useParams();
654
- const { entityRef } = useTechDocsReaderPage();
655
- const { kind, namespace, name } = entityRef;
656
- const value = useReaderState(kind, namespace, name, path);
657
- return /* @__PURE__ */ React.createElement(TechDocsReaderContext.Provider, {
658
- value
659
- }, children instanceof Function ? children(value) : children);
1071
+ .md-typeset hr {
1072
+ border-bottom: 0.05rem dotted ${theme.palette.divider};
1073
+ }
1074
+
1075
+ .md-typeset details {
1076
+ font-size: var(--md-typeset-font-size) !important;
1077
+ }
1078
+ .md-typeset details summary {
1079
+ padding-left: 2.5rem !important;
1080
+ }
1081
+ .md-typeset details summary:before,
1082
+ .md-typeset details summary:after {
1083
+ top: 50% !important;
1084
+ width: 20px !important;
1085
+ height: 20px !important;
1086
+ transform: rotate(0deg) translateY(-50%) !important;
1087
+ }
1088
+ .md-typeset details[open] > summary:after {
1089
+ transform: rotate(90deg) translateX(-50%) !important;
1090
+ }
1091
+
1092
+ .md-typeset blockquote {
1093
+ color: var(--md-default-fg-color--light);
1094
+ border-left: 0.2rem solid var(--md-default-fg-color--light);
1095
+ }
1096
+
1097
+ .md-typeset table:not([class]) {
1098
+ font-size: var(--md-typeset-font-size);
1099
+ border: 1px solid var(--md-default-fg-color);
1100
+ border-bottom: none;
1101
+ border-collapse: collapse;
1102
+ }
1103
+ .md-typeset table:not([class]) th {
1104
+ font-weight: bold;
1105
+ }
1106
+ .md-typeset table:not([class]) td, .md-typeset table:not([class]) th {
1107
+ border-bottom: 1px solid var(--md-default-fg-color);
1108
+ }
1109
+
1110
+ .md-typeset pre > code::-webkit-scrollbar-thumb {
1111
+ background-color: hsla(0, 0%, 0%, 0.32);
1112
+ }
1113
+ .md-typeset pre > code::-webkit-scrollbar-thumb:hover {
1114
+ background-color: hsla(0, 0%, 0%, 0.87);
1115
+ }
1116
+ `;
1117
+
1118
+ var animations = () => `
1119
+ /*================== Animations ==================*/
1120
+ /*
1121
+ Disable CSS animations on link colors as they lead to issues in dark mode.
1122
+ The dark mode color theme is applied later and theirfore there is always an animation from light to dark mode when navigation between pages.
1123
+ */
1124
+ .md-dialog, .md-nav__link, .md-footer__link, .md-typeset a, .md-typeset a::before, .md-typeset .headerlink {
1125
+ transition: none;
1126
+ }
1127
+ `;
1128
+
1129
+ var extensions = ({ theme }) => `
1130
+ /*================== Extensions ==================*/
1131
+
1132
+ /* HIGHLIGHT */
1133
+ .highlight .md-clipboard:after {
1134
+ content: unset;
1135
+ }
1136
+
1137
+ .highlight .nx {
1138
+ color: ${theme.palette.type === "dark" ? "#ff53a3" : "#ec407a"};
1139
+ }
1140
+
1141
+ /* CODE HILITE */
1142
+ .codehilite .gd {
1143
+ background-color: ${theme.palette.type === "dark" ? "rgba(248,81,73,0.65)" : "#fdd"};
1144
+ }
1145
+
1146
+ .codehilite .gi {
1147
+ background-color: ${theme.palette.type === "dark" ? "rgba(46,160,67,0.65)" : "#dfd"};
1148
+ }
1149
+
1150
+ /* TABBED */
1151
+ .tabbed-set>input:nth-child(1):checked~.tabbed-labels>:nth-child(1),
1152
+ .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
1153
+ .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
1154
+ .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
1155
+ .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
1156
+ .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
1157
+ .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
1158
+ .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
1159
+ .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
1160
+ .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),
1161
+ .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),
1162
+ .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),
1163
+ .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),
1164
+ .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),
1165
+ .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),
1166
+ .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),
1167
+ .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),
1168
+ .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),
1169
+ .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),
1170
+ .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20) {
1171
+ color: var(--md-accent-fg-color);
1172
+ border-color: var(--md-accent-fg-color);
1173
+ }
1174
+
1175
+ /* TASK-LIST */
1176
+ .task-list-control .task-list-indicator::before {
1177
+ background-color: ${theme.palette.action.disabledBackground};
1178
+ }
1179
+ .task-list-control [type="checkbox"]:checked + .task-list-indicator:before {
1180
+ background-color: ${theme.palette.success.main};
1181
+ }
1182
+
1183
+ /* ADMONITION */
1184
+ .admonition {
1185
+ font-size: var(--md-typeset-font-size) !important;
1186
+ }
1187
+ .admonition .admonition-title {
1188
+ padding-left: 2.5rem !important;
1189
+ }
1190
+
1191
+ .admonition .admonition-title:before {
1192
+ top: 50% !important;
1193
+ width: 20px !important;
1194
+ height: 20px !important;
1195
+ transform: translateY(-50%) !important;
1196
+ }
1197
+ `;
1198
+
1199
+ const rules = [
1200
+ variables,
1201
+ reset,
1202
+ layout,
1203
+ typeset,
1204
+ animations,
1205
+ extensions
1206
+ ];
1207
+
1208
+ const useSidebar = () => useContext(SidebarPinStateContext);
1209
+ const useRuleStyles = () => {
1210
+ const sidebar = useSidebar();
1211
+ const theme = useTheme();
1212
+ return useMemo(() => {
1213
+ const options = { theme, sidebar };
1214
+ return rules.reduce((styles, rule) => styles + rule(options), "");
1215
+ }, [theme, sidebar]);
1216
+ };
1217
+ const useStylesTransformer = () => {
1218
+ const styles = useRuleStyles();
1219
+ return useCallback((dom) => {
1220
+ dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${styles}</style>`);
1221
+ return dom;
1222
+ }, [styles]);
660
1223
  };
661
- const withTechDocsReaderProvider = (Component) => (props) => /* @__PURE__ */ React.createElement(TechDocsReaderProvider, null, /* @__PURE__ */ React.createElement(Component, {
662
- ...props
663
- }));
664
1224
 
665
1225
  const isSvgNeedingInlining = (attrName, attrVal, apiOrigin) => {
666
1226
  const isSrcToSvg = attrName === "src" && attrVal.endsWith(".svg");
@@ -887,88 +1447,15 @@ const simplifyMkdocsFooter = () => {
887
1447
  };
888
1448
 
889
1449
  const onCssReady = ({
890
- docStorageUrl,
891
1450
  onLoading,
892
1451
  onLoaded
893
1452
  }) => {
894
1453
  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);
898
- });
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
1454
+ onLoading();
1455
+ dom.addEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, function handleShadowDomStyleLoad() {
1456
+ onLoaded();
1457
+ dom.removeEventListener(SHADOW_DOM_STYLE_LOAD_EVENT, handleShadowDomStyleLoad);
965
1458
  });
966
- };
967
- };
968
-
969
- const injectCss = ({ css }) => {
970
- return (dom) => {
971
- dom.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", `<style>${css}</style>`);
972
1459
  return dom;
973
1460
  };
974
1461
  };
@@ -1001,44 +1488,43 @@ const transform = async (html, transformers) => {
1001
1488
  return dom;
1002
1489
  };
1003
1490
 
1004
- const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
1491
+ const MOBILE_MEDIA_QUERY = "screen and (max-width: 76.1875em)";
1005
1492
  const useTechDocsReaderDom = (entityRef) => {
1006
1493
  const navigate = useNavigate$1();
1007
1494
  const theme = useTheme();
1495
+ const isMobileMedia = useMediaQuery(MOBILE_MEDIA_QUERY);
1496
+ const sanitizerTransformer = useSanitizerTransformer();
1497
+ const stylesTransformer = useStylesTransformer();
1008
1498
  const techdocsStorageApi = useApi(techdocsStorageApiRef$1);
1009
1499
  const scmIntegrationsApi = useApi(scmIntegrationsApiRef);
1010
- const techdocsSanitizer = useApi(configApiRef);
1011
- const { namespace, kind, name } = entityRef;
1012
1500
  const { state, path, content: rawPage } = useTechDocsReader();
1013
- const isDarkTheme = theme.palette.type === "dark";
1014
- const [sidebars, setSidebars] = useState();
1015
1501
  const [dom, setDom] = useState(null);
1016
- const { isPinned } = useContext(SidebarPinStateContext);
1502
+ const isStyleLoading = useShadowDomStylesLoading(dom);
1017
1503
  const updateSidebarPosition = useCallback(() => {
1018
- if (!dom || !sidebars)
1504
+ if (!dom)
1019
1505
  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`;
1506
+ const sidebars = dom.querySelectorAll(".md-sidebar");
1507
+ sidebars.forEach((element) => {
1508
+ var _a, _b;
1509
+ if (isMobileMedia) {
1510
+ element.style.top = "0px";
1028
1511
  } else {
1029
- sidebar.style.top = `${newTop}px`;
1512
+ const domTop = (_a = dom.getBoundingClientRect().top) != null ? _a : 0;
1513
+ const tabs = dom.querySelector(".md-container > .md-tabs");
1514
+ const tabsHeight = (_b = tabs == null ? void 0 : tabs.getBoundingClientRect().height) != null ? _b : 0;
1515
+ element.style.top = `${Math.max(domTop, 0) + tabsHeight}px`;
1030
1516
  }
1517
+ element.style.setProperty("opacity", "1");
1031
1518
  });
1032
- }, [dom, sidebars]);
1519
+ }, [dom, isMobileMedia]);
1033
1520
  useEffect(() => {
1034
- updateSidebarPosition();
1035
- window.addEventListener("scroll", updateSidebarPosition, true);
1036
1521
  window.addEventListener("resize", updateSidebarPosition);
1522
+ window.addEventListener("scroll", updateSidebarPosition, true);
1037
1523
  return () => {
1038
- window.removeEventListener("scroll", updateSidebarPosition, true);
1039
1524
  window.removeEventListener("resize", updateSidebarPosition);
1525
+ window.removeEventListener("scroll", updateSidebarPosition, true);
1040
1526
  };
1041
- }, [updateSidebarPosition, state]);
1527
+ }, [dom, updateSidebarPosition]);
1042
1528
  const updateFooterWidth = useCallback(() => {
1043
1529
  if (!dom)
1044
1530
  return;
@@ -1048,21 +1534,22 @@ const useTechDocsReaderDom = (entityRef) => {
1048
1534
  }
1049
1535
  }, [dom]);
1050
1536
  useEffect(() => {
1051
- updateFooterWidth();
1052
1537
  window.addEventListener("resize", updateFooterWidth);
1053
1538
  return () => {
1054
1539
  window.removeEventListener("resize", updateFooterWidth);
1055
1540
  };
1056
- });
1541
+ }, [dom, updateFooterWidth]);
1542
+ useEffect(() => {
1543
+ if (!isStyleLoading) {
1544
+ updateFooterWidth();
1545
+ updateSidebarPosition();
1546
+ }
1547
+ }, [state, isStyleLoading, updateFooterWidth, updateSidebarPosition]);
1057
1548
  const preRender = useCallback((rawContent, contentPath) => transform(rawContent, [
1058
- sanitizeDOM(techdocsSanitizer.getOptionalConfig("techdocs.sanitizer")),
1549
+ sanitizerTransformer,
1059
1550
  addBaseUrl({
1060
1551
  techdocsStorageApi,
1061
- entityId: {
1062
- kind,
1063
- name,
1064
- namespace
1065
- },
1552
+ entityId: entityRef,
1066
1553
  path: contentPath
1067
1554
  }),
1068
1555
  rewriteDocLinks(),
@@ -1070,487 +1557,13 @@ const useTechDocsReaderDom = (entityRef) => {
1070
1557
  removeMkdocsHeader(),
1071
1558
  simplifyMkdocsFooter(),
1072
1559
  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
- })
1560
+ stylesTransformer
1544
1561
  ]), [
1545
- kind,
1546
- name,
1547
- namespace,
1562
+ entityRef,
1548
1563
  scmIntegrationsApi,
1549
- techdocsSanitizer,
1550
1564
  techdocsStorageApi,
1551
- theme,
1552
- isDarkTheme,
1553
- isPinned
1565
+ sanitizerTransformer,
1566
+ stylesTransformer
1554
1567
  ]);
1555
1568
  const postRender = useCallback(async (transformedElement) => transform(transformedElement, [
1556
1569
  scrollIntoAnchor(),
@@ -1578,18 +1591,24 @@ const useTechDocsReaderDom = (entityRef) => {
1578
1591
  }
1579
1592
  }),
1580
1593
  onCssReady({
1581
- docStorageUrl: await techdocsStorageApi.getApiOrigin(),
1582
- onLoading: (renderedElement) => {
1583
- renderedElement.style.setProperty("opacity", "0");
1594
+ onLoading: () => {
1584
1595
  },
1585
- onLoaded: (renderedElement) => {
1596
+ onLoaded: () => {
1586
1597
  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")));
1598
+ (_a = transformedElement.querySelector(".md-nav__title")) == null ? void 0 : _a.removeAttribute("for");
1599
+ }
1600
+ }),
1601
+ onCssReady({
1602
+ onLoading: () => {
1603
+ const sidebars = Array.from(transformedElement.querySelectorAll(".md-sidebar"));
1604
+ sidebars.forEach((element) => {
1605
+ element.style.setProperty("opacity", "0");
1606
+ });
1607
+ },
1608
+ onLoaded: () => {
1590
1609
  }
1591
1610
  })
1592
- ]), [theme, navigate, techdocsStorageApi]);
1611
+ ]), [theme, navigate]);
1593
1612
  useEffect(() => {
1594
1613
  if (!rawPage)
1595
1614
  return () => {
@@ -1613,6 +1632,33 @@ const useTechDocsReaderDom = (entityRef) => {
1613
1632
  return dom;
1614
1633
  };
1615
1634
 
1635
+ const TechDocsReaderPageContentAddons = () => {
1636
+ const addons = useTechDocsAddons();
1637
+ const { shadowRoot } = useTechDocsReaderPage();
1638
+ const contentElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('[data-md-component="content"]');
1639
+ const primarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]');
1640
+ let primarySidebarAddonLocation = primarySidebarElement == null ? void 0 : primarySidebarElement.querySelector('[data-techdocs-addons-location="primary sidebar"]');
1641
+ if (!primarySidebarAddonLocation) {
1642
+ primarySidebarAddonLocation = document.createElement("div");
1643
+ primarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "primary sidebar");
1644
+ primarySidebarElement == null ? void 0 : primarySidebarElement.prepend(primarySidebarAddonLocation);
1645
+ }
1646
+ const secondarySidebarElement = shadowRoot == null ? void 0 : shadowRoot.querySelector('div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]');
1647
+ let secondarySidebarAddonLocation = secondarySidebarElement == null ? void 0 : secondarySidebarElement.querySelector('[data-techdocs-addons-location="secondary sidebar"]');
1648
+ if (!secondarySidebarAddonLocation) {
1649
+ secondarySidebarAddonLocation = document.createElement("div");
1650
+ secondarySidebarAddonLocation.setAttribute("data-techdocs-addons-location", "secondary sidebar");
1651
+ secondarySidebarElement == null ? void 0 : secondarySidebarElement.prepend(secondarySidebarAddonLocation);
1652
+ }
1653
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Portal, {
1654
+ container: primarySidebarAddonLocation
1655
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.PrimarySidebar)), /* @__PURE__ */ React.createElement(Portal, {
1656
+ container: contentElement
1657
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.Content)), /* @__PURE__ */ React.createElement(Portal, {
1658
+ container: secondarySidebarAddonLocation
1659
+ }, addons.renderComponentsByLocation(TechDocsAddonLocations.SecondarySidebar)));
1660
+ };
1661
+
1616
1662
  const useStyles$1 = makeStyles({
1617
1663
  search: {
1618
1664
  width: "100%",
@@ -1625,41 +1671,18 @@ const useStyles$1 = makeStyles({
1625
1671
  const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
1626
1672
  const { withSearch = true, onReady } = props;
1627
1673
  const classes = useStyles$1();
1628
- const addons = useTechDocsAddons();
1629
1674
  const {
1630
1675
  entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },
1631
1676
  entityRef,
1632
- shadowRoot,
1633
1677
  setShadowRoot
1634
1678
  } = useTechDocsReaderPage();
1635
1679
  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);
1680
+ const handleAppend = useCallback((newShadowRoot) => {
1651
1681
  setShadowRoot(newShadowRoot);
1652
1682
  if (onReady instanceof Function) {
1653
1683
  onReady();
1654
1684
  }
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);
1685
+ }, [setShadowRoot, onReady]);
1663
1686
  if (entityMetadataLoading === false && !entityMetadata)
1664
1687
  return /* @__PURE__ */ React.createElement(ErrorPage, {
1665
1688
  status: "404",
@@ -1687,19 +1710,10 @@ const TechDocsReaderPageContent = withTechDocsReaderProvider((props) => {
1687
1710
  })), /* @__PURE__ */ React.createElement(Grid, {
1688
1711
  xs: 12,
1689
1712
  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))))));
1713
+ }, /* @__PURE__ */ React.createElement(TechDocsShadowDom, {
1714
+ element: dom,
1715
+ onAppend: handleAppend
1716
+ }, /* @__PURE__ */ React.createElement(TechDocsReaderPageContentAddons, null)))));
1703
1717
  });
1704
1718
  const Reader = TechDocsReaderPageContent;
1705
1719
 
@@ -2182,7 +2196,7 @@ const EntityTechdocsContent = techdocsPlugin.provide(createRoutableExtension({
2182
2196
  }));
2183
2197
  const TechDocsCustomHome = techdocsPlugin.provide(createRoutableExtension({
2184
2198
  name: "TechDocsCustomHome",
2185
- component: () => import('./TechDocsCustomHome-b77adc6d.esm.js').then((m) => m.TechDocsCustomHome),
2199
+ component: () => import('./TechDocsCustomHome-778a795b.esm.js').then((m) => m.TechDocsCustomHome),
2186
2200
  mountPoint: rootRouteRef
2187
2201
  }));
2188
2202
  const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
@@ -2192,7 +2206,7 @@ const TechDocsIndexPage$2 = techdocsPlugin.provide(createRoutableExtension({
2192
2206
  }));
2193
2207
  const TechDocsReaderPage = techdocsPlugin.provide(createRoutableExtension({
2194
2208
  name: "TechDocsReaderPage",
2195
- component: () => import('./index-52f21300.esm.js').then((m) => m.TechDocsReaderPage),
2209
+ component: () => import('./index-d4a4af9b.esm.js').then((m) => m.TechDocsReaderPage),
2196
2210
  mountPoint: rootDocsRouteRef
2197
2211
  }));
2198
2212
 
@@ -2233,17 +2247,27 @@ const EmbeddedDocsRouter = (props) => {
2233
2247
  var _a;
2234
2248
  const { children } = props;
2235
2249
  const { entity } = useEntity();
2250
+ const element = useRoutes([
2251
+ {
2252
+ path: "/*",
2253
+ element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
2254
+ entity
2255
+ }),
2256
+ children: [
2257
+ {
2258
+ path: "/*",
2259
+ element: children
2260
+ }
2261
+ ]
2262
+ }
2263
+ ]);
2236
2264
  const projectId = (_a = entity.metadata.annotations) == null ? void 0 : _a[TECHDOCS_ANNOTATION];
2237
2265
  if (!projectId) {
2238
2266
  return /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, {
2239
2267
  annotation: TECHDOCS_ANNOTATION
2240
2268
  });
2241
2269
  }
2242
- return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
2243
- element: /* @__PURE__ */ React.createElement(EntityPageDocs, {
2244
- entity
2245
- })
2246
- }, children));
2270
+ return element;
2247
2271
  };
2248
2272
 
2249
2273
  var Router$1 = /*#__PURE__*/Object.freeze({
@@ -2253,5 +2277,5 @@ var Router$1 = /*#__PURE__*/Object.freeze({
2253
2277
  EmbeddedDocsRouter: EmbeddedDocsRouter
2254
2278
  });
2255
2279
 
2256
- export { isTechDocsAvailable as A, Router as B, EmbeddedDocsRouter as C, 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, TechDocsReaderPageHeader as l, TechDocsReaderPageContent as m, TechDocsReaderProvider as n, useTechDocsReaderDom as o, TechDocsReaderPageSubheader as p, TechDocsStateIndicator as q, TechDocsSearchResultListItem as r, TechDocsSearch as s, techdocsPlugin as t, useTechDocsReader as u, EntityListDocsGrid as v, withTechDocsReaderProvider as w, EntityListDocsTable as x, DefaultTechDocsHome as y, TechDocsPicker as z };
2257
- //# sourceMappingURL=index-c537b1f3.esm.js.map
2280
+ 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 };
2281
+ //# sourceMappingURL=index-9202d491.esm.js.map