@redocly/theme 0.65.0-next.3 → 0.65.0-next.5

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 (54) hide show
  1. package/lib/components/Button/Button.d.ts +1 -0
  2. package/lib/components/Button/Button.js +14 -2
  3. package/lib/components/Catalog/CatalogTags.js +1 -0
  4. package/lib/components/Catalog/variables.js +1 -0
  5. package/lib/components/Dropdown/DropdownMenuItem.js +18 -6
  6. package/lib/components/LanguagePicker/LanguagePicker.js +3 -2
  7. package/lib/components/Markdown/Markdown.js +92 -26
  8. package/lib/components/Markdown/styles/base-table.js +2 -1
  9. package/lib/components/Markdown/styles/heading-anchor.d.ts +1 -1
  10. package/lib/components/Markdown/styles/heading-anchor.js +1 -1
  11. package/lib/components/Search/variables.js +1 -3
  12. package/lib/components/UserMenu/LoginButton.js +1 -1
  13. package/lib/core/constants/heading.d.ts +9 -0
  14. package/lib/core/constants/heading.js +13 -0
  15. package/lib/core/constants/index.d.ts +2 -0
  16. package/lib/core/constants/index.js +2 -0
  17. package/lib/core/constants/markdown.d.ts +1 -0
  18. package/lib/core/constants/markdown.js +5 -0
  19. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +0 -11
  20. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +7 -2
  21. package/lib/core/hooks/use-active-heading.js +2 -1
  22. package/lib/core/hooks/use-language-picker.d.ts +6 -1
  23. package/lib/core/hooks/use-language-picker.js +10 -2
  24. package/lib/core/styles/palette.dark.js +27 -0
  25. package/lib/core/styles/palette.js +30 -0
  26. package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +2 -2
  27. package/lib/layouts/CodeWalkthroughLayout.js +3 -1
  28. package/lib/layouts/DocumentationLayout.js +3 -1
  29. package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +8 -7
  30. package/lib/markdoc/components/Heading/Heading.js +12 -24
  31. package/package.json +2 -2
  32. package/src/components/Button/Button.tsx +9 -2
  33. package/src/components/Catalog/CatalogTags.tsx +1 -0
  34. package/src/components/Catalog/variables.ts +1 -0
  35. package/src/components/Dropdown/DropdownMenuItem.tsx +27 -27
  36. package/src/components/LanguagePicker/LanguagePicker.tsx +3 -2
  37. package/src/components/Markdown/Markdown.tsx +102 -26
  38. package/src/components/Markdown/styles/base-table.ts +3 -1
  39. package/src/components/Markdown/styles/heading-anchor.ts +1 -1
  40. package/src/components/Search/variables.ts +3 -3
  41. package/src/components/UserMenu/LoginButton.tsx +1 -0
  42. package/src/core/constants/heading.ts +9 -0
  43. package/src/core/constants/index.ts +2 -0
  44. package/src/core/constants/markdown.ts +1 -0
  45. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +10 -2
  46. package/src/core/hooks/use-active-heading.ts +2 -1
  47. package/src/core/hooks/use-language-picker.ts +33 -8
  48. package/src/core/styles/palette.dark.ts +27 -0
  49. package/src/core/styles/palette.ts +30 -0
  50. package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +8 -2
  51. package/src/layouts/CodeWalkthroughLayout.tsx +3 -1
  52. package/src/layouts/DocumentationLayout.tsx +3 -1
  53. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +7 -8
  54. package/src/markdoc/components/Heading/Heading.tsx +36 -29
@@ -14,6 +14,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
14
14
  extraClass?: string;
15
15
  to?: string;
16
16
  external?: boolean;
17
+ languageInsensitive?: boolean;
17
18
  icon?: JSX.Element;
18
19
  iconPosition?: 'left' | 'right';
19
20
  title?: string;
@@ -32,6 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
35
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
48
  };
