@redocly/theme 0.65.0-next.3 → 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.
Files changed (37) hide show
  1. package/lib/components/Catalog/CatalogTags.js +1 -0
  2. package/lib/components/Catalog/variables.js +1 -0
  3. package/lib/components/Markdown/Markdown.js +92 -26
  4. package/lib/components/Markdown/styles/base-table.js +2 -1
  5. package/lib/components/Markdown/styles/heading-anchor.d.ts +1 -1
  6. package/lib/components/Markdown/styles/heading-anchor.js +1 -1
  7. package/lib/components/Search/variables.js +1 -3
  8. package/lib/core/constants/heading.d.ts +9 -0
  9. package/lib/core/constants/heading.js +13 -0
  10. package/lib/core/constants/index.d.ts +2 -0
  11. package/lib/core/constants/index.js +2 -0
  12. package/lib/core/constants/markdown.d.ts +1 -0
  13. package/lib/core/constants/markdown.js +5 -0
  14. package/lib/core/hooks/use-active-heading.js +2 -1
  15. package/lib/core/styles/palette.dark.js +27 -0
  16. package/lib/core/styles/palette.js +30 -0
  17. package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +2 -2
  18. package/lib/layouts/CodeWalkthroughLayout.js +3 -1
  19. package/lib/layouts/DocumentationLayout.js +3 -1
  20. package/lib/markdoc/components/Heading/Heading.js +12 -24
  21. package/package.json +1 -1
  22. package/src/components/Catalog/CatalogTags.tsx +1 -0
  23. package/src/components/Catalog/variables.ts +1 -0
  24. package/src/components/Markdown/Markdown.tsx +102 -26
  25. package/src/components/Markdown/styles/base-table.ts +3 -1
  26. package/src/components/Markdown/styles/heading-anchor.ts +1 -1
  27. package/src/components/Search/variables.ts +3 -3
  28. package/src/core/constants/heading.ts +9 -0
  29. package/src/core/constants/index.ts +2 -0
  30. package/src/core/constants/markdown.ts +1 -0
  31. package/src/core/hooks/use-active-heading.ts +2 -1
  32. package/src/core/styles/palette.dark.ts +27 -0
  33. package/src/core/styles/palette.ts +30 -0
  34. package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +8 -2
  35. package/src/layouts/CodeWalkthroughLayout.tsx +3 -1
  36. package/src/layouts/DocumentationLayout.tsx +3 -1
  37. package/src/markdoc/components/Heading/Heading.tsx +36 -29
