@redocly/theme 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Markdown/Admonition.d.ts +3 -1
- package/lib/Markdown/Admonition.js +2 -2
- package/lib/Markdown/CodeSample/CodeSample.d.ts +3 -1
- package/lib/Markdown/CodeSample/CodeSample.js +2 -2
- package/lib/Markdown/Heading.d.ts +3 -1
- package/lib/Markdown/Heading.js +6 -4
- package/lib/Markdown/Mermaid.d.ts +3 -1
- package/lib/Markdown/Mermaid.js +2 -2
- package/lib/Sidebar/MenuGroup.js +1 -1
- package/lib/config.d.ts +123 -37
- package/lib/config.js +32 -32
- package/lib/globalStyle.js +2 -1
- package/lib/icons/AnchorIcon/AnchorIcon.d.ts +7 -0
- package/lib/icons/AnchorIcon/AnchorIcon.js +23 -0
- package/lib/icons/AnchorIcon/index.d.ts +2 -0
- package/lib/icons/AnchorIcon/index.js +6 -0
- package/lib/icons/ArrowIcon/ArrowIcon.d.ts +1 -0
- package/lib/icons/ArrowIcon/ArrowIcon.js +1 -0
- package/lib/icons/index.d.ts +1 -0
- package/lib/icons/index.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
- package/src/Markdown/Admonition.tsx +10 -1
- package/src/Markdown/CodeSample/CodeSample.tsx +15 -2
- package/src/Markdown/Heading.tsx +12 -18
- package/src/Markdown/Mermaid.tsx +9 -1
- package/src/Sidebar/MenuGroup.tsx +4 -1
- package/src/config.ts +35 -32
- package/src/globalStyle.ts +2 -1
- package/src/icons/AnchorIcon/AnchorIcon.tsx +36 -0
- package/src/icons/AnchorIcon/index.ts +2 -0
- package/src/icons/ArrowIcon/ArrowIcon.tsx +2 -0
- package/src/icons/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types/portal/src/shared/types/nav.d.ts +1 -1
|
@@ -4,6 +4,8 @@ interface AdmonitionTypeProps {
|
|
|
4
4
|
}
|
|
5
5
|
export interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
|
|
6
6
|
name?: string;
|
|
7
|
+
'data-source'?: string;
|
|
8
|
+
'data-hash'?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function Admonition({ type, name, children, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
|
|
10
|
+
export declare function Admonition({ type, name, children, 'data-source': dataSource, 'data-hash': dataHash, }: React.PropsWithChildren<AdmonitionProps>): JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -7,8 +7,8 @@ exports.Admonition = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const AlertIcon_1 = require("../icons/AlertIcon/AlertIcon");
|
|
10
|
-
function Admonition({ type = 'info', name, children, }) {
|
|
11
|
-
return (react_1.default.createElement(Wrapper, { type: type, "data-component-name": "Markdown/Admonition" },
|
|
10
|
+
function Admonition({ type = 'info', name, children, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
11
|
+
return (react_1.default.createElement(Wrapper, { type: type, "data-component-name": "Markdown/Admonition", "data-source": dataSource, "data-hash": dataHash },
|
|
12
12
|
react_1.default.createElement(AlertIcon_1.AlertIcon, { type: type }),
|
|
13
13
|
name ? react_1.default.createElement(Heading, { type: type }, name) : null,
|
|
14
14
|
react_1.default.createElement(Content, null, children)));
|
|
@@ -3,5 +3,7 @@ export type CodeSampleProps = {
|
|
|
3
3
|
language: string;
|
|
4
4
|
highlighted: string;
|
|
5
5
|
rawContent: string;
|
|
6
|
+
'data-source'?: string;
|
|
7
|
+
'data-hash'?: string;
|
|
6
8
|
};
|
|
7
|
-
export declare function CodeSample({ rawContent, highlighted, language }: CodeSampleProps): JSX.Element;
|
|
9
|
+
export declare function CodeSample({ rawContent, highlighted, language, 'data-source': dataSource, 'data-hash': dataHash, }: CodeSampleProps): JSX.Element;
|
|
@@ -29,7 +29,7 @@ const styled_components_1 = __importStar(require("styled-components"));
|
|
|
29
29
|
const ClipboardService_1 = require("../../utils/ClipboardService");
|
|
30
30
|
const useThemeConfig_1 = require("../../hooks/useThemeConfig");
|
|
31
31
|
const Feedback_1 = require("../../Feedback");
|
|
32
|
-
function CodeSample({ rawContent, highlighted, language }) {
|
|
32
|
+
function CodeSample({ rawContent, highlighted, language, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
33
33
|
const langClassName = language ? `language-${language}` : '';
|
|
34
34
|
const { codeSnippet: { copy = {}, report = {} } = {} } = (0, useThemeConfig_1.useThemeConfig)();
|
|
35
35
|
const [isCopied, setIsCopied] = (0, react_1.useState)(false);
|
|
@@ -39,7 +39,7 @@ function CodeSample({ rawContent, highlighted, language }) {
|
|
|
39
39
|
setIsCopied(true);
|
|
40
40
|
setTimeout(() => setIsCopied(false), copy.toasterDuration || 1500);
|
|
41
41
|
};
|
|
42
|
-
return (react_1.default.createElement(Wrapper, { className: "code-sample", "data-component-name": "Markdown/CodeSample/CodeSample" },
|
|
42
|
+
return (react_1.default.createElement(Wrapper, { className: "code-sample", "data-component-name": "Markdown/CodeSample/CodeSample", "data-source": dataSource, "data-hash": dataHash },
|
|
43
43
|
react_1.default.createElement(CodeSampleButtonContainer, null,
|
|
44
44
|
!copy.hide && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
45
|
!isCopied && (react_1.default.createElement(Button, { onClick: () => copyCode(rawContent), title: copy.tooltipText || 'Copy to clipboard' }, copy.buttonText || 'Copy')),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
-
export declare function Heading({ level, id, children, }: PropsWithChildren<{
|
|
2
|
+
export declare function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, }: PropsWithChildren<{
|
|
3
3
|
level: number;
|
|
4
4
|
id: string;
|
|
5
|
+
'data-source'?: string;
|
|
6
|
+
'data-hash'?: string;
|
|
5
7
|
}>): JSX.Element;
|
package/lib/Markdown/Heading.js
CHANGED
|
@@ -26,18 +26,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Heading = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const utils_1 = require("../utils");
|
|
29
|
+
const icons_1 = require("../icons");
|
|
29
30
|
/**
|
|
30
31
|
* Class name for all MD tags
|
|
31
32
|
*/
|
|
32
33
|
const mdClassName = 'md';
|
|
33
|
-
|
|
34
|
-
react_1.default.createElement("
|
|
35
|
-
|
|
36
|
-
const linkEl = (react_1.default.createElement("a", { href: `#${id}`, className: (0, utils_1.concatClassNames)('anchor', 'before') }, SvgIcon));
|
|
34
|
+
function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
35
|
+
const linkEl = (react_1.default.createElement("a", { href: `#${id}`, className: (0, utils_1.concatClassNames)('anchor', 'before') },
|
|
36
|
+
react_1.default.createElement(icons_1.AnchorIcon, null)));
|
|
37
37
|
return (0, react_1.createElement)(`h${level}`, {
|
|
38
38
|
id,
|
|
39
39
|
className: (0, utils_1.concatClassNames)('heading-anchor', mdClassName),
|
|
40
40
|
'data-component-name': 'Markdown/Heading',
|
|
41
|
+
'data-source': dataSource,
|
|
42
|
+
'data-hash': dataHash,
|
|
41
43
|
}, react_1.default.createElement(react_1.default.Fragment, null,
|
|
42
44
|
linkEl,
|
|
43
45
|
children));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
type MermaidProps = {
|
|
3
3
|
diagramHtml: string;
|
|
4
|
+
'data-source'?: string;
|
|
5
|
+
'data-hash'?: string;
|
|
4
6
|
};
|
|
5
|
-
export declare function Mermaid({ diagramHtml }: MermaidProps): JSX.Element;
|
|
7
|
+
export declare function Mermaid({ diagramHtml, 'data-source': dataSource, 'data-hash': dataHash, }: MermaidProps): JSX.Element;
|
|
6
8
|
export {};
|
package/lib/Markdown/Mermaid.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Mermaid = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
function Mermaid({ diagramHtml }) {
|
|
10
|
-
return (react_1.default.createElement(Wrapper, { className: "mermaid-wrapper", dangerouslySetInnerHTML: { __html: diagramHtml }, "data-component-name": "Markdown/Mermaid" }));
|
|
9
|
+
function Mermaid({ diagramHtml, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
10
|
+
return (react_1.default.createElement(Wrapper, { className: "mermaid-wrapper", dangerouslySetInnerHTML: { __html: diagramHtml }, "data-component-name": "Markdown/Mermaid", "data-source": dataSource, "data-hash": dataHash }));
|
|
11
11
|
}
|
|
12
12
|
exports.Mermaid = Mermaid;
|
|
13
13
|
const Wrapper = styled_components_1.default.div `
|
package/lib/Sidebar/MenuGroup.js
CHANGED
|
@@ -53,7 +53,7 @@ function MenuGroup({ item, isExpanded, toggleExpanded, children, }) {
|
|
|
53
53
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "Sidebar/MenuGroup" },
|
|
54
54
|
react_1.default.createElement(MenuLinkItem_1.MenuLinkItem, { item: item },
|
|
55
55
|
react_1.default.createElement(MenuGroupLabel, { onClick: toggleExpanded, isAlwaysExpanded: item.expanded === 'always', active: item.active },
|
|
56
|
-
react_1.default.createElement(MenuGroupArrow, { direction: isExpanded ? 'down' : 'right' }),
|
|
56
|
+
react_1.default.createElement(MenuGroupArrow, { visibility: item.items.length ? 'visible' : 'hidden', direction: isExpanded ? 'down' : 'right' }),
|
|
57
57
|
item.label)),
|
|
58
58
|
react_1.default.createElement(MenuWrapper, { isExpanded: isExpanded }, showChildren ? children : null),
|
|
59
59
|
item.separatorLine ? react_1.default.createElement(SeparatorLine_1.SeparatorLine, null) : null));
|
package/lib/config.d.ts
CHANGED
|
@@ -1,4 +1,88 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
declare const MarkdownConfig: z.ZodDefault<z.ZodObject<{
|
|
3
|
+
frontMatterKeysToResolve: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
4
|
+
lastUpdatedBlock: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
|
|
5
|
+
format: z.ZodOptional<z.ZodDefault<z.ZodEnum<["timeago", "iso", "long", "short"]>>>;
|
|
6
|
+
locale: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
7
|
+
}, {
|
|
8
|
+
hide: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
}>, "strip", z.ZodTypeAny, {
|
|
10
|
+
hide?: boolean | undefined;
|
|
11
|
+
format?: "timeago" | "iso" | "long" | "short" | undefined;
|
|
12
|
+
locale?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
hide?: boolean | undefined;
|
|
15
|
+
format?: "timeago" | "iso" | "long" | "short" | undefined;
|
|
16
|
+
locale?: string | undefined;
|
|
17
|
+
}>>>;
|
|
18
|
+
toc: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
|
|
19
|
+
header: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
20
|
+
depth: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
21
|
+
}, {
|
|
22
|
+
hide: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
}>, "strip", z.ZodTypeAny, {
|
|
24
|
+
hide?: boolean | undefined;
|
|
25
|
+
header?: string | undefined;
|
|
26
|
+
depth?: number | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
hide?: boolean | undefined;
|
|
29
|
+
header?: string | undefined;
|
|
30
|
+
depth?: number | undefined;
|
|
31
|
+
}>>>;
|
|
32
|
+
editPage: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
|
|
33
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
34
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
35
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
36
|
+
}, {
|
|
37
|
+
hide: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
}>, "strip", z.ZodTypeAny, {
|
|
39
|
+
hide?: boolean | undefined;
|
|
40
|
+
baseUrl?: string | undefined;
|
|
41
|
+
icon?: string | undefined;
|
|
42
|
+
text: string;
|
|
43
|
+
}, {
|
|
44
|
+
hide?: boolean | undefined;
|
|
45
|
+
baseUrl?: string | undefined;
|
|
46
|
+
icon?: string | undefined;
|
|
47
|
+
text?: string | undefined;
|
|
48
|
+
}>>>;
|
|
49
|
+
}, "strict", z.ZodTypeAny, {
|
|
50
|
+
frontMatterKeysToResolve?: string[] | undefined;
|
|
51
|
+
lastUpdatedBlock?: {
|
|
52
|
+
hide?: boolean | undefined;
|
|
53
|
+
format?: "timeago" | "iso" | "long" | "short" | undefined;
|
|
54
|
+
locale?: string | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
editPage?: {
|
|
57
|
+
hide?: boolean | undefined;
|
|
58
|
+
baseUrl?: string | undefined;
|
|
59
|
+
icon?: string | undefined;
|
|
60
|
+
text: string;
|
|
61
|
+
} | undefined;
|
|
62
|
+
toc: {
|
|
63
|
+
hide?: boolean | undefined;
|
|
64
|
+
header?: string | undefined;
|
|
65
|
+
depth?: number | undefined;
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
frontMatterKeysToResolve?: string[] | undefined;
|
|
69
|
+
lastUpdatedBlock?: {
|
|
70
|
+
hide?: boolean | undefined;
|
|
71
|
+
format?: "timeago" | "iso" | "long" | "short" | undefined;
|
|
72
|
+
locale?: string | undefined;
|
|
73
|
+
} | undefined;
|
|
74
|
+
toc?: {
|
|
75
|
+
hide?: boolean | undefined;
|
|
76
|
+
header?: string | undefined;
|
|
77
|
+
depth?: number | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
editPage?: {
|
|
80
|
+
hide?: boolean | undefined;
|
|
81
|
+
baseUrl?: string | undefined;
|
|
82
|
+
icon?: string | undefined;
|
|
83
|
+
text?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
}>>;
|
|
2
86
|
export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
3
87
|
imports: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
|
|
4
88
|
logo: z.ZodOptional<z.ZodObject<{
|
|
@@ -417,9 +501,9 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
417
501
|
text: string;
|
|
418
502
|
}, {
|
|
419
503
|
hide?: boolean | undefined;
|
|
420
|
-
text?: string | undefined;
|
|
421
504
|
baseUrl?: string | undefined;
|
|
422
505
|
icon?: string | undefined;
|
|
506
|
+
text?: string | undefined;
|
|
423
507
|
}>>>;
|
|
424
508
|
}, "strict", z.ZodTypeAny, {
|
|
425
509
|
frontMatterKeysToResolve?: string[] | undefined;
|
|
@@ -453,9 +537,9 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
453
537
|
} | undefined;
|
|
454
538
|
editPage?: {
|
|
455
539
|
hide?: boolean | undefined;
|
|
456
|
-
text?: string | undefined;
|
|
457
540
|
baseUrl?: string | undefined;
|
|
458
541
|
icon?: string | undefined;
|
|
542
|
+
text?: string | undefined;
|
|
459
543
|
} | undefined;
|
|
460
544
|
}>>>;
|
|
461
545
|
openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
|
|
@@ -479,6 +563,23 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
479
563
|
logoutRedirect?: string | undefined;
|
|
480
564
|
}>>>;
|
|
481
565
|
}, "passthrough", z.ZodTypeAny, {
|
|
566
|
+
links?: {
|
|
567
|
+
type?: string | undefined;
|
|
568
|
+
crossorigin?: string | undefined;
|
|
569
|
+
fetchpriority?: string | undefined;
|
|
570
|
+
integrity?: string | undefined;
|
|
571
|
+
referrerpolicy?: string | undefined;
|
|
572
|
+
as?: string | undefined;
|
|
573
|
+
hreflang?: string | undefined;
|
|
574
|
+
imagesizes?: string | undefined;
|
|
575
|
+
imagesrcset?: string | undefined;
|
|
576
|
+
media?: string | undefined;
|
|
577
|
+
prefetch?: string | undefined;
|
|
578
|
+
rel?: string | undefined;
|
|
579
|
+
sizes?: string | undefined;
|
|
580
|
+
title?: string | undefined;
|
|
581
|
+
href: string;
|
|
582
|
+
}[] | undefined;
|
|
482
583
|
imports?: string[] | undefined;
|
|
483
584
|
logo?: {
|
|
484
585
|
image?: string | undefined;
|
|
@@ -526,23 +627,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
526
627
|
src: string;
|
|
527
628
|
}[] | undefined;
|
|
528
629
|
} | undefined;
|
|
529
|
-
links?: {
|
|
530
|
-
type?: string | undefined;
|
|
531
|
-
crossorigin?: string | undefined;
|
|
532
|
-
fetchpriority?: string | undefined;
|
|
533
|
-
integrity?: string | undefined;
|
|
534
|
-
referrerpolicy?: string | undefined;
|
|
535
|
-
as?: string | undefined;
|
|
536
|
-
hreflang?: string | undefined;
|
|
537
|
-
imagesizes?: string | undefined;
|
|
538
|
-
imagesrcset?: string | undefined;
|
|
539
|
-
media?: string | undefined;
|
|
540
|
-
prefetch?: string | undefined;
|
|
541
|
-
rel?: string | undefined;
|
|
542
|
-
sizes?: string | undefined;
|
|
543
|
-
title?: string | undefined;
|
|
544
|
-
href: string;
|
|
545
|
-
}[] | undefined;
|
|
546
630
|
feedback?: {
|
|
547
631
|
hide?: boolean | undefined;
|
|
548
632
|
settings?: string | undefined;
|
|
@@ -611,6 +695,23 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
611
695
|
logoutRedirect?: string | undefined;
|
|
612
696
|
};
|
|
613
697
|
}, {
|
|
698
|
+
links?: {
|
|
699
|
+
type?: string | undefined;
|
|
700
|
+
crossorigin?: string | undefined;
|
|
701
|
+
fetchpriority?: string | undefined;
|
|
702
|
+
integrity?: string | undefined;
|
|
703
|
+
referrerpolicy?: string | undefined;
|
|
704
|
+
as?: string | undefined;
|
|
705
|
+
hreflang?: string | undefined;
|
|
706
|
+
imagesizes?: string | undefined;
|
|
707
|
+
imagesrcset?: string | undefined;
|
|
708
|
+
media?: string | undefined;
|
|
709
|
+
prefetch?: string | undefined;
|
|
710
|
+
rel?: string | undefined;
|
|
711
|
+
sizes?: string | undefined;
|
|
712
|
+
title?: string | undefined;
|
|
713
|
+
href: string;
|
|
714
|
+
}[] | undefined;
|
|
614
715
|
imports?: string[] | undefined;
|
|
615
716
|
logo?: {
|
|
616
717
|
image?: string | undefined;
|
|
@@ -658,23 +759,6 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
658
759
|
src: string;
|
|
659
760
|
}[] | undefined;
|
|
660
761
|
} | undefined;
|
|
661
|
-
links?: {
|
|
662
|
-
type?: string | undefined;
|
|
663
|
-
crossorigin?: string | undefined;
|
|
664
|
-
fetchpriority?: string | undefined;
|
|
665
|
-
integrity?: string | undefined;
|
|
666
|
-
referrerpolicy?: string | undefined;
|
|
667
|
-
as?: string | undefined;
|
|
668
|
-
hreflang?: string | undefined;
|
|
669
|
-
imagesizes?: string | undefined;
|
|
670
|
-
imagesrcset?: string | undefined;
|
|
671
|
-
media?: string | undefined;
|
|
672
|
-
prefetch?: string | undefined;
|
|
673
|
-
rel?: string | undefined;
|
|
674
|
-
sizes?: string | undefined;
|
|
675
|
-
title?: string | undefined;
|
|
676
|
-
href: string;
|
|
677
|
-
}[] | undefined;
|
|
678
762
|
feedback?: {
|
|
679
763
|
type?: string | undefined;
|
|
680
764
|
hide?: boolean | undefined;
|
|
@@ -728,9 +812,9 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
728
812
|
} | undefined;
|
|
729
813
|
editPage?: {
|
|
730
814
|
hide?: boolean | undefined;
|
|
731
|
-
text?: string | undefined;
|
|
732
815
|
baseUrl?: string | undefined;
|
|
733
816
|
icon?: string | undefined;
|
|
817
|
+
text?: string | undefined;
|
|
734
818
|
} | undefined;
|
|
735
819
|
} | undefined;
|
|
736
820
|
openapi?: {} | undefined;
|
|
@@ -759,3 +843,5 @@ export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 's
|
|
|
759
843
|
shortcuts?: string[];
|
|
760
844
|
};
|
|
761
845
|
};
|
|
846
|
+
export type MarkdownConfig = z.infer<typeof MarkdownConfig>;
|
|
847
|
+
export {};
|
package/lib/config.js
CHANGED
|
@@ -47,6 +47,37 @@ const LinksConfig = zod_1.z
|
|
|
47
47
|
type: zod_1.z.string().optional(),
|
|
48
48
|
})
|
|
49
49
|
.passthrough();
|
|
50
|
+
const MarkdownConfig = zod_1.z
|
|
51
|
+
.object({
|
|
52
|
+
frontMatterKeysToResolve: zod_1.z.array(zod_1.z.string()).default(['image', 'links']).optional(),
|
|
53
|
+
lastUpdatedBlock: zod_1.z
|
|
54
|
+
.object({
|
|
55
|
+
format: zod_1.z.enum(['timeago', 'iso', 'long', 'short']).default('timeago').optional(),
|
|
56
|
+
locale: zod_1.z.string().default('en-US').optional(),
|
|
57
|
+
})
|
|
58
|
+
.extend(HideConfig.shape)
|
|
59
|
+
.default({})
|
|
60
|
+
.optional(),
|
|
61
|
+
toc: zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
header: zod_1.z.string().default('On this page').optional(),
|
|
64
|
+
depth: zod_1.z.number().default(3).optional(),
|
|
65
|
+
})
|
|
66
|
+
.extend(HideConfig.shape)
|
|
67
|
+
.optional()
|
|
68
|
+
.default({}),
|
|
69
|
+
editPage: zod_1.z
|
|
70
|
+
.object({
|
|
71
|
+
baseUrl: zod_1.z.string().optional(),
|
|
72
|
+
icon: zod_1.z.string().optional(),
|
|
73
|
+
text: zod_1.z.string().optional().default('Edit this page'),
|
|
74
|
+
})
|
|
75
|
+
.extend(HideConfig.shape)
|
|
76
|
+
.default({})
|
|
77
|
+
.optional(),
|
|
78
|
+
})
|
|
79
|
+
.strict()
|
|
80
|
+
.default({});
|
|
50
81
|
exports.ThemeConfig = zod_1.z
|
|
51
82
|
.object({
|
|
52
83
|
imports: zod_1.z.array(zod_1.z.string()).default([]).optional(),
|
|
@@ -141,38 +172,7 @@ exports.ThemeConfig = zod_1.z
|
|
|
141
172
|
.strict()
|
|
142
173
|
.default({})
|
|
143
174
|
.optional(),
|
|
144
|
-
markdown:
|
|
145
|
-
.object({
|
|
146
|
-
frontMatterKeysToResolve: zod_1.z.array(zod_1.z.string()).default(['image', 'links']).optional(),
|
|
147
|
-
lastUpdatedBlock: zod_1.z
|
|
148
|
-
.object({
|
|
149
|
-
format: zod_1.z.enum(['timeago', 'iso', 'long', 'short']).default('timeago').optional(),
|
|
150
|
-
locale: zod_1.z.string().default('en-US').optional(),
|
|
151
|
-
})
|
|
152
|
-
.extend(HideConfig.shape)
|
|
153
|
-
.default({})
|
|
154
|
-
.optional(),
|
|
155
|
-
toc: zod_1.z
|
|
156
|
-
.object({
|
|
157
|
-
header: zod_1.z.string().default('On this page').optional(),
|
|
158
|
-
depth: zod_1.z.number().default(3).optional(),
|
|
159
|
-
})
|
|
160
|
-
.extend(HideConfig.shape)
|
|
161
|
-
.optional()
|
|
162
|
-
.default({}),
|
|
163
|
-
editPage: zod_1.z
|
|
164
|
-
.object({
|
|
165
|
-
baseUrl: zod_1.z.string().optional(),
|
|
166
|
-
icon: zod_1.z.string().optional(),
|
|
167
|
-
text: zod_1.z.string().optional().default('Edit this page'),
|
|
168
|
-
})
|
|
169
|
-
.extend(HideConfig.shape)
|
|
170
|
-
.default({})
|
|
171
|
-
.optional(),
|
|
172
|
-
})
|
|
173
|
-
.strict()
|
|
174
|
-
.default({})
|
|
175
|
-
.optional(),
|
|
175
|
+
markdown: MarkdownConfig.optional(),
|
|
176
176
|
openapi: zod_1.z.object({}).passthrough().optional(),
|
|
177
177
|
graphql: zod_1.z.object({}).passthrough().optional(),
|
|
178
178
|
analytics: zod_1.z.any().optional(),
|
package/lib/globalStyle.js
CHANGED
|
@@ -872,6 +872,7 @@ const apiReferencePanels = (0, styled_components_1.css) `
|
|
|
872
872
|
*/
|
|
873
873
|
|
|
874
874
|
.panel-try-it,
|
|
875
|
+
.panel-pull-right,
|
|
875
876
|
.panel-request-samples,
|
|
876
877
|
.panel-response-samples,
|
|
877
878
|
.panel-callback-samples {
|
|
@@ -1659,7 +1660,7 @@ const loadProgressBar = (0, styled_components_1.css) `
|
|
|
1659
1660
|
#nprogress .peg {
|
|
1660
1661
|
display: block;
|
|
1661
1662
|
position: absolute;
|
|
1662
|
-
right:
|
|
1663
|
+
right: 0;
|
|
1663
1664
|
width: 100px;
|
|
1664
1665
|
height: 100%;
|
|
1665
1666
|
box-shadow: var(--load-progress-bar-shadow);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface AnchorIconProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const AnchorIcon: import("styled-components").StyledComponent<({ className }: AnchorIconProps) => JSX.Element, any, {
|
|
6
|
+
'data-component-name': string;
|
|
7
|
+
}, "data-component-name">;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AnchorIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Icon = ({ className }) => (react_1.default.createElement("svg", { "aria-hidden": "true", focusable: "false", height: "16", version: "1.1", viewBox: "0 0 16 16", width: "16", className: className },
|
|
10
|
+
react_1.default.createElement("path", { fillRule: "evenodd", d: "M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" })));
|
|
11
|
+
exports.AnchorIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
12
|
+
'data-component-name': 'icons/AnchorIcon/AnchorIcon',
|
|
13
|
+
})) `
|
|
14
|
+
fill: var(--heading-anchor-color);
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
|
|
18
|
+
background-image: var(--heading-anchor-icon);
|
|
19
|
+
background-size: contain;
|
|
20
|
+
background-repeat: no-repeat;
|
|
21
|
+
background-position: center;
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=AnchorIcon.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnchorIcon = void 0;
|
|
4
|
+
var AnchorIcon_1 = require("../../icons/AnchorIcon/AnchorIcon");
|
|
5
|
+
Object.defineProperty(exports, "AnchorIcon", { enumerable: true, get: function () { return AnchorIcon_1.AnchorIcon; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface ArrowIconProps {
|
|
3
3
|
direction?: 'up' | 'right' | 'left' | 'down';
|
|
4
|
+
visibility?: 'visible' | 'hidden';
|
|
4
5
|
}
|
|
5
6
|
export declare const ArrowIcon: import("styled-components").StyledComponent<({ className }: {
|
|
6
7
|
className?: string | undefined;
|
|
@@ -26,6 +26,7 @@ exports.ArrowIcon = (0, styled_components_1.default)(Icon) `
|
|
|
26
26
|
height: var(--sidebar-group-item-chevron-size);
|
|
27
27
|
fill: var(--sidebar-group-item-chevron-color);
|
|
28
28
|
transform: rotate(${directionToTransform}deg);
|
|
29
|
+
visibility: ${({ visibility = 'visible' }) => visibility};
|
|
29
30
|
|
|
30
31
|
vertical-align: middle;
|
|
31
32
|
`;
|
package/lib/icons/index.d.ts
CHANGED
package/lib/icons/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("../icons/ShelfIcon"), exports);
|
|
|
18
18
|
__exportStar(require("../icons/AlertIcon"), exports);
|
|
19
19
|
__exportStar(require("../icons/ArrowIcon"), exports);
|
|
20
20
|
__exportStar(require("../icons/ColorModeIcon"), exports);
|
|
21
|
+
__exportStar(require("../icons/AnchorIcon"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -38,4 +38,5 @@ __exportStar(require("./Sidebar"), exports);
|
|
|
38
38
|
__exportStar(require("./types/config"), exports);
|
|
39
39
|
__exportStar(require("./config"), exports);
|
|
40
40
|
__exportStar(require("./Pages"), exports);
|
|
41
|
+
__exportStar(require("./Markdown"), exports);
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -9,15 +9,24 @@ interface AdmonitionTypeProps {
|
|
|
9
9
|
|
|
10
10
|
export interface AdmonitionProps extends Partial<AdmonitionTypeProps> {
|
|
11
11
|
name?: string;
|
|
12
|
+
'data-source'?: string;
|
|
13
|
+
'data-hash'?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export function Admonition({
|
|
15
17
|
type = 'info',
|
|
16
18
|
name,
|
|
17
19
|
children,
|
|
20
|
+
'data-source': dataSource,
|
|
21
|
+
'data-hash': dataHash,
|
|
18
22
|
}: React.PropsWithChildren<AdmonitionProps>): JSX.Element {
|
|
19
23
|
return (
|
|
20
|
-
<Wrapper
|
|
24
|
+
<Wrapper
|
|
25
|
+
type={type}
|
|
26
|
+
data-component-name="Markdown/Admonition"
|
|
27
|
+
data-source={dataSource}
|
|
28
|
+
data-hash={dataHash}
|
|
29
|
+
>
|
|
21
30
|
<AlertIcon type={type} />
|
|
22
31
|
{name ? <Heading type={type}>{name}</Heading> : null}
|
|
23
32
|
<Content>{children}</Content>
|
|
@@ -9,9 +9,17 @@ export type CodeSampleProps = {
|
|
|
9
9
|
language: string;
|
|
10
10
|
highlighted: string;
|
|
11
11
|
rawContent: string;
|
|
12
|
+
'data-source'?: string;
|
|
13
|
+
'data-hash'?: string;
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
export function CodeSample({
|
|
16
|
+
export function CodeSample({
|
|
17
|
+
rawContent,
|
|
18
|
+
highlighted,
|
|
19
|
+
language,
|
|
20
|
+
'data-source': dataSource,
|
|
21
|
+
'data-hash': dataHash,
|
|
22
|
+
}: CodeSampleProps): JSX.Element {
|
|
15
23
|
const langClassName = language ? `language-${language}` : '';
|
|
16
24
|
const { codeSnippet: { copy = {}, report = {} } = {} } = useThemeConfig();
|
|
17
25
|
|
|
@@ -26,7 +34,12 @@ export function CodeSample({ rawContent, highlighted, language }: CodeSampleProp
|
|
|
26
34
|
};
|
|
27
35
|
|
|
28
36
|
return (
|
|
29
|
-
<Wrapper
|
|
37
|
+
<Wrapper
|
|
38
|
+
className="code-sample"
|
|
39
|
+
data-component-name="Markdown/CodeSample/CodeSample"
|
|
40
|
+
data-source={dataSource}
|
|
41
|
+
data-hash={dataHash}
|
|
42
|
+
>
|
|
30
43
|
<CodeSampleButtonContainer>
|
|
31
44
|
{!copy.hide && (
|
|
32
45
|
<>
|
package/src/Markdown/Heading.tsx
CHANGED
|
@@ -3,36 +3,28 @@ import React, { createElement } from 'react';
|
|
|
3
3
|
import type { PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
5
|
import { concatClassNames } from '@theme/utils';
|
|
6
|
+
import { AnchorIcon } from '@theme/icons';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Class name for all MD tags
|
|
9
10
|
*/
|
|
10
11
|
const mdClassName = 'md';
|
|
11
12
|
|
|
12
|
-
const SvgIcon = (
|
|
13
|
-
<svg
|
|
14
|
-
aria-hidden="true"
|
|
15
|
-
focusable="false"
|
|
16
|
-
height="16"
|
|
17
|
-
version="1.1"
|
|
18
|
-
viewBox="0 0 16 16"
|
|
19
|
-
width="16"
|
|
20
|
-
>
|
|
21
|
-
<path
|
|
22
|
-
fillRule="evenodd"
|
|
23
|
-
d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
|
|
24
|
-
></path>
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
|
|
28
13
|
export function Heading({
|
|
29
14
|
level,
|
|
30
15
|
id,
|
|
31
16
|
children,
|
|
32
|
-
|
|
17
|
+
'data-source': dataSource,
|
|
18
|
+
'data-hash': dataHash,
|
|
19
|
+
}: PropsWithChildren<{
|
|
20
|
+
level: number;
|
|
21
|
+
id: string;
|
|
22
|
+
'data-source'?: string;
|
|
23
|
+
'data-hash'?: string;
|
|
24
|
+
}>): JSX.Element {
|
|
33
25
|
const linkEl = (
|
|
34
26
|
<a href={`#${id}`} className={concatClassNames('anchor', 'before')}>
|
|
35
|
-
|
|
27
|
+
<AnchorIcon />
|
|
36
28
|
</a>
|
|
37
29
|
);
|
|
38
30
|
|
|
@@ -42,6 +34,8 @@ export function Heading({
|
|
|
42
34
|
id,
|
|
43
35
|
className: concatClassNames('heading-anchor', mdClassName),
|
|
44
36
|
'data-component-name': 'Markdown/Heading',
|
|
37
|
+
'data-source': dataSource,
|
|
38
|
+
'data-hash': dataHash,
|
|
45
39
|
},
|
|
46
40
|
<>
|
|
47
41
|
{linkEl}
|
package/src/Markdown/Mermaid.tsx
CHANGED
|
@@ -3,14 +3,22 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
type MermaidProps = {
|
|
5
5
|
diagramHtml: string;
|
|
6
|
+
'data-source'?: string;
|
|
7
|
+
'data-hash'?: string;
|
|
6
8
|
};
|
|
7
9
|
|
|
8
|
-
export function Mermaid({
|
|
10
|
+
export function Mermaid({
|
|
11
|
+
diagramHtml,
|
|
12
|
+
'data-source': dataSource,
|
|
13
|
+
'data-hash': dataHash,
|
|
14
|
+
}: MermaidProps): JSX.Element {
|
|
9
15
|
return (
|
|
10
16
|
<Wrapper
|
|
11
17
|
className="mermaid-wrapper"
|
|
12
18
|
dangerouslySetInnerHTML={{ __html: diagramHtml }}
|
|
13
19
|
data-component-name="Markdown/Mermaid"
|
|
20
|
+
data-source={dataSource}
|
|
21
|
+
data-hash={dataHash}
|
|
14
22
|
/>
|
|
15
23
|
);
|
|
16
24
|
}
|
|
@@ -43,7 +43,10 @@ export function MenuGroup({
|
|
|
43
43
|
isAlwaysExpanded={item.expanded === 'always'}
|
|
44
44
|
active={item.active}
|
|
45
45
|
>
|
|
46
|
-
<MenuGroupArrow
|
|
46
|
+
<MenuGroupArrow
|
|
47
|
+
visibility={item.items.length ? 'visible' : 'hidden'}
|
|
48
|
+
direction={isExpanded ? 'down' : 'right'}
|
|
49
|
+
/>
|
|
47
50
|
{item.label}
|
|
48
51
|
</MenuGroupLabel>
|
|
49
52
|
</MenuLinkItem>
|
package/src/config.ts
CHANGED
|
@@ -50,6 +50,38 @@ const LinksConfig = z
|
|
|
50
50
|
})
|
|
51
51
|
.passthrough();
|
|
52
52
|
|
|
53
|
+
const MarkdownConfig = z
|
|
54
|
+
.object({
|
|
55
|
+
frontMatterKeysToResolve: z.array(z.string()).default(['image', 'links']).optional(),
|
|
56
|
+
lastUpdatedBlock: z
|
|
57
|
+
.object({
|
|
58
|
+
format: z.enum(['timeago', 'iso', 'long', 'short']).default('timeago').optional(),
|
|
59
|
+
locale: z.string().default('en-US').optional(),
|
|
60
|
+
})
|
|
61
|
+
.extend(HideConfig.shape)
|
|
62
|
+
.default({})
|
|
63
|
+
.optional(),
|
|
64
|
+
toc: z
|
|
65
|
+
.object({
|
|
66
|
+
header: z.string().default('On this page').optional(),
|
|
67
|
+
depth: z.number().default(3).optional(),
|
|
68
|
+
})
|
|
69
|
+
.extend(HideConfig.shape)
|
|
70
|
+
.optional()
|
|
71
|
+
.default({}),
|
|
72
|
+
editPage: z
|
|
73
|
+
.object({
|
|
74
|
+
baseUrl: z.string().optional(),
|
|
75
|
+
icon: z.string().optional(),
|
|
76
|
+
text: z.string().optional().default('Edit this page'),
|
|
77
|
+
})
|
|
78
|
+
.extend(HideConfig.shape)
|
|
79
|
+
.default({})
|
|
80
|
+
.optional(),
|
|
81
|
+
})
|
|
82
|
+
.strict()
|
|
83
|
+
.default({});
|
|
84
|
+
|
|
53
85
|
export const ThemeConfig = z
|
|
54
86
|
.object({
|
|
55
87
|
imports: z.array(z.string()).default([]).optional(),
|
|
@@ -150,38 +182,7 @@ export const ThemeConfig = z
|
|
|
150
182
|
.strict()
|
|
151
183
|
.default({})
|
|
152
184
|
.optional(),
|
|
153
|
-
markdown:
|
|
154
|
-
.object({
|
|
155
|
-
frontMatterKeysToResolve: z.array(z.string()).default(['image', 'links']).optional(),
|
|
156
|
-
lastUpdatedBlock: z
|
|
157
|
-
.object({
|
|
158
|
-
format: z.enum(['timeago', 'iso', 'long', 'short']).default('timeago').optional(),
|
|
159
|
-
locale: z.string().default('en-US').optional(),
|
|
160
|
-
})
|
|
161
|
-
.extend(HideConfig.shape)
|
|
162
|
-
.default({})
|
|
163
|
-
.optional(),
|
|
164
|
-
toc: z
|
|
165
|
-
.object({
|
|
166
|
-
header: z.string().default('On this page').optional(),
|
|
167
|
-
depth: z.number().default(3).optional(),
|
|
168
|
-
})
|
|
169
|
-
.extend(HideConfig.shape)
|
|
170
|
-
.optional()
|
|
171
|
-
.default({}),
|
|
172
|
-
editPage: z
|
|
173
|
-
.object({
|
|
174
|
-
baseUrl: z.string().optional(),
|
|
175
|
-
icon: z.string().optional(),
|
|
176
|
-
text: z.string().optional().default('Edit this page'),
|
|
177
|
-
})
|
|
178
|
-
.extend(HideConfig.shape)
|
|
179
|
-
.default({})
|
|
180
|
-
.optional(),
|
|
181
|
-
})
|
|
182
|
-
.strict()
|
|
183
|
-
.default({})
|
|
184
|
-
.optional(),
|
|
185
|
+
markdown: MarkdownConfig.optional(),
|
|
185
186
|
openapi: z.object({}).passthrough().optional(),
|
|
186
187
|
graphql: z.object({}).passthrough().optional(),
|
|
187
188
|
analytics: z.any().optional(),
|
|
@@ -215,3 +216,5 @@ export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 's
|
|
|
215
216
|
shortcuts?: string[];
|
|
216
217
|
};
|
|
217
218
|
};
|
|
219
|
+
|
|
220
|
+
export type MarkdownConfig = z.infer<typeof MarkdownConfig>;
|
package/src/globalStyle.ts
CHANGED
|
@@ -880,6 +880,7 @@ const apiReferencePanels = css`
|
|
|
880
880
|
*/
|
|
881
881
|
|
|
882
882
|
.panel-try-it,
|
|
883
|
+
.panel-pull-right,
|
|
883
884
|
.panel-request-samples,
|
|
884
885
|
.panel-response-samples,
|
|
885
886
|
.panel-callback-samples {
|
|
@@ -1677,7 +1678,7 @@ const loadProgressBar = css`
|
|
|
1677
1678
|
#nprogress .peg {
|
|
1678
1679
|
display: block;
|
|
1679
1680
|
position: absolute;
|
|
1680
|
-
right:
|
|
1681
|
+
right: 0;
|
|
1681
1682
|
width: 100px;
|
|
1682
1683
|
height: 100%;
|
|
1683
1684
|
box-shadow: var(--load-progress-bar-shadow);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export interface AnchorIconProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Icon = ({ className }: AnchorIconProps) => (
|
|
9
|
+
<svg
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
focusable="false"
|
|
12
|
+
height="16"
|
|
13
|
+
version="1.1"
|
|
14
|
+
viewBox="0 0 16 16"
|
|
15
|
+
width="16"
|
|
16
|
+
className={className}
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
fillRule="evenodd"
|
|
20
|
+
d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const AnchorIcon = styled(Icon).attrs(() => ({
|
|
26
|
+
'data-component-name': 'icons/AnchorIcon/AnchorIcon',
|
|
27
|
+
}))`
|
|
28
|
+
fill: var(--heading-anchor-color);
|
|
29
|
+
visibility: hidden;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
background-image: var(--heading-anchor-icon);
|
|
33
|
+
background-size: contain;
|
|
34
|
+
background-repeat: no-repeat;
|
|
35
|
+
background-position: center;
|
|
36
|
+
`;
|
|
@@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
export interface ArrowIconProps {
|
|
5
5
|
direction?: 'up' | 'right' | 'left' | 'down';
|
|
6
|
+
visibility?: 'visible' | 'hidden';
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
function directionToTransform({ direction }: ArrowIconProps) {
|
|
@@ -31,6 +32,7 @@ export const ArrowIcon = styled(Icon)`
|
|
|
31
32
|
height: var(--sidebar-group-item-chevron-size);
|
|
32
33
|
fill: var(--sidebar-group-item-chevron-color);
|
|
33
34
|
transform: rotate(${directionToTransform}deg);
|
|
35
|
+
visibility: ${({ visibility = 'visible' }) => visibility};
|
|
34
36
|
|
|
35
37
|
vertical-align: middle;
|
|
36
38
|
`;
|
package/src/icons/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare type ResolvedNavItemWithLink = (ResolvedNavLinkItem | ResolvedNav
|
|
|
63
63
|
export declare type ResolvedSidebar = ResolvedNavItem[];
|
|
64
64
|
export interface PageProps {
|
|
65
65
|
seo?: {
|
|
66
|
-
title
|
|
66
|
+
title?: string;
|
|
67
67
|
};
|
|
68
68
|
frontmatter?: Omit<PageProps, 'frontmatter'> & {
|
|
69
69
|
settings?: any;
|