@@ -166,13 +177,14 @@ const StyledButton = styled_components_1.default.button.attrs((props) => ({
166
177
  `}
167
178
  `;
168
179
  const ButtonComponent = (props) => {
180
+ const { languageInsensitive } = props, buttonProps = __rest(props, ["languageInsensitive"]);
169
181
  const tabIndex = 'tabIndex' in props ? props.tabIndex : props.to ? -1 : undefined;
170
- const button = (react_1.default.createElement(StyledButton, Object.assign({ "data-component-name": "Button/Button" }, props, { iconOnly: !props.children && props.icon !== null, tabIndex: tabIndex }),
182
+ const button = (react_1.default.createElement(StyledButton, Object.assign({ "data-component-name": "Button/Button" }, buttonProps, { iconOnly: !props.children && props.icon !== null, tabIndex: tabIndex }),
171
183
  props.icon && props.iconPosition !== 'right' && props.icon,
172
184
  props.children,
173
185
  props.icon && props.iconPosition === 'right' && props.icon));
174
186
  if (props.to) {
175
- return (react_1.default.createElement(StyledButtonLink, { to: props.to, external: props.external, onClick: props.onClick }, button));
187
+ return (react_1.default.createElement(StyledButtonLink, { to: props.to, external: props.external, languageInsensitive: languageInsensitive, onClick: props.onClick }, button));
176
188
  }
177
189
  else {
178
190
  return button;
@@ -49,6 +49,7 @@ function CatalogTags({ items, itemsToShow = 1, showPlaceholder = false, showAvat
49
49
  const CatalogTagsWrapper = styled_components_1.default.div `
50
50
  display: flex;
51
51
  flex-wrap: wrap;
52
+ row-gap: var(--catalog-tags-row-gap);
52
53
  `;
53
54
  const MoreTagsButton = styled_components_1.default.span `
54
55
  font-size: var(--catalog-tags-more-button-font-size);
@@ -150,6 +150,7 @@ exports.catalog = (0, styled_components_1.css) `
150
150
  */
151
151
  --catalog-tags-more-button-font-size: var(--font-size-base);
152
152
  --catalog-tags-more-button-margin-left: 4px;
153
+ --catalog-tags-row-gap: var(--spacing-xxs);
153
154
  --catalog-tags-placeholder-bg-color: var(--bg-color);
154
155
  --catalog-tags-not-connected-font-size: var(--font-size-base);
155
156
  --catalog-tags-not-connected-line-height: var(--line-height-base);
@@ -62,13 +62,25 @@ function DropdownMenuItem(_a) {
62
62
  }
63
63
  };
64
64
  className = className || '' + (active ? ' active' : '');
65
+ const sharedProps = {
66
+ $active: active,
67
+ $dangerous: dangerous,
68
+ $disabled: disabled,
69
+ $separator: separator,
70
+ $separatorLine: separatorLine,
71
+ 'data-component-name': 'Dropdown/DropdownMenuItem',
72
+ className,
73
+ onClick: handleClick,
74
+ role,
75
+ style,
76
+ };
65
77
  if (to) {
66
- return (react_1.default.createElement(DropdownMenuItemWrapper, Object.assign({ as: Link_1.Link, "data-component-name": "Dropdown/DropdownMenuItem", className: className, "$separatorLine": separatorLine, to: to, style: style, role: role }, dataAttributes, otherProps),
78
+ return (react_1.default.createElement(DropdownMenuItemWrapper, Object.assign({ as: Link_1.Link, to: to }, sharedProps, dataAttributes, otherProps),
67
79
  prefix,
68
80
  children,
69
81
  suffix));
70
82
  }
71
- return (react_1.default.createElement(DropdownMenuItemWrapper, Object.assign({ "data-component-name": "Dropdown/DropdownMenuItem", className: className, role: role, style: style }, dataAttributes, { onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: onAction ? 0 : -1, active: active, disabled: disabled, separator: separator, dangerous: dangerous, "$separatorLine": separatorLine }),
83
+ return (react_1.default.createElement(DropdownMenuItemWrapper, Object.assign({}, sharedProps, dataAttributes, { onKeyDown: handleKeyDown, tabIndex: onAction ? 0 : -1 }),
72
84
  prefix,
73
85
  children || content,
74
86
  suffix));
@@ -109,7 +121,7 @@ const DropdownMenuItemWrapper = styled_components_1.default.li `
109
121
  color: var(--dropdown-menu-item-color-hover);
110
122
  }
111
123
 
112
- ${({ separator }) => separator &&
124
+ ${({ $separator }) => $separator &&
113
125
  (0, styled_components_1.css) `
114
126
  cursor: default;
115
127
  pointer-events: none;
@@ -119,7 +131,7 @@ const DropdownMenuItemWrapper = styled_components_1.default.li `
119
131
  --dropdown-menu-item-bg-color-hover: var(--dropdown-menu-item-bg-color);
120
132
  `}
121
133
 
122
- ${({ active }) => active &&
134
+ ${({ $active }) => $active &&
123
135
  (0, styled_components_1.css) `
124
136
  background-color: var(--dropdown-menu-item-bg-color-active);
125
137
  color: var(--dropdown-menu-item-color-active);
@@ -128,7 +140,7 @@ const DropdownMenuItemWrapper = styled_components_1.default.li `
128
140
  }
129
141
  `}
130
142
 
131
- ${({ disabled }) => disabled &&
143
+ ${({ $disabled }) => $disabled &&
132
144
  (0, styled_components_1.css) `
133
145
  cursor: default;
134
146
  pointer-events: none;
@@ -152,7 +164,7 @@ const DropdownMenuItemWrapper = styled_components_1.default.li `
152
164
  }
153
165
  `}
154
166
 
155
- ${({ dangerous }) => dangerous &&
167
+ ${({ $dangerous }) => $dangerous &&
156
168
  (0, styled_components_1.css) `
157
169
  &:hover,
158
170
  & {
@@ -14,7 +14,7 @@ const Button_1 = require("../../components/Button/Button");
14
14
  const Dropdown_1 = require("../../components/Dropdown/Dropdown");
15
15
  const CheckmarkIcon_1 = require("../../icons/CheckmarkIcon/CheckmarkIcon");
16
16
  function LanguagePicker(props) {
17
- const { currentLocale, locales, setLocale } = (0, hooks_1.useLanguagePicker)();
17
+ const { currentLocale, locales, getLocaleUrl } = (0, hooks_1.useLanguagePicker)();
18
18
  const { useTelemetry } = (0, hooks_1.useThemeHooks)();
19
19
  const telemetry = useTelemetry();
20
20
  if (locales.length < 2 || !currentLocale) {
@@ -23,8 +23,9 @@ function LanguagePicker(props) {
23
23
  const languagePickerButton = (react_1.default.createElement(Button_1.Button, { icon: react_1.default.createElement(GlobalOutlinedIcon_1.GlobalOutlinedIcon, { color: "--button-content-color" }), variant: "secondary", size: "medium" }));
24
24
  const languageItems = locales.map((locale) => ({
25
25
  content: locale.name || locale.code || '',
26
+ to: getLocaleUrl(locale.code),
27
+ languageInsensitive: true,
26
28
  onAction: () => {
27
- setLocale(locale.code);
28
29
  props.onChangeLanguage(locale.code);
29
30
  telemetry.sendLanguagePickerLocaleChangedMessage([{ object: 'locale', locale: locale.code }]);
30
31
  },
@@ -39,6 +39,7 @@ const utils_1 = require("../../core/utils");
39
39
  const base_table_1 = require("../../components/Markdown/styles/base-table");
40
40
  const links_1 = require("../../components/Markdown/styles/links");
41
41
  const heading_anchor_1 = require("../../components/Markdown/styles/heading-anchor");
42
+ const constants_1 = require("../../core/constants");
42
43
  exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
43
44
  'data-component-name': 'Markdown/Markdown',
44
45
  className,
@@ -85,17 +86,82 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
85
86
  max-width: 100%;
86
87
  }
87
88
 
88
- h1.md,
89
- h2.md,
90
- h3.md,
91
- h4.md,
92
- h5.md,
93
- h6.md {
89
+ .${constants_1.HEADING_ANCHOR_CLASS} {
94
90
  font-weight: var(--heading-font-weight);
95
91
  font-family: var(--heading-font-family);
96
92
  position: relative;
97
93
 
98
94
  scroll-margin-top: calc(var(--navbar-height) + var(--banner-height));
95
+ ${(0, heading_anchor_1.headingAnchorCss)(constants_1.ANCHOR_CLASS)};
96
+
97
+ h1, h2, h3, h4, h5, h6 {
98
+ display: flex;
99
+ align-items: flex-start;
100
+ gap: var(--spacing-sm);
101
+ margin: 0;
102
+ font: inherit;
103
+ color: inherit;
104
+ }
105
+ }
106
+
107
+ .${constants_1.H1_CLASS} {
108
+ ${(0, utils_1.typography)('h1')};
109
+ margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
110
+
111
+ h1 code {
112
+ font-size: var(--h1-font-size);
113
+ line-height: var(--h1-code-line-height);
114
+ }
115
+ }
116
+
117
+ .${constants_1.H2_CLASS} {
118
+ ${(0, utils_1.typography)('h2')};
119
+ margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
120
+
121
+ h2 code {
122
+ font-size: var(--h2-font-size);
123
+ line-height: var(--h2-code-line-height);
124
+ }
125
+ }
126
+
127
+ .${constants_1.H3_CLASS} {
128
+ ${(0, utils_1.typography)('h3')};
129
+ margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
130
+
131
+ h3 code {
132
+ font-size: var(--h3-font-size);
133
+ line-height: var(--h3-code-line-height);
134
+ }
135
+ }
136
+
137
+ .${constants_1.H4_CLASS} {
138
+ ${(0, utils_1.typography)('h4')};
139
+ margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
140
+
141
+ h4 code {
142
+ font-size: var(--h4-font-size);
143
+ line-height: var(--h4-code-line-height);
144
+ }
145
+ }
146
+
147
+ .${constants_1.H5_CLASS} {
148
+ ${(0, utils_1.typography)('h5')};
149
+ margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
150
+
151
+ h5 code {
152
+ font-size: var(--h5-font-size);
153
+ line-height: var(--h5-code-line-height);
154
+ }
155
+ }
156
+
157
+ .${constants_1.H6_CLASS} {
158
+ ${(0, utils_1.typography)('h6')};
159
+ margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
160
+
161
+ h6 code {
162
+ font-size: var(--h6-font-size);
163
+ line-height: var(--h6-code-line-height);
164
+ }
99
165
  }
100
166
 
101
167
  strong {
@@ -139,71 +205,71 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
139
205
  margin: var(--md-paragraph-margin);
140
206
  }
141
207
 
142
- h1.md {
208
+ /**
209
+ * @deprecated Legacy styles for ejected Heading components that render h1-h6 as the root.
210
+ *
211
+ * Deprecated legacy heading styles start.
212
+ */
213
+ h1.${constants_1.MARKDOWN_CLASS_NAME} {
143
214
  ${(0, utils_1.typography)('h1')};
144
215
  margin: var(--h1-margin-top) 0 var(--h1-margin-bottom) 0;
145
- ${(0, heading_anchor_1.headingAnchorCss)()};
146
216
  }
147
217
 
148
- h2.md {
218
+ h2.${constants_1.MARKDOWN_CLASS_NAME} {
149
219
  ${(0, utils_1.typography)('h2')};
150
220
  margin: var(--h2-margin-top) 0 var(--h2-margin-bottom) 0;
151
- ${(0, heading_anchor_1.headingAnchorCss)()};
152
221
  }
153
222
 
154
- h3.md {
223
+ h3.${constants_1.MARKDOWN_CLASS_NAME} {
155
224
  ${(0, utils_1.typography)('h3')};
156
225
  margin: var(--h3-margin-top) 0 var(--h3-margin-bottom) 0;
157
- ${(0, heading_anchor_1.headingAnchorCss)()};
158
226
  }
159
227
 
160
- h4.md {
228
+ h4.${constants_1.MARKDOWN_CLASS_NAME} {
161
229
  ${(0, utils_1.typography)('h4')};
162
230
  margin: var(--h4-margin-top) 0 var(--h4-margin-bottom) 0;
163
- ${(0, heading_anchor_1.headingAnchorCss)()};
164
231
  }
165
232
 
166
- h5.md {
233
+ h5.${constants_1.MARKDOWN_CLASS_NAME} {
167
234
  ${(0, utils_1.typography)('h5')};
168
235
  margin: var(--h5-margin-top) 0 var(--h5-margin-bottom) 0;
169
- ${(0, heading_anchor_1.headingAnchorCss)()};
170
236
  }
171
237
 
172
- h6.md {
238
+ h6.${constants_1.MARKDOWN_CLASS_NAME} {
173
239
  ${(0, utils_1.typography)('h6')};
174
240
  margin: var(--h6-margin-top) 0 var(--h6-margin-bottom) 0;
175
- ${(0, heading_anchor_1.headingAnchorCss)()};
176
241
  }
177
242
 
178
- h1.md code {
243
+ h1.${constants_1.MARKDOWN_CLASS_NAME} code {
179
244
  font-size: var(--h1-font-size);
180
245
  line-height: var(--h1-code-line-height);
181
246
  }
182
247
 
183
- h2.md code {
248
+ h2.${constants_1.MARKDOWN_CLASS_NAME} code {
184
249
  font-size: var(--h2-font-size);
185
250
  line-height: var(--h2-code-line-height);
186
251
  }
187
252
 
188
- h3.md code {
253
+ h3.${constants_1.MARKDOWN_CLASS_NAME} code {
189
254
  font-size: var(--h3-font-size);
190
255
  line-height: var(--h3-code-line-height);
191
256
  }
192
257
 
193
- h4.md code {
258
+ h4.${constants_1.MARKDOWN_CLASS_NAME} code {
194
259
  font-size: var(--h4-font-size);
195
260
  line-height: var(--h4-code-line-height);
196
261
  }
197
262
 
198
- h5.md code {
263
+ h5.${constants_1.MARKDOWN_CLASS_NAME} code {
199
264
  font-size: var(--h5-font-size);
200
265
  line-height: var(--h5-code-line-height);
201
266
  }
202
267
 
203
- h6.md code {
268
+ h6.${constants_1.MARKDOWN_CLASS_NAME} code {
204
269
  font-size: var(--h6-font-size);
205
270
  line-height: var(--h6-code-line-height);
206
271
  }
272
+ /* Deprecated legacy heading styles end. */
207
273
 
208
274
  code {
209
275
  color: var(--inline-code-text-color);
@@ -267,8 +333,8 @@ exports.Markdown = styled_components_1.default.main.attrs(({ className }) => ({
267
333
  }
268
334
  }
269
335
 
270
- ul.md,
271
- ol.md {
336
+ ul.${constants_1.MARKDOWN_CLASS_NAME},
337
+ ol.${constants_1.MARKDOWN_CLASS_NAME} {
272
338
  padding-left: var(--md-list-left-padding);
273
339
  margin: var(--md-list-margin);
274
340
 
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.markdownBaseTableCss = void 0;
4
4
  const styled_components_1 = require("styled-components");
5
+ const constants_1 = require("../../../core/constants");
5
6
  exports.markdownBaseTableCss = (0, styled_components_1.css) `
6
7
  .md-table-wrapper {
7
8
  overflow-x: auto;
8
9
  }
9
10
 
10
- table.md {
11
+ table.${constants_1.MARKDOWN_CLASS_NAME} {
11
12
  width: 100%;
12
13
  overflow: hidden;
13
14
  word-break: keep-all;
@@ -1,2 +1,2 @@
1
1
  import type { FlattenSimpleInterpolation } from 'styled-components';
2
- export declare function headingAnchorCss(className?: string): FlattenSimpleInterpolation;
2
+ export declare function headingAnchorCss(className: string): FlattenSimpleInterpolation;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.headingAnchorCss = headingAnchorCss;
4
4
  const styled_components_1 = require("styled-components");
5
- function headingAnchorCss(className = 'anchor') {
5
+ function headingAnchorCss(className) {
6
6
  return (0, styled_components_1.css) `
7
7
  .${className}.before {
8
8
  position: absolute;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.search = void 0;
4
4
  const styled_components_1 = require("styled-components");
5
- /* eslint-disable theme/no-raw-colors-in-styles */
6
5
  exports.search = (0, styled_components_1.css) `
7
6
  /**
8
7
  * @tokens Search
@@ -148,7 +147,7 @@ exports.search = (0, styled_components_1.css) `
148
147
  * @tokens AI Search
149
148
  */
150
149
 
151
- --search-ai-gradient: linear-gradient(to right, #715efe, #ff5cdc);
150
+ --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)));
152
151
 
153
152
  --search-ai-response-padding: var(--spacing-lg);
154
153
  --search-ai-response-gap: var(--spacing-sm);
@@ -264,5 +263,4 @@ exports.search = (0, styled_components_1.css) `
264
263
 
265
264
  // @tokens End
266
265
  `;
267
- /* eslint-enable theme/no-raw-colors-in-styles */
268
266
  //# sourceMappingURL=variables.js.map
@@ -13,6 +13,6 @@ function LoginButton({ href, className, variant = 'primary', size = 'medium', la
13
13
  const telemetry = useTelemetry();
14
14
  const buttonLabel = label || translate(labelTranslationKey, 'Login');
15
15
  return (react_1.default.createElement("span", { "data-component-name": componentName, className: className },
16
- react_1.default.createElement(Button_1.Button, { "data-translation-key": label ? undefined : labelTranslationKey, to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: variant, size: size }, buttonLabel)));
16
+ react_1.default.createElement(Button_1.Button, { "data-translation-key": label ? undefined : labelTranslationKey, to: href, languageInsensitive: true, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: variant, size: size }, buttonLabel)));
17
17
  }
18
18
  //# sourceMappingURL=LoginButton.js.map
@@ -0,0 +1,9 @@
1
+ export declare const HEADING_ANCHOR_CLASS = "heading-anchor";
2
+ export declare const ANCHOR_CLASS = "anchor";
3
+ export declare const HEADING_CLASS_PREFIX = "heading-level";
4
+ export declare const H1_CLASS = "heading-level-1";
5
+ export declare const H2_CLASS = "heading-level-2";
6
+ export declare const H3_CLASS = "heading-level-3";
7
+ export declare const H4_CLASS = "heading-level-4";
8
+ export declare const H5_CLASS = "heading-level-5";
9
+ export declare const H6_CLASS = "heading-level-6";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.H6_CLASS = exports.H5_CLASS = exports.H4_CLASS = exports.H3_CLASS = exports.H2_CLASS = exports.H1_CLASS = exports.HEADING_CLASS_PREFIX = exports.ANCHOR_CLASS = exports.HEADING_ANCHOR_CLASS = void 0;
4
+ exports.HEADING_ANCHOR_CLASS = 'heading-anchor';
5
+ exports.ANCHOR_CLASS = 'anchor';
6
+ exports.HEADING_CLASS_PREFIX = 'heading-level';
7
+ exports.H1_CLASS = `${exports.HEADING_CLASS_PREFIX}-1`;
8
+ exports.H2_CLASS = `${exports.HEADING_CLASS_PREFIX}-2`;
9
+ exports.H3_CLASS = `${exports.HEADING_CLASS_PREFIX}-3`;
10
+ exports.H4_CLASS = `${exports.HEADING_CLASS_PREFIX}-4`;
11
+ exports.H5_CLASS = `${exports.HEADING_CLASS_PREFIX}-5`;
12
+ exports.H6_CLASS = `${exports.HEADING_CLASS_PREFIX}-6`;
13
+ //# sourceMappingURL=heading.js.map
@@ -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';
@@ -23,4 +23,6 @@ __exportStar(require("./breadcrumb"), exports);
23
23
  __exportStar(require("./request-methods"), exports);
24
24
  __exportStar(require("./mcp"), exports);
25
25
  __exportStar(require("./feedback"), exports);
26
+ __exportStar(require("./heading"), exports);
27
+ __exportStar(require("./markdown"), exports);
26
28
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const MARKDOWN_CLASS_NAME = "md";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MARKDOWN_CLASS_NAME = void 0;
4
+ exports.MARKDOWN_CLASS_NAME = 'md';
5
+ //# sourceMappingURL=markdown.js.map
@@ -10,15 +10,4 @@ type Params = {
10
10
  root: React.RefObject<HTMLDivElement | null>;
11
11
  };
12
12
  export declare function useCodeWalkthroughSteps({ steps, enableDeepLink, root, }: Params): WalkthroughStepsState;
13
- type StepsGroup = {
14
- freeSpace: number;
15
- usedSpace: number;
16
- offset: number;
17
- steps: {
18
- offset: number;
19
- height: number;
20
- ref?: HTMLElement;
21
- }[];
22
- };
23
- export declare function getGroupMarkers(group: StepsGroup): number[];
24
13
  export {};
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useCodeWalkthroughSteps = useCodeWalkthroughSteps;
4
- exports.getGroupMarkers = getGroupMarkers;
5
4
  const react_1 = require("react");
6
5
  const react_router_dom_1 = require("react-router-dom");
7
6
  const js_utils_1 = require("../../utils/js-utils");
@@ -97,7 +96,7 @@ function useCodeWalkthroughSteps({ steps, enableDeepLink, root, }) {
97
96
  return;
98
97
  }
99
98
  step.compRef = element;
100
- setVisibleSteps((prevSteps) => (0, js_utils_1.insertAt)(prevSteps, step.index, step));
99
+ setVisibleSteps((prevSteps) => insertVisibleStepInOrder(prevSteps, step));
101
100
  }, [stepsMap]);
102
101
  const removeStep = (0, react_1.useCallback)((stepId) => {
103
102
  const step = stepsMap.get(stepId);
@@ -315,4 +314,10 @@ function getNormalizedNumber(options) {
315
314
  const { min, max, value } = options;
316
315
  return (value - min) / (max - min);
317
316
  }
317
+ function insertVisibleStepInOrder(visible, step) {
318
+ const others = visible.filter((s) => s.id !== step.id);
319
+ const laterAt = others.findIndex((s) => s.index > step.index);
320
+ const at = laterAt === -1 ? others.length : laterAt;
321
+ return (0, js_utils_1.insertAt)(others, at, step);
322
+ }
318
323
  //# sourceMappingURL=use-code-walkthrough-steps.js.map
@@ -4,6 +4,7 @@ exports.useActiveHeading = useActiveHeading;
4
4
  const react_1 = require("react");
5
5
  const react_router_dom_1 = require("react-router-dom");
6
6
  const utils_1 = require("../utils");
7
+ const constants_1 = require("../constants");
7
8
  function useActiveHeading(contentElement, displayedHeadings) {
8
9
  const [heading, setHeading] = (0, react_1.useState)(undefined);
9
10
  const [headingElements, setHeadingElements] = (0, react_1.useState)([]);
@@ -42,7 +43,7 @@ function useActiveHeading(contentElement, displayedHeadings) {
42
43
  return headingElements.findIndex((item) => item.id === id);
43
44
  }, [headingElements]);
44
45
  const findHeaders = (allContent) => {
45
- const allHeaders = allContent.querySelectorAll('.heading-anchor');
46
+ const allHeaders = allContent.querySelectorAll(`.${constants_1.HEADING_ANCHOR_CLASS}`);
46
47
  const headers = Array.from(allHeaders);
47
48
  if (displayedHeadingsRef.current && displayedHeadingsRef.current.length > 0) {
48
49
  const displayedIds = displayedHeadingsRef.current.map((h) => h === null || h === void 0 ? void 0 : h.id).filter(Boolean);
@@ -1,6 +1,11 @@
1
1
  import type { L10nConfig } from '../types/hooks';
2
- export declare function useLanguagePicker(): {
2
+ export type UseLanguagePickerResult = {
3
3
  currentLocale: L10nConfig['locales'][number] | undefined;
4
4
  locales: L10nConfig['locales'];
5
+ getLocaleUrl: (value: string) => string;
6
+ /**
7
+ * @deprecated Use `getLocaleUrl` to build the URL for the target locale, then pass it to `<Link>`.
8
+ */
5
9
  setLocale: (value: string) => void;
6
10
  };
11
+ export declare function useLanguagePicker(): UseLanguagePickerResult;
@@ -9,15 +9,23 @@ function useLanguagePicker() {
9
9
  const navigate = (0, react_router_dom_1.useNavigate)();
10
10
  const loadAndNavigate = useLoadAndNavigate();
11
11
  const { currentLocale, locales, defaultLocale } = useL10nConfig();
12
+ const location = (0, react_router_dom_1.useLocation)();
12
13
  const locale = locales.find((l) => l.code === currentLocale);
14
+ function getLocaleUrl(value) {
15
+ let newLangPathname = (0, urls_1.getPathnameForLocale)((0, urls_1.withoutPathPrefix)(location.pathname), defaultLocale, value, locales);
16
+ if (location.search) {
17
+ newLangPathname += location.search;
18
+ }
19
+ return (0, urls_1.addLeadingSlash)(newLangPathname);
20
+ }
13
21
  function setLocale(value) {
14
- const newLangPathname = (0, urls_1.withPathPrefix)((0, urls_1.getPathnameForLocale)((0, urls_1.withoutPathPrefix)(location.pathname), defaultLocale, value, locales));
15
- const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
22
+ const newUrlWithLanguage = (0, urls_1.withPathPrefix)(getLocaleUrl(value));
16
23
  loadAndNavigate({ navigate, to: newUrlWithLanguage });
17
24
  }
18
25
  return {
19
26
  currentLocale: locale,
20
27
  locales,
28
+ getLocaleUrl,
21
29
  setLocale,
22
30
  };
23
31
  }
@@ -22,6 +22,9 @@ function brandPaletteDark(palette) {
22
22
  --color-brand-subtle-3: #55576166;
23
23
  --color-brand-subtle-4: #6e6f7a66;
24
24
  --text-color-on-color: #000000;
25
+
26
+ --search-ai-gradient-start-color: var(--color-brand-3);
27
+ --search-ai-gradient-end-color: var(--color-brand-7);
25
28
  `;
26
29
  case 'pink':
27
30
  return (0, styled_components_1.css) `
@@ -41,6 +44,9 @@ function brandPaletteDark(palette) {
41
44
  --color-brand-subtle-3: #85366866;
42
45
  --color-brand-subtle-4: #a03a7b66;
43
46
  --text-color-on-color: #ffffff;
47
+
48
+ --search-ai-gradient-start-color: var(--color-brand-5); // @presenter Color
49
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
44
50
  `;
45
51
  case 'coral':
46
52
  return (0, styled_components_1.css) `
@@ -60,6 +66,9 @@ function brandPaletteDark(palette) {
60
66
  --color-brand-subtle-3: #8b3c4266;
61
67
  --color-brand-subtle-4: #a9434c66;
62
68
  --text-color-on-color: #ffffff;
69
+
70
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
71
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
63
72
  `;
64
73
  case 'amber':
65
74
  return (0, styled_components_1.css) `
@@ -79,6 +88,9 @@ function brandPaletteDark(palette) {
79
88
  --color-brand-subtle-3: #93632f66;
80
89
  --color-brand-subtle-4: #b6732a66;
81
90
  --text-color-on-color: #ffffff;
91
+
92
+ --search-ai-gradient-start-color: var(--color-brand-5); // @presenter Color
93
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
82
94
  `;
83
95
  case 'jade':
84
96
  return (0, styled_components_1.css) `
@@ -98,6 +110,9 @@ function brandPaletteDark(palette) {
98
110
  --color-brand-subtle-3: #2b715e66;
99
111
  --color-brand-subtle-4: #2b816b66;
100
112
  --text-color-on-color: #ffffff;
113
+
114
+ --search-ai-gradient-start-color: var(--color-brand-4);
115
+ --search-ai-gradient-end-color: var(--color-brand-7);
101
116
  `;
102
117
  case 'cyan':
103
118
  return (0, styled_components_1.css) `
@@ -117,6 +132,9 @@ function brandPaletteDark(palette) {
117
132
  --color-brand-subtle-3: #246e7f66;
118
133
  --color-brand-subtle-4: #1b809766;
119
134
  --text-color-on-color: #ffffff;
135
+
136
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
137
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
120
138
  `;
121
139
  case 'ocean':
122
140
  return (0, styled_components_1.css) `
@@ -136,6 +154,9 @@ function brandPaletteDark(palette) {
136
154
  --color-brand-subtle-3: #2a679566;
137
155
  --color-brand-subtle-4: #2277b966;
138
156
  --text-color-on-color: #ffffff;
157
+
158
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
159
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
139
160
  `;
140
161
  case 'indigo':
141
162
  return (0, styled_components_1.css) `
@@ -155,6 +176,9 @@ function brandPaletteDark(palette) {
155
176
  --color-brand-subtle-3: #36498866;
156
177
  --color-brand-subtle-4: #3952a466;
157
178
  --text-color-on-color: #ffffff;
179
+
180
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
181
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
158
182
  `;
159
183
  case 'iris':
160
184
  return (0, styled_components_1.css) `
@@ -174,6 +198,9 @@ function brandPaletteDark(palette) {
174
198
  --color-brand-subtle-3: #43438580;
175
199
  --color-brand-subtle-4: #4c4ca080;
176
200
  --text-color-on-color: #ffffff;
201
+
202
+ --search-ai-gradient-start-color: var(--color-brand-4); // @presenter Color
203
+ --search-ai-gradient-end-color: var(--color-brand-8); // @presenter Color
177
204
  `;
178
205
  default:
179
206
  return (0, styled_components_1.css) `