@redocly/theme 0.70.0-next.2 → 0.70.0-next.3
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/CodeBlock/CodeBlockControls.js +3 -5
- package/lib/components/Consent/Consent.d.ts +2 -0
- package/lib/components/Consent/Consent.js +17 -0
- package/lib/components/Consent/ConsentBanner.d.ts +2 -0
- package/lib/components/Consent/ConsentBanner.js +120 -0
- package/lib/components/Consent/ConsentDialog.d.ts +2 -0
- package/lib/components/Consent/ConsentDialog.js +128 -0
- package/lib/components/Consent/ConsentSettingsLink.d.ts +2 -0
- package/lib/components/Consent/ConsentSettingsLink.js +35 -0
- package/lib/components/Consent/variables.d.ts +1 -0
- package/lib/components/Consent/variables.js +31 -0
- package/lib/components/Footer/Footer.js +4 -1
- package/lib/components/JsonViewer/Helpers.d.ts +10 -2
- package/lib/components/JsonViewer/Helpers.js +29 -33
- package/lib/components/JsonViewer/JsonViewer.js +15 -18
- package/lib/components/Markdown/styles/base-table.js +14 -1
- package/lib/components/Markdown/variables.js +1 -0
- package/lib/components/Product/utils.js +1 -1
- package/lib/components/Search/SearchAiMessage.js +1 -1
- package/lib/components/Search/SearchAiResponse.js +1 -0
- package/lib/core/constants/consent.d.ts +2 -0
- package/lib/core/constants/consent.js +30 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-consent-dialog.d.ts +12 -0
- package/lib/core/hooks/use-consent-dialog.js +36 -0
- package/lib/core/hooks/use-consent-telemetry.d.ts +1 -0
- package/lib/core/hooks/use-consent-telemetry.js +42 -0
- package/lib/core/hooks/use-theme-hooks.js +14 -0
- package/lib/core/styles/global.js +42 -40
- package/lib/core/types/consent.d.ts +54 -0
- package/lib/core/types/consent.js +3 -0
- package/lib/core/types/hooks.d.ts +2 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/utils/consent-settings-link-placement.d.ts +3 -0
- package/lib/core/utils/consent-settings-link-placement.js +15 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/mcp.js +1 -1
- package/lib/core/utils/menu.js +6 -5
- package/lib/core/utils/urls.js +3 -1
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.d.ts +29 -0
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.js +81 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +3 -3
- package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
- package/src/components/Consent/Consent.tsx +18 -0
- package/src/components/Consent/ConsentBanner.tsx +110 -0
- package/src/components/Consent/ConsentDialog.tsx +210 -0
- package/src/components/Consent/ConsentSettingsLink.tsx +44 -0
- package/src/components/Consent/variables.ts +28 -0
- package/src/components/Footer/Footer.tsx +2 -0
- package/src/components/JsonViewer/Helpers.tsx +46 -51
- package/src/components/JsonViewer/JsonViewer.tsx +23 -25
- package/src/components/Markdown/styles/base-table.ts +14 -1
- package/src/components/Markdown/variables.ts +1 -0
- package/src/components/Product/utils.ts +1 -1
- package/src/components/Search/SearchAiMessage.tsx +1 -1
- package/src/components/Search/SearchAiResponse.tsx +1 -0
- package/src/core/constants/consent.ts +29 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +15 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-consent-dialog.ts +51 -0
- package/src/core/hooks/use-consent-telemetry.ts +56 -0
- package/src/core/hooks/use-theme-hooks.ts +14 -0
- package/src/core/styles/global.ts +2 -0
- package/src/core/types/consent.ts +51 -0
- package/src/core/types/hooks.ts +2 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +22 -1
- package/src/core/utils/consent-settings-link-placement.ts +18 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/mcp.ts +1 -1
- package/src/core/utils/menu.ts +5 -6
- package/src/core/utils/urls.ts +3 -1
- package/src/icons/ExpandCollapseIcon/ExpandCollapseIcon.tsx +56 -0
- package/src/index.ts +1 -0
package/src/core/utils/index.ts
CHANGED
package/src/core/utils/mcp.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function slugifyMcpServerName(name: string): string {
|
|
|
39
39
|
return name
|
|
40
40
|
.toLowerCase()
|
|
41
41
|
.replace(/[^a-z0-9_-]+/g, '-')
|
|
42
|
-
.replace(
|
|
42
|
+
.replace(/^-+|(?<!-)-+$/g, '');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export function generateClaudeCodeCommand(config: McpConnectionParams): string {
|
package/src/core/utils/menu.ts
CHANGED
|
@@ -24,10 +24,7 @@ export const mapNavbarItems = (
|
|
|
24
24
|
...(navItem.items && {
|
|
25
25
|
items: mapNavbarItems(navItem.items, defaultLocale, currentLocale, locales, location),
|
|
26
26
|
}),
|
|
27
|
-
|
|
28
|
-
active:
|
|
29
|
-
'link' in navItem &&
|
|
30
|
-
isItemActive(navItem, defaultLocale, currentLocale, locales, location),
|
|
27
|
+
active: isItemActive(navItem, defaultLocale, currentLocale, locales, location),
|
|
31
28
|
hasActiveSubItem: !!navItem.items?.find((item) =>
|
|
32
29
|
isItemActive(item, defaultLocale, currentLocale, locales, location),
|
|
33
30
|
),
|
|
@@ -42,10 +39,12 @@ export const isItemActive = (
|
|
|
42
39
|
locales: Locale[],
|
|
43
40
|
location: Location,
|
|
44
41
|
): boolean => {
|
|
42
|
+
if (!item.link) return false;
|
|
43
|
+
|
|
45
44
|
const pathHash = location.pathname + location.hash;
|
|
46
45
|
const link = item.languageInsensitive
|
|
47
|
-
? item.link
|
|
48
|
-
: getPathnameForLocale(item.link
|
|
46
|
+
? item.link
|
|
47
|
+
: getPathnameForLocale(item.link, defaultLocale, currentLocale, locales);
|
|
49
48
|
|
|
50
49
|
return pathHash === withPathPrefix(link);
|
|
51
50
|
};
|
package/src/core/utils/urls.ts
CHANGED
|
@@ -5,7 +5,9 @@ import { DEFAULT_LOCALE_PLACEHOLDER } from '../constants/common';
|
|
|
5
5
|
export function combineUrls(baseURL: string, ...relativeURLs: (string | undefined)[]) {
|
|
6
6
|
let res = baseURL;
|
|
7
7
|
for (let relativeURL of relativeURLs) {
|
|
8
|
-
res = relativeURL
|
|
8
|
+
res = relativeURL
|
|
9
|
+
? res.replace(/(?<![/\\])[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '')
|
|
10
|
+
: res;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
return res;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path
|
|
11
|
+
className="corner-top"
|
|
12
|
+
d="M12.2432 8.70703H11.2461L11.2422 4.75781L7.29297 4.75391V3.75781H12.2432V8.70703Z"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
className="corner-bottom"
|
|
16
|
+
d="M4.75781 11.2422L8.70703 11.2461V12.2432H3.75781V7.29297H4.75391L4.75781 11.2422Z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const ExpandCollapseIcon = styled(Icon).attrs({
|
|
22
|
+
'data-component-name': 'icons/ExpandCollapseIcon/ExpandCollapseIcon',
|
|
23
|
+
})<{ $collapse?: boolean }>`
|
|
24
|
+
path {
|
|
25
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
26
|
+
transform-box: view-box;
|
|
27
|
+
transition: transform 0.3s ease-in-out;
|
|
28
|
+
|
|
29
|
+
@media (prefers-reduced-motion: reduce) {
|
|
30
|
+
transition: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.corner-top {
|
|
35
|
+
transform-origin: 10.756px 5.244px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.corner-bottom {
|
|
39
|
+
transform-origin: 5.244px 10.756px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${({ $collapse }) =>
|
|
43
|
+
$collapse &&
|
|
44
|
+
css`
|
|
45
|
+
.corner-top {
|
|
46
|
+
transform: rotate(180deg);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.corner-bottom {
|
|
50
|
+
transform: rotate(-180deg);
|
|
51
|
+
}
|
|
52
|
+
`}
|
|
53
|
+
|
|
54
|
+
height: ${({ size }) => size || '16px'};
|
|
55
|
+
width: ${({ size }) => size || '16px'};
|
|
56
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -253,6 +253,7 @@ export * from '@redocly/theme/icons/LinkIcon/LinkIcon';
|
|
|
253
253
|
export * from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
254
254
|
export * from '@redocly/theme/icons/MinimizeIcon/MinimizeIcon';
|
|
255
255
|
export * from '@redocly/theme/icons/MaximizeIcon/MaximizeIcon';
|
|
256
|
+
export * from '@redocly/theme/icons/ExpandCollapseIcon/ExpandCollapseIcon';
|
|
256
257
|
export * from '@redocly/theme/icons/MarkdownFullIcon/MarkdownFullIcon';
|
|
257
258
|
export * from '@redocly/theme/icons/DocumentBlankIcon/DocumentBlankIcon';
|
|
258
259
|
export * from '@redocly/theme/icons/WarningSquareIcon/WarningSquareIcon';
|