@redocly/theme 0.65.0-next.2 → 0.65.0-next.4
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/components/Banner/Banner.js +10 -2
- package/lib/components/Banner/variables.js +8 -1
- package/lib/components/Catalog/CatalogTags.js +1 -0
- package/lib/components/Catalog/variables.js +1 -0
- package/lib/components/Markdown/Markdown.js +92 -26
- package/lib/components/Markdown/styles/base-table.js +2 -1
- package/lib/components/Markdown/styles/heading-anchor.d.ts +1 -1
- package/lib/components/Markdown/styles/heading-anchor.js +1 -1
- package/lib/components/Markdown/styles/links.js +2 -1
- package/lib/components/PageActions/PageActions.js +1 -0
- package/lib/components/Search/variables.js +1 -3
- package/lib/core/constants/heading.d.ts +9 -0
- package/lib/core/constants/heading.js +13 -0
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/markdown.d.ts +1 -0
- package/lib/core/constants/markdown.js +5 -0
- package/lib/core/hooks/use-active-heading.js +2 -1
- package/lib/core/styles/dark.js +3 -3
- package/lib/core/styles/global.js +9 -8
- package/lib/core/styles/palette.dark.js +31 -0
- package/lib/core/styles/palette.js +53 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +2 -2
- package/lib/layouts/CodeWalkthroughLayout.js +3 -1
- package/lib/layouts/DocumentationLayout.js +3 -1
- package/lib/markdoc/components/Cards/Card.js +1 -0
- package/lib/markdoc/components/Heading/Heading.js +12 -24
- package/package.json +1 -1
- package/src/components/Banner/Banner.tsx +11 -3
- package/src/components/Banner/variables.ts +8 -1
- package/src/components/Catalog/CatalogTags.tsx +1 -0
- package/src/components/Catalog/variables.ts +1 -0
- package/src/components/Markdown/Markdown.tsx +102 -26
- package/src/components/Markdown/styles/base-table.ts +3 -1
- package/src/components/Markdown/styles/heading-anchor.ts +1 -1
- package/src/components/Markdown/styles/links.ts +2 -1
- package/src/components/PageActions/PageActions.tsx +1 -0
- package/src/components/Search/variables.ts +3 -3
- package/src/core/constants/heading.ts +9 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/markdown.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +2 -1
- package/src/core/styles/dark.ts +3 -3
- package/src/core/styles/global.ts +9 -8
- package/src/core/styles/palette.dark.ts +31 -0
- package/src/core/styles/palette.ts +53 -0
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +8 -2
- package/src/layouts/CodeWalkthroughLayout.tsx +3 -1
- package/src/layouts/DocumentationLayout.tsx +3 -1
- package/src/markdoc/components/Cards/Card.tsx +1 -0
- package/src/markdoc/components/Heading/Heading.tsx +36 -29
|
@@ -18,6 +18,11 @@ function brandPaletteLight(palette) {
|
|
|
18
18
|
--color-brand-10: #555761; // @presenter Color
|
|
19
19
|
--color-brand-11: #6e6f7a; // @presenter Color
|
|
20
20
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
21
|
+
|
|
22
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
23
|
+
|
|
24
|
+
--search-ai-gradient-start-color: var(--color-brand-10); // @presenter Color
|
|
25
|
+
--search-ai-gradient-end-color: var(--color-brand-7); // @presenter Color
|
|
21
26
|
`;
|
|
22
27
|
case 'pink':
|
|
23
28
|
return (0, styled_components_1.css) `
|
|
@@ -33,6 +38,11 @@ function brandPaletteLight(palette) {
|
|
|
33
38
|
--color-brand-10: #6a3055; // @presenter Color
|
|
34
39
|
--color-brand-11: #4f2841; // @presenter Color
|
|
35
40
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
41
|
+
|
|
42
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
43
|
+
|
|
44
|
+
--search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
|
|
45
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
36
46
|
`;
|
|
37
47
|
case 'coral':
|
|
38
48
|
return (0, styled_components_1.css) `
|
|
@@ -48,6 +58,11 @@ function brandPaletteLight(palette) {
|
|
|
48
58
|
--color-brand-10: #6d3338; // @presenter Color
|
|
49
59
|
--color-brand-11: #4f282b; // @presenter Color
|
|
50
60
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
61
|
+
|
|
62
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
63
|
+
|
|
64
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
65
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
51
66
|
`;
|
|
52
67
|
case 'amber':
|
|
53
68
|
return (0, styled_components_1.css) `
|
|
@@ -63,6 +78,11 @@ function brandPaletteLight(palette) {
|
|
|
63
78
|
--color-brand-10: #71512e; // @presenter Color
|
|
64
79
|
--color-brand-11: #4f3c28; // @presenter Color
|
|
65
80
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
81
|
+
|
|
82
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
83
|
+
|
|
84
|
+
--search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
|
|
85
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
66
86
|
`;
|
|
67
87
|
case 'jade':
|
|
68
88
|
return (0, styled_components_1.css) `
|
|
@@ -78,6 +98,11 @@ function brandPaletteLight(palette) {
|
|
|
78
98
|
--color-brand-10: #2a6052; // @presenter Color
|
|
79
99
|
--color-brand-11: #284f45; // @presenter Color
|
|
80
100
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
101
|
+
|
|
102
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
103
|
+
|
|
104
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
105
|
+
--search-ai-gradient-end-color: var(--color-brand-5); // @presenter Color
|
|
81
106
|
`;
|
|
82
107
|
case 'cyan':
|
|
83
108
|
return (0, styled_components_1.css) `
|
|
@@ -93,6 +118,11 @@ function brandPaletteLight(palette) {
|
|
|
93
118
|
--color-brand-10: #285c67; // @presenter Color
|
|
94
119
|
--color-brand-11: #28484f; // @presenter Color
|
|
95
120
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
121
|
+
|
|
122
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
123
|
+
|
|
124
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
125
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
96
126
|
`;
|
|
97
127
|
case 'ocean':
|
|
98
128
|
return (0, styled_components_1.css) `
|
|
@@ -108,6 +138,11 @@ function brandPaletteLight(palette) {
|
|
|
108
138
|
--color-brand-10: #2d5472; // @presenter Color
|
|
109
139
|
--color-brand-11: #283e4f; // @presenter Color
|
|
110
140
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
141
|
+
|
|
142
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
143
|
+
|
|
144
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
145
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
111
146
|
`;
|
|
112
147
|
case 'indigo':
|
|
113
148
|
return (0, styled_components_1.css) `
|
|
@@ -123,6 +158,11 @@ function brandPaletteLight(palette) {
|
|
|
123
158
|
--color-brand-10: #303e6b; // @presenter Color
|
|
124
159
|
--color-brand-11: #28314f; // @presenter Color
|
|
125
160
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
161
|
+
|
|
162
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
163
|
+
|
|
164
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
165
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
126
166
|
`;
|
|
127
167
|
case 'iris':
|
|
128
168
|
return (0, styled_components_1.css) `
|
|
@@ -138,6 +178,11 @@ function brandPaletteLight(palette) {
|
|
|
138
178
|
--color-brand-10: #3a3a6a; // @presenter Color
|
|
139
179
|
--color-brand-11: #2e2e4f; // @presenter Color
|
|
140
180
|
--text-color-on-color: #ffffff; // @presenter Color
|
|
181
|
+
|
|
182
|
+
--link-color-primary-palette: var(--text-color-primary); // @presenter Color
|
|
183
|
+
|
|
184
|
+
--search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
|
|
185
|
+
--search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
|
|
141
186
|
`;
|
|
142
187
|
default:
|
|
143
188
|
return (0, styled_components_1.css) `
|
|
@@ -179,6 +224,14 @@ function brandPaletteLight(palette) {
|
|
|
179
224
|
--button-content-color-link-legacy: var(--link-color-primary); // @presenter Color
|
|
180
225
|
--button-content-color-link-hover-legacy: var(--link-color-primary-hover); // @presenter Color
|
|
181
226
|
--button-content-color-link-pressed-legacy: var(--link-color-primary-pressed); // @presenter Color
|
|
227
|
+
|
|
228
|
+
--link-color-primary-legacy: var(--color-blue-6); // @presenter Color
|
|
229
|
+
--link-color-primary-hover-legacy: var(--color-blue-7); // @presenter Color
|
|
230
|
+
--link-color-primary-pressed-legacy: var(--color-blue-8); // @presenter Color
|
|
231
|
+
--link-color-visited-legacy: var(--color-purple-7); // @presenter Color
|
|
232
|
+
|
|
233
|
+
--search-ai-gradient-start-color-legacy: #715efe; // @presenter Color
|
|
234
|
+
--search-ai-gradient-end-color-legacy: #ff5cdc; // @presenter Color
|
|
182
235
|
`;
|
|
183
236
|
}
|
|
184
237
|
}
|
|
@@ -68,8 +68,8 @@ const Icon = (props) => {
|
|
|
68
68
|
return (react_1.default.createElement("svg", Object.assign({ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, restProps),
|
|
69
69
|
!isColorOverridden && (react_1.default.createElement("defs", null,
|
|
70
70
|
react_1.default.createElement("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "1", y2: "0" },
|
|
71
|
-
react_1.default.createElement("stop", { offset: "0%", stopColor: "
|
|
72
|
-
react_1.default.createElement("stop", { offset: "100%", stopColor: "
|
|
71
|
+
react_1.default.createElement("stop", { offset: "0%", stopColor: "var(--search-ai-gradient-start-color, var(--search-ai-gradient-start-color-legacy))" }),
|
|
72
|
+
react_1.default.createElement("stop", { offset: "100%", stopColor: "var(--search-ai-gradient-end-color, var(--search-ai-gradient-end-color-legacy))" })))),
|
|
73
73
|
react_1.default.createElement("path", { d: "M11.2597 9.12114C8.08498 8.40423 7.59322 7.91247 6.87631 4.73772C6.84346 4.59262 6.7143 4.48929 6.56505 4.48929C6.4158 4.48929 6.28664 4.59262 6.2538 4.73772C5.53657 7.91247 5.04513 8.40423 1.87038 9.12114C1.72495 9.1543 1.62163 9.28314 1.62163 9.43239C1.62163 9.58164 1.72495 9.71048 1.87038 9.74365C5.04513 10.4609 5.53657 10.9526 6.2538 14.1271C6.28664 14.2722 6.4158 14.3755 6.56505 14.3755C6.7143 14.3755 6.84346 14.2722 6.87631 14.1271C7.59354 10.9526 8.08498 10.4609 11.2597 9.74365C11.4052 9.71048 11.5082 9.58164 11.5082 9.43239C11.5082 9.28314 11.4048 9.1543 11.2597 9.12114Z", fill: fill }),
|
|
74
74
|
react_1.default.createElement("path", { d: "M14.1299 4.17834C12.4423 3.79725 12.2053 3.5603 11.8242 1.87294C11.7911 1.72752 11.6622 1.62451 11.513 1.62451C11.3637 1.62451 11.2349 1.72752 11.2017 1.87294C10.8206 3.5603 10.5837 3.79725 8.8963 4.17834C8.75088 4.21151 8.64787 4.34035 8.64787 4.4896C8.64787 4.63885 8.75088 4.76769 8.8963 4.80086C10.5837 5.18195 10.8206 5.4189 11.2017 7.10658C11.2349 7.25168 11.3637 7.35501 11.513 7.35501C11.6622 7.35501 11.7911 7.25168 11.8242 7.10658C12.2053 5.4189 12.4423 5.18195 14.1299 4.80086C14.275 4.76769 14.3784 4.63885 14.3784 4.4896C14.3784 4.34035 14.275 4.21151 14.1299 4.17834Z", fill: fill })));
|
|
75
75
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CodeWalkthroughLayout = CodeWalkthroughLayout;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const constants_1 = require("../core/constants");
|
|
9
10
|
const utils_1 = require("../core/utils");
|
|
10
11
|
function CodeWalkthroughLayout({ className, children, }) {
|
|
11
12
|
return (react_1.default.createElement(LayoutWrapper, { "data-component-name": "Layout/CodeWalkthroughLayout", className: className },
|
|
@@ -66,7 +67,8 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
66
67
|
margin-right: auto;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
&:first-child > h1:first-child
|
|
70
|
+
&:first-child > h1:first-child,
|
|
71
|
+
&:first-child > .${constants_1.H1_CLASS}:first-child {
|
|
70
72
|
// disable margin top for h1 on the title heading
|
|
71
73
|
margin-top: 0;
|
|
72
74
|
}
|
|
@@ -7,6 +7,7 @@ exports.DocumentationLayout = DocumentationLayout;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const utils_1 = require("../core/utils");
|
|
10
|
+
const constants_1 = require("../core/constants");
|
|
10
11
|
const CodeSnippetContext_1 = require("../core/contexts/CodeSnippetContext");
|
|
11
12
|
const DocumentationLayoutTop_1 = require("../layouts/DocumentationLayoutTop");
|
|
12
13
|
const DocumentationLayoutBottom_1 = require("../layouts/DocumentationLayoutBottom");
|
|
@@ -41,7 +42,8 @@ const ContentWrapper = styled_components_1.default.section `
|
|
|
41
42
|
|
|
42
43
|
padding: var(--md-content-padding);
|
|
43
44
|
|
|
44
|
-
article:first-child > h1:first-child
|
|
45
|
+
article:first-child > h1:first-child,
|
|
46
|
+
article:first-child > .${constants_1.H1_CLASS}:first-child {
|
|
45
47
|
// disable margin top for h1 on the title heading
|
|
46
48
|
margin-top: 0;
|
|
47
49
|
}
|
|
@@ -98,6 +98,7 @@ const CardWrapper = styled_components_1.default.div.attrs(({ $isCardLink, $varia
|
|
|
98
98
|
text-decoration: none;
|
|
99
99
|
--md-paragraph-margin: 0;
|
|
100
100
|
--link-decoration-hover: none;
|
|
101
|
+
--link-decoration: none;
|
|
101
102
|
|
|
102
103
|
background-color: var(--card-bg-color);
|
|
103
104
|
border-width: var(--card-border-width);
|
|
@@ -45,6 +45,7 @@ const utils_1 = require("../../../core/utils");
|
|
|
45
45
|
const LinkIcon_1 = require("../../../icons/LinkIcon/LinkIcon");
|
|
46
46
|
const PageActions_1 = require("../../../components/PageActions/PageActions");
|
|
47
47
|
const hooks_1 = require("../../../core/hooks");
|
|
48
|
+
const constants_1 = require("../../../core/constants");
|
|
48
49
|
function renderWithSpanWrapper(children) {
|
|
49
50
|
const childrenArray = react_1.default.Children.toArray(children);
|
|
50
51
|
if (childrenArray.length === 0)
|
|
@@ -65,47 +66,34 @@ function renderWithSpanWrapper(children) {
|
|
|
65
66
|
middleChildren.length > 0 && react_1.default.createElement(StyledHeadingText, null, middleChildren),
|
|
66
67
|
isImage(last) && last));
|
|
67
68
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Class name for all MD tags
|
|
70
|
-
*/
|
|
71
|
-
const mdClassName = 'md';
|
|
72
69
|
function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, className, __idx, }) {
|
|
73
70
|
var _a, _b;
|
|
74
71
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
75
72
|
const { usePageProps } = (0, hooks_1.useThemeHooks)();
|
|
76
73
|
const pageProps = usePageProps();
|
|
77
74
|
const isMarkdownPage = ((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc';
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
linkEl,
|
|
88
|
-
react_1.default.createElement("span", null, renderWithSpanWrapper(children)),
|
|
89
|
-
isMarkdownPage && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null));
|
|
75
|
+
const headingTextId = `${id}-heading-text`;
|
|
76
|
+
const linkEl = (react_1.default.createElement("a", { "aria-labelledby": headingTextId, href: `#${id}`, className: (0, utils_1.concatClassNames)(constants_1.ANCHOR_CLASS, 'before') },
|
|
77
|
+
react_1.default.createElement(LinkIcon_1.LinkIcon, { "aria-hidden": "true", focusable: "false", color: "--heading-anchor-color" })));
|
|
78
|
+
const headingText = (0, react_1.createElement)(`h${level}`, { id: headingTextId }, renderWithSpanWrapper(children));
|
|
79
|
+
return (react_1.default.createElement("div", { id: id, className: (0, utils_1.concatClassNames)(constants_1.HEADING_ANCHOR_CLASS, constants_1.MARKDOWN_CLASS_NAME, `${constants_1.HEADING_CLASS_PREFIX}-${level}`, className), "data-component-name": "Markdoc/Heading/Heading", "data-source": dataSource, "data-hash": dataHash },
|
|
80
|
+
react_1.default.createElement(HeadingContentWrapper, null,
|
|
81
|
+
linkEl,
|
|
82
|
+
headingText,
|
|
83
|
+
isMarkdownPage && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null)));
|
|
90
84
|
}
|
|
91
85
|
const HeadingContentWrapper = styled_components_1.default.div `
|
|
92
86
|
display: flex;
|
|
93
87
|
gap: var(--spacing-xs);
|
|
94
88
|
|
|
95
|
-
& > .
|
|
89
|
+
& > .${constants_1.ANCHOR_CLASS} {
|
|
96
90
|
display: flex;
|
|
97
91
|
align-items: center;
|
|
98
92
|
height: 1lh;
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
& > span {
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: flex-start;
|
|
104
|
-
gap: var(--spacing-sm);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
95
|
&:has([data-component-name='PageActions/PageActions']:hover) {
|
|
108
|
-
&& .
|
|
96
|
+
&& .${constants_1.ANCHOR_CLASS} svg {
|
|
109
97
|
visibility: hidden;
|
|
110
98
|
}
|
|
111
99
|
}
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ export function Banner({ className }: BannerProps): JSX.Element | null {
|
|
|
138
138
|
$color={displayBanner.color}
|
|
139
139
|
$isVisible={isVisible}
|
|
140
140
|
>
|
|
141
|
-
<BannerContent>
|
|
141
|
+
<BannerContent $color={displayBanner.color}>
|
|
142
142
|
<MarkdownLinkContext.Provider value={markdownLinkContextValue}>
|
|
143
143
|
<Markdown compact>{markdownContent}</Markdown>
|
|
144
144
|
</MarkdownLinkContext.Provider>
|
|
@@ -159,7 +159,7 @@ export function Banner({ className }: BannerProps): JSX.Element | null {
|
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
const BannerContent = styled.div
|
|
162
|
+
const BannerContent = styled.div<{ $color: DisplayBanner['color'] }>`
|
|
163
163
|
flex: 1;
|
|
164
164
|
display: flex;
|
|
165
165
|
align-items: center;
|
|
@@ -172,7 +172,15 @@ const BannerContent = styled.div`
|
|
|
172
172
|
|
|
173
173
|
a:not([role='button']) {
|
|
174
174
|
color: var(--banner-link-color);
|
|
175
|
-
text-decoration: var(--banner-link-decoration);
|
|
175
|
+
text-decoration: ${({ $color }) => $color && `var(--banner-${$color}-link-decoration)`};
|
|
176
|
+
|
|
177
|
+
&:hover, &:focus {
|
|
178
|
+
text-decoration: ${({ $color }) => $color && `var(--banner-${$color}-link-decoration-hover)`};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&:visited {
|
|
182
|
+
text-decoration: ${({ $color }) => $color && `var(--banner-${$color}-link-decoration)`};
|
|
183
|
+
}
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
[data-component-name='Button/Button'] {
|
|
@@ -17,7 +17,6 @@ export const banner = css`
|
|
|
17
17
|
--banner-button-icon-right-padding: 1px 10px 1px var(--spacing-sm); // @presenter Spacing
|
|
18
18
|
--banner-button-margin: 0 var(--spacing-xs); // @presenter Spacing
|
|
19
19
|
--banner-padding: var(--spacing-xs); // @presenter Spacing
|
|
20
|
-
--banner-link-decoration: var(--link-decoration-hover);
|
|
21
20
|
--banner-min-height: 38px;
|
|
22
21
|
--banner-gap: var(--spacing-xxs); // @presenter Spacing
|
|
23
22
|
|
|
@@ -25,20 +24,28 @@ export const banner = css`
|
|
|
25
24
|
--banner-info-text-color: var(--color-static-white); // @presenter Color
|
|
26
25
|
--banner-info-icon-color: var(--color-static-white); // @presenter Color
|
|
27
26
|
--banner-info-link-color: var(--banner-info-text-color); // @presenter Color
|
|
27
|
+
--banner-info-link-decoration: underline 1px var(--banner-info-link-color);
|
|
28
|
+
--banner-info-link-decoration-hover: underline 2px var(--banner-info-link-color);
|
|
28
29
|
|
|
29
30
|
--banner-success-bg-color: var(--color-success-base); // @presenter Color
|
|
30
31
|
--banner-success-text-color: var(--color-static-white); // @presenter Color
|
|
31
32
|
--banner-success-icon-color: var(--color-static-white); // @presenter Color
|
|
32
33
|
--banner-success-link-color: var(--banner-success-text-color); // @presenter Color
|
|
34
|
+
--banner-success-link-decoration: underline 1px var(--banner-success-link-color);
|
|
35
|
+
--banner-success-link-decoration-hover: underline 2px var(--banner-success-link-color);
|
|
33
36
|
|
|
34
37
|
--banner-warning-bg-color: var(--color-warning-base); // @presenter Color
|
|
35
38
|
--banner-warning-text-color: var(--color-black); // @presenter Color
|
|
36
39
|
--banner-warning-icon-color: var(--color-black); // @presenter Color
|
|
37
40
|
--banner-warning-link-color: var(--banner-warning-text-color); // @presenter Color
|
|
41
|
+
--banner-warning-link-decoration: underline 1px var(--banner-warning-link-color);
|
|
42
|
+
--banner-warning-link-decoration-hover: underline 2px var(--banner-warning-link-color);
|
|
38
43
|
|
|
39
44
|
--banner-error-bg-color: var(--color-error-base); // @presenter Color
|
|
40
45
|
--banner-error-text-color: var(--color-static-white); // @presenter Color
|
|
41
46
|
--banner-error-icon-color: var(--color-static-white); // @presenter Color
|
|
42
47
|
--banner-error-link-color: var(--banner-error-text-color); // @presenter Color
|
|
48
|
+
--banner-error-link-decoration: underline 1px var(--banner-error-link-color);
|
|
49
|
+
--banner-error-link-decoration-hover: underline 2px var(--banner-error-link-color);
|
|
43
50
|
`;
|
|
44
51
|
|
|
@@ -148,6 +148,7 @@ export const catalog = css`
|
|
|
148
148
|
*/
|
|
149
149
|
--catalog-tags-more-button-font-size: var(--font-size-base);
|
|
150
150
|
--catalog-tags-more-button-margin-left: 4px;
|
|
151
|
+
--catalog-tags-row-gap: var(--spacing-xxs);
|
|
151
152
|
--catalog-tags-placeholder-bg-color: var(--bg-color);
|
|
152
153
|
--catalog-tags-not-connected-font-size: var(--font-size-base);
|
|
153
154
|
--catalog-tags-not-connected-line-height: var(--line-height-base);
|
|
@@ -6,6 +6,17 @@ import { typography } from '@redocly/theme/core/utils';
|
|
|
6
6
|
import { markdownBaseTableCss } from '@redocly/theme/components/Markdown/styles/base-table';
|
|
7
7
|
import { markdownLinksCss } from '@redocly/theme/components/Markdown/styles/links';
|
|
8
8
|
import { headingAnchorCss } from '@redocly/theme/components/Markdown/styles/heading-anchor';
|
|
9
|
+
import {
|
|
10
|
+
ANCHOR_CLASS,
|
|
11
|
+
H1_CLASS,
|
|
12
|
+
H2_CLASS,
|
|
13
|
+
H3_CLASS,
|
|
14
|
+
H4_CLASS,
|
|
15
|
+
H5_CLASS,
|
|
16
|
+
H6_CLASS,
|
|
17
|
+
HEADING_ANCHOR_CLASS,
|
|
18
|
+
MARKDOWN_CLASS_NAME,
|
|
19
|
+
} from '@redocly/theme/core/constants';
|
|
9
20
|
|
|
10
21
|
export type MarkdownProps = PropsWithChildren<{
|
|
11
22
|
className?: string;
|
|
@@ -66,17 +77,82 @@ export const Markdown = styled.main.attrs<{
|
|
|
66
77
|
max-width: 100%;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
h2.md,
|
|
71
|
-
h3.md,
|
|
72
|
-
h4.md,
|
|
73
|
-
h5.md,
|
|
74
|
-
h6.md {
|
|
80
|
+
.${HEADING_ANCHOR_CLASS} {
|
|
75
81
|
font-weight: var(--heading-font-weight);
|
|
76
82
|
font-family: var(--heading-font-family);
|
|
77
83
|
position: relative;
|
|
78
84
|
|
|
79
85
|
scroll-margin-top: calc(var(--navbar-height) + var(--banner-height));
|
|
86
|
+
${headingAnchorCss(ANCHOR_CLASS)};
|
|
87
|
+
|
|
88
|
+
h1, h2, h3, h4, h5, h6 {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: flex-start;
|
|
91
|
+
gap: var(--spacing-sm);
|
|
92
|
+
margin: 0;
|
|
93
|
+
font: inherit;
|
|
94
|
+
color: inherit;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.${H1_CLASS} {
|
|
99
|
+
${typography('h1')};
|
|
100
|
+
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
101
|
+
|
|
102
|
+
h1 code {
|
|
103
|
+
font-size: var(--h1-font-size);
|
|
104
|
+
line-height: var(--h1-code-line-height);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.${H2_CLASS} {
|
|
109
|
+
${typography('h2')};
|
|
110
|
+
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
111
|
+
|
|
112
|
+
h2 code {
|
|
113
|
+
font-size: var(--h2-font-size);
|
|
114
|
+
line-height: var(--h2-code-line-height);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.${H3_CLASS} {
|
|
119
|
+
${typography('h3')};
|
|
120
|
+
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
121
|
+
|
|
122
|
+
h3 code {
|
|
123
|
+
font-size: var(--h3-font-size);
|
|
124
|
+
line-height: var(--h3-code-line-height);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.${H4_CLASS} {
|
|
129
|
+
${typography('h4')};
|
|
130
|
+
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
131
|
+
|
|
132
|
+
h4 code {
|
|
133
|
+
font-size: var(--h4-font-size);
|
|
134
|
+
line-height: var(--h4-code-line-height);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.${H5_CLASS} {
|
|
139
|
+
${typography('h5')};
|
|
140
|
+
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
141
|
+
|
|
142
|
+
h5 code {
|
|
143
|
+
font-size: var(--h5-font-size);
|
|
144
|
+
line-height: var(--h5-code-line-height);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.${H6_CLASS} {
|
|
149
|
+
${typography('h6')};
|
|
150
|
+
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
151
|
+
|
|
152
|
+
h6 code {
|
|
153
|
+
font-size: var(--h6-font-size);
|
|
154
|
+
line-height: var(--h6-code-line-height);
|
|
155
|
+
}
|
|
80
156
|
}
|
|
81
157
|
|
|
82
158
|
strong {
|
|
@@ -120,71 +196,71 @@ export const Markdown = styled.main.attrs<{
|
|
|
120
196
|
margin: var(--md-paragraph-margin);
|
|
121
197
|
}
|
|
122
198
|
|
|
123
|
-
|
|
199
|
+
/**
|
|
200
|
+
* @deprecated Legacy styles for ejected Heading components that render h1-h6 as the root.
|
|
201
|
+
*
|
|
202
|
+
* Deprecated legacy heading styles start.
|
|
203
|
+
*/
|
|
204
|
+
h1.${MARKDOWN_CLASS_NAME} {
|
|
124
205
|
${typography('h1')};
|
|
125
206
|
margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
|
|
126
|
-
${headingAnchorCss()};
|
|
127
207
|
}
|
|
128
208
|
|
|
129
|
-
h2
|
|
209
|
+
h2.${MARKDOWN_CLASS_NAME} {
|
|
130
210
|
${typography('h2')};
|
|
131
211
|
margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
|
|
132
|
-
${headingAnchorCss()};
|
|
133
212
|
}
|
|
134
213
|
|
|
135
|
-
h3
|
|
214
|
+
h3.${MARKDOWN_CLASS_NAME} {
|
|
136
215
|
${typography('h3')};
|
|
137
216
|
margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
|
|
138
|
-
${headingAnchorCss()};
|
|
139
217
|
}
|
|
140
218
|
|
|
141
|
-
h4
|
|
219
|
+
h4.${MARKDOWN_CLASS_NAME} {
|
|
142
220
|
${typography('h4')};
|
|
143
221
|
margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
|
|
144
|
-
${headingAnchorCss()};
|
|
145
222
|
}
|
|
146
223
|
|
|
147
|
-
h5
|
|
224
|
+
h5.${MARKDOWN_CLASS_NAME} {
|
|
148
225
|
${typography('h5')};
|
|
149
226
|
margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
|
|
150
|
-
${headingAnchorCss()};
|
|
151
227
|
}
|
|
152
228
|
|
|
153
|
-
h6
|
|
229
|
+
h6.${MARKDOWN_CLASS_NAME} {
|
|
154
230
|
${typography('h6')};
|
|
155
231
|
margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
|
|
156
|
-
${headingAnchorCss()};
|
|
157
232
|
}
|
|
158
233
|
|
|
159
|
-
h1
|
|
234
|
+
h1.${MARKDOWN_CLASS_NAME} code {
|
|
160
235
|
font-size: var(--h1-font-size);
|
|
161
236
|
line-height: var(--h1-code-line-height);
|
|
162
237
|
}
|
|
163
238
|
|
|
164
|
-
h2
|
|
239
|
+
h2.${MARKDOWN_CLASS_NAME} code {
|
|
165
240
|
font-size: var(--h2-font-size);
|
|
166
241
|
line-height: var(--h2-code-line-height);
|
|
167
242
|
}
|
|
168
243
|
|
|
169
|
-
h3
|
|
244
|
+
h3.${MARKDOWN_CLASS_NAME} code {
|
|
170
245
|
font-size: var(--h3-font-size);
|
|
171
246
|
line-height: var(--h3-code-line-height);
|
|
172
247
|
}
|
|
173
248
|
|
|
174
|
-
h4
|
|
249
|
+
h4.${MARKDOWN_CLASS_NAME} code {
|
|
175
250
|
font-size: var(--h4-font-size);
|
|
176
251
|
line-height: var(--h4-code-line-height);
|
|
177
252
|
}
|
|
178
253
|
|
|
179
|
-
h5
|
|
254
|
+
h5.${MARKDOWN_CLASS_NAME} code {
|
|
180
255
|
font-size: var(--h5-font-size);
|
|
181
256
|
line-height: var(--h5-code-line-height);
|
|
182
257
|
}
|
|
183
258
|
|
|
184
|
-
h6
|
|
259
|
+
h6.${MARKDOWN_CLASS_NAME} code {
|
|
185
260
|
font-size: var(--h6-font-size);
|
|
186
261
|
line-height: var(--h6-code-line-height);
|
|
187
262
|
}
|
|
263
|
+
/* Deprecated legacy heading styles end. */
|
|
188
264
|
|
|
189
265
|
code {
|
|
190
266
|
color: var(--inline-code-text-color);
|
|
@@ -248,8 +324,8 @@ export const Markdown = styled.main.attrs<{
|
|
|
248
324
|
}
|
|
249
325
|
}
|
|
250
326
|
|
|
251
|
-
ul
|
|
252
|
-
ol
|
|
327
|
+
ul.${MARKDOWN_CLASS_NAME},
|
|
328
|
+
ol.${MARKDOWN_CLASS_NAME} {
|
|
253
329
|
padding-left: var(--md-list-left-padding);
|
|
254
330
|
margin: var(--md-list-margin);
|
|
255
331
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
|
+
import { MARKDOWN_CLASS_NAME } from '@redocly/theme/core/constants';
|
|
4
|
+
|
|
3
5
|
export const markdownBaseTableCss = css`
|
|
4
6
|
.md-table-wrapper {
|
|
5
7
|
overflow-x: auto;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
table
|
|
10
|
+
table.${MARKDOWN_CLASS_NAME} {
|
|
9
11
|
width: 100%;
|
|
10
12
|
overflow: hidden;
|
|
11
13
|
word-break: keep-all;
|
|
@@ -2,7 +2,7 @@ import { css } from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
4
4
|
|
|
5
|
-
export function headingAnchorCss(className
|
|
5
|
+
export function headingAnchorCss(className: string): FlattenSimpleInterpolation {
|
|
6
6
|
return css`
|
|
7
7
|
.${className}.before {
|
|
8
8
|
position: absolute;
|
|
@@ -3,12 +3,13 @@ import { css } from 'styled-components';
|
|
|
3
3
|
export const markdownLinksCss = css`
|
|
4
4
|
a:not([role='button']) {
|
|
5
5
|
text-decoration: var(--link-decoration);
|
|
6
|
+
text-underline-offset: var(--link-underline-offset);
|
|
6
7
|
color: var(--link-color-primary);
|
|
7
8
|
font-weight: var(--link-font-weight);
|
|
8
9
|
|
|
9
10
|
&:visited {
|
|
10
11
|
color: var(--link-color-visited);
|
|
11
|
-
text-decoration: var(--link-visited
|
|
12
|
+
text-decoration: var(--link-decoration-visited);
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
&:hover,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
export const search = css`
|
|
5
5
|
/**
|
|
6
6
|
* @tokens Search
|
|
@@ -146,7 +146,7 @@ export const search = css`
|
|
|
146
146
|
* @tokens AI Search
|
|
147
147
|
*/
|
|
148
148
|
|
|
149
|
-
--search-ai-gradient: linear-gradient(to right,
|
|
149
|
+
--search-ai-gradient: linear-gradient(to right, var(--search-ai-gradient-start-color, var(--search-ai-gradient-start-color-legacy)), var(--search-ai-gradient-end-color, var(--search-ai-gradient-end-color-legacy)));
|
|
150
150
|
|
|
151
151
|
--search-ai-response-padding: var(--spacing-lg);
|
|
152
152
|
--search-ai-response-gap: var(--spacing-sm);
|
|
@@ -262,4 +262,4 @@ export const search = css`
|
|
|
262
262
|
|
|
263
263
|
// @tokens End
|
|
264
264
|
`;
|
|
265
|
-
|
|
265
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const HEADING_ANCHOR_CLASS = 'heading-anchor';
|
|
2
|
+
export const ANCHOR_CLASS = 'anchor';
|
|
3
|
+
export const HEADING_CLASS_PREFIX = 'heading-level';
|
|
4
|
+
export const H1_CLASS = `${HEADING_CLASS_PREFIX}-1`;
|
|
5
|
+
export const H2_CLASS = `${HEADING_CLASS_PREFIX}-2`;
|
|
6
|
+
export const H3_CLASS = `${HEADING_CLASS_PREFIX}-3`;
|
|
7
|
+
export const H4_CLASS = `${HEADING_CLASS_PREFIX}-4`;
|
|
8
|
+
export const H5_CLASS = `${HEADING_CLASS_PREFIX}-5`;
|
|
9
|
+
export const H6_CLASS = `${HEADING_CLASS_PREFIX}-6`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MARKDOWN_CLASS_NAME = 'md';
|