@@ -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
- h1.md,
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
- h1.md {
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.md {
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.md {
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.md {
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.md {
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.md {
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.md code {
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.md code {
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.md code {
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.md code {
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.md code {
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.md code {
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.md,
252
- ol.md {
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.md {
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 = 'anchor'): FlattenSimpleInterpolation {
5
+ export function headingAnchorCss(className: string): FlattenSimpleInterpolation {
6
6
  return css`
7
7
  .${className}.before {
8
8
  position: absolute;
@@ -1,6 +1,6 @@
1
1
  import { css } from 'styled-components';
2
2
 
3
- /* eslint-disable theme/no-raw-colors-in-styles */
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, #715efe, #ff5cdc);
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
- /* eslint-enable theme/no-raw-colors-in-styles */
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`;
@@ -7,3 +7,5 @@ export * from './breadcrumb';
7
7
  export * from './request-methods';
8
8
  export * from './mcp';
9
9
  export * from './feedback';
10
+ export * from './heading';
11
+ export * from './markdown';
@@ -0,0 +1 @@
1
+ export const MARKDOWN_CLASS_NAME = 'md';
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import { useLocation } from 'react-router-dom';
3
3
 
4
4
  import { enhancedSmoothstep } from '../utils';
5
+ import { HEADING_ANCHOR_CLASS } from '../constants';
5
6
 
6
7
  type HeadingEntry = {
7
8
  [key: string]: IntersectionObserverEntry;
@@ -59,7 +60,7 @@ export function useActiveHeading(
59
60
  );
60
61
 
61
62
  const findHeaders = (allContent: HTMLDivElement) => {
62
- const allHeaders = allContent.querySelectorAll<HTMLElement>('.heading-anchor');
63
+ const allHeaders = allContent.querySelectorAll<HTMLElement>(`.${HEADING_ANCHOR_CLASS}`);
63
64
  const headers = Array.from(allHeaders);
64
65
 
65
66
  if (displayedHeadingsRef.current && displayedHeadingsRef.current.length > 0) {
@@ -20,6 +20,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
20
20
  --color-brand-subtle-3: #55576166;
21
21
  --color-brand-subtle-4: #6e6f7a66;
22
22
  --text-color-on-color: #000000;
23
+
24
+ --search-ai-gradient-start-color: var(--color-brand-3);
25
+ --search-ai-gradient-end-color: var(--color-brand-7);
23
26
  `;
24
27
  case 'pink':
25
28
  return css`
@@ -39,6 +42,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
39
42
  --color-brand-subtle-3: #85366866;
40
43
  --color-brand-subtle-4: #a03a7b66;
41
44
  --text-color-on-color: #ffffff;
45
+
46
+ --search-ai-gradient-start-color: var(--color-brand-5); // @presenter Color
47
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
42
48
  `;
43
49
  case 'coral':
44
50
  return css`
@@ -58,6 +64,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
58
64
  --color-brand-subtle-3: #8b3c4266;
59
65
  --color-brand-subtle-4: #a9434c66;
60
66
  --text-color-on-color: #ffffff;
67
+
68
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
69
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
61
70
  `;
62
71
  case 'amber':
63
72
  return css`
@@ -77,6 +86,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
77
86
  --color-brand-subtle-3: #93632f66;
78
87
  --color-brand-subtle-4: #b6732a66;
79
88
  --text-color-on-color: #ffffff;
89
+
90
+ --search-ai-gradient-start-color: var(--color-brand-5); // @presenter Color
91
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
80
92
  `;
81
93
  case 'jade':
82
94
  return css`
@@ -96,6 +108,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
96
108
  --color-brand-subtle-3: #2b715e66;
97
109
  --color-brand-subtle-4: #2b816b66;
98
110
  --text-color-on-color: #ffffff;
111
+
112
+ --search-ai-gradient-start-color: var(--color-brand-4);
113
+ --search-ai-gradient-end-color: var(--color-brand-7);
99
114
  `;
100
115
  case 'cyan':
101
116
  return css`
@@ -115,6 +130,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
115
130
  --color-brand-subtle-3: #246e7f66;
116
131
  --color-brand-subtle-4: #1b809766;
117
132
  --text-color-on-color: #ffffff;
133
+
134
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
135
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
118
136
  `;
119
137
  case 'ocean':
120
138
  return css`
@@ -134,6 +152,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
134
152
  --color-brand-subtle-3: #2a679566;
135
153
  --color-brand-subtle-4: #2277b966;
136
154
  --text-color-on-color: #ffffff;
155
+
156
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
157
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
137
158
  `;
138
159
  case 'indigo':
139
160
  return css`
@@ -153,6 +174,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
153
174
  --color-brand-subtle-3: #36498866;
154
175
  --color-brand-subtle-4: #3952a466;
155
176
  --text-color-on-color: #ffffff;
177
+
178
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
179
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
156
180
  `;
157
181
  case 'iris':
158
182
  return css`
@@ -172,6 +196,9 @@ function brandPaletteDark(palette: string | undefined): FlattenSimpleInterpolati
172
196
  --color-brand-subtle-3: #43438580;
173
197
  --color-brand-subtle-4: #4c4ca080;
174
198
  --text-color-on-color: #ffffff;
199
+
200
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
201
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
175
202
  `;
176
203
  default:
177
204
  return css`
@@ -18,6 +18,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
18
18
  --text-color-on-color: #ffffff; // @presenter Color
19
19
 
20
20
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
21
+
22
+ --search-ai-gradient-start-color: var(--color-brand-10); // @presenter Color
23
+ --search-ai-gradient-end-color: var(--color-brand-7); // @presenter Color
21
24
  `;
22
25
  case 'pink':
23
26
  return css`
@@ -35,6 +38,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
35
38
  --text-color-on-color: #ffffff; // @presenter Color
36
39
 
37
40
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
41
+
42
+ --search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
43
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
38
44
  `;
39
45
  case 'coral':
40
46
  return css`
@@ -52,6 +58,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
52
58
  --text-color-on-color: #ffffff; // @presenter Color
53
59
 
54
60
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
61
+
62
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
63
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
55
64
  `;
56
65
  case 'amber':
57
66
  return css`
@@ -69,6 +78,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
69
78
  --text-color-on-color: #ffffff; // @presenter Color
70
79
 
71
80
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
81
+
82
+ --search-ai-gradient-start-color: var(--color-brand-7); // @presenter Color
83
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
72
84
  `;
73
85
  case 'jade':
74
86
  return css`
@@ -86,6 +98,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
86
98
  --text-color-on-color: #ffffff; // @presenter Color
87
99
 
88
100
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
101
+
102
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
103
+ --search-ai-gradient-end-color: var(--color-brand-5); // @presenter Color
89
104
  `;
90
105
  case 'cyan':
91
106
  return css`
@@ -103,6 +118,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
103
118
  --text-color-on-color: #ffffff; // @presenter Color
104
119
 
105
120
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
121
+
122
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
123
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
106
124
  `;
107
125
  case 'ocean':
108
126
  return css`
@@ -120,6 +138,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
120
138
  --text-color-on-color: #ffffff; // @presenter Color
121
139
 
122
140
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
141
+
142
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
143
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
123
144
  `;
124
145
  case 'indigo':
125
146
  return css`
@@ -137,6 +158,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
137
158
  --text-color-on-color: #ffffff; // @presenter Color
138
159
 
139
160
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
161
+
162
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
163
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
140
164
  `;
141
165
  case 'iris':
142
166
  return css`
@@ -154,6 +178,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
154
178
  --text-color-on-color: #ffffff; // @presenter Color
155
179
 
156
180
  --link-color-primary-palette: var(--text-color-primary); // @presenter Color
181
+
182
+ --search-ai-gradient-start-color: var(--color-brand-8); // @presenter Color
183
+ --search-ai-gradient-end-color: var(--color-brand-4); // @presenter Color
157
184
  `;
158
185
  default:
159
186
  return css`
@@ -200,6 +227,9 @@ function brandPaletteLight(palette: string | undefined): FlattenSimpleInterpolat
200
227
  --link-color-primary-hover-legacy: var(--color-blue-7); // @presenter Color
201
228
  --link-color-primary-pressed-legacy: var(--color-blue-8); // @presenter Color
202
229
  --link-color-visited-legacy: var(--color-purple-7); // @presenter Color
230
+
231
+ --search-ai-gradient-start-color-legacy: #715efe; // @presenter Color
232
+ --search-ai-gradient-end-color-legacy: #ff5cdc; // @presenter Color
203
233
  `;
204
234
  }
205
235
  }
@@ -36,8 +36,14 @@ const Icon = (props: AiStarsGradientIconProps) => {
36
36
  {!isColorOverridden && (
37
37
  <defs>
38
38
  <linearGradient id="gradient" x1="0" y1="0" x2="1" y2="0">
39
- <stop offset="0%" stopColor="#715efe" />
40
- <stop offset="100%" stopColor="#ff5cdc" />
39
+ <stop
40
+ offset="0%"
41
+ stopColor="var(--search-ai-gradient-start-color, var(--search-ai-gradient-start-color-legacy))"
42
+ />
43
+ <stop
44
+ offset="100%"
45
+ stopColor="var(--search-ai-gradient-end-color, var(--search-ai-gradient-end-color-legacy))"
46
+ />
41
47
  </linearGradient>
42
48
  </defs>
43
49
  )}
@@ -3,6 +3,7 @@ import styled from 'styled-components';
3
3
 
4
4
  import type { JSX } from 'react';
5
5
 
6
+ import { H1_CLASS } from '@redocly/theme/core/constants';
6
7
  import { breakpoints } from '@redocly/theme/core/utils';
7
8
 
8
9
  export type CodeWalkthroughLayoutProps = React.PropsWithChildren<{
@@ -76,7 +77,8 @@ const ContentWrapper = styled.section`
76
77
  margin-right: auto;
77
78
  }
78
79
 
79
- &:first-child > h1:first-child {
80
+ &:first-child > h1:first-child,
81
+ &:first-child > .${H1_CLASS}:first-child {
80
82
  // disable margin top for h1 on the title heading
81
83
  margin-top: 0;
82
84
  }
@@ -5,6 +5,7 @@ import type { JSX } from 'react';
5
5
  import type { ResolvedNavItemWithLink, MarkdownConfig } from '@redocly/config';
6
6
 
7
7
  import { breakpoints } from '@redocly/theme/core/utils';
8
+ import { H1_CLASS } from '@redocly/theme/core/constants';
8
9
  import { CodeSnippetProvider } from '@redocly/theme/core/contexts/CodeSnippetContext';
9
10
  import { DocumentationLayoutTop } from '@redocly/theme/layouts/DocumentationLayoutTop';
10
11
  import { DocumentationLayoutBottom } from '@redocly/theme/layouts/DocumentationLayoutBottom';
@@ -70,7 +71,8 @@ const ContentWrapper = styled.section<{ withToc: boolean }>`
70
71
 
71
72
  padding: var(--md-content-padding);
72
73
 
73
- article:first-child > h1:first-child {
74
+ article:first-child > h1:first-child,
75
+ article:first-child > .${H1_CLASS}:first-child {
74
76
  // disable margin top for h1 on the title heading
75
77
  margin-top: 0;
76
78
  }
@@ -9,6 +9,12 @@ import { concatClassNames } from '@redocly/theme/core/utils';
9
9
  import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
10
10
  import { PageActions } from '@redocly/theme/components/PageActions/PageActions';
11
11
  import { useThemeHooks } from '@redocly/theme/core/hooks';
12
+ import {
13
+ ANCHOR_CLASS,
14
+ HEADING_ANCHOR_CLASS,
15
+ HEADING_CLASS_PREFIX,
16
+ MARKDOWN_CLASS_NAME,
17
+ } from '@redocly/theme/core/constants';
12
18
 
13
19
  function renderWithSpanWrapper(children: ReactNode): ReactNode {
14
20
  const childrenArray = React.Children.toArray(children);
@@ -39,11 +45,6 @@ function renderWithSpanWrapper(children: ReactNode): ReactNode {
39
45
  );
40
46
  }
41
47
 
42
- /**
43
- * Class name for all MD tags
44
- */
45
- const mdClassName = 'md';
46
-
47
48
  export function Heading({
48
49
  level,
49
50
  id,
@@ -66,31 +67,43 @@ export function Heading({
66
67
 
67
68
  const isMarkdownPage =
68
69
  pageProps?.metadata?.type === 'markdown' || pageProps?.metadata?.type === 'asciidoc';
70
+ const headingTextId = `${id}-heading-text`;
69
71
 
70
72
  const linkEl = (
71
73
  <a
72
- aria-label={`link to ${id}`}
74
+ aria-labelledby={headingTextId}
73
75
  href={`#${id}`}
74
- className={concatClassNames('anchor', 'before')}
76
+ className={concatClassNames(ANCHOR_CLASS, 'before')}
75
77
  >
76
- <LinkIcon color="--heading-anchor-color" />
78
+ <LinkIcon aria-hidden="true" focusable="false" color="--heading-anchor-color" />
77
79
  </a>
78
80
  );
79
81
 
80
- return createElement(
82
+ const headingText = createElement(
81
83
  `h${level}`,
82
- {
83
- id,
84
- className: concatClassNames('heading-anchor', mdClassName, className),
85
- 'data-component-name': 'Markdoc/Heading/Heading',
86
- 'data-source': dataSource,
87
- 'data-hash': dataHash,
88
- },
89
- <HeadingContentWrapper>
90
- {linkEl}
91
- <span>{renderWithSpanWrapper(children)}</span>
92
- {isMarkdownPage && __idx === 0 ? <PageActions pageSlug={pathname} /> : null}
93
- </HeadingContentWrapper>,
84
+ { id: headingTextId },
85
+ renderWithSpanWrapper(children),
86
+ );
87
+
88
+ return (
89
+ <div
90
+ id={id}
91
+ className={concatClassNames(
92
+ HEADING_ANCHOR_CLASS,
93
+ MARKDOWN_CLASS_NAME,
94
+ `${HEADING_CLASS_PREFIX}-${level}`,
95
+ className,
96
+ )}
97
+ data-component-name="Markdoc/Heading/Heading"
98
+ data-source={dataSource}
99
+ data-hash={dataHash}
100
+ >
101
+ <HeadingContentWrapper>
102
+ {linkEl}
103
+ {headingText}
104
+ {isMarkdownPage && __idx === 0 ? <PageActions pageSlug={pathname} /> : null}
105
+ </HeadingContentWrapper>
106
+ </div>
94
107
  );
95
108
  }
96
109
 
@@ -98,20 +111,14 @@ const HeadingContentWrapper = styled.div`
98
111
  display: flex;
99
112
  gap: var(--spacing-xs);
100
113
 
101
- & > .anchor {
114
+ & > .${ANCHOR_CLASS} {
102
115
  display: flex;
103
116
  align-items: center;
104
117
  height: 1lh;
105
118
  }
106
119
 
107
- & > span {
108
- display: flex;
109
- align-items: flex-start;
110
- gap: var(--spacing-sm);
111
- }
112
-
113
120
  &:has([data-component-name='PageActions/PageActions']:hover) {
114
- && .anchor svg {
121
+ && .${ANCHOR_CLASS} svg {
115
122
  visibility: hidden;
116
123
  }
117
124
  }