@redocly/theme 0.59.0-rc.1 → 0.59.0-rc.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/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.d.ts +1 -0
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +11 -0
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +24 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
- package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +9 -0
- package/src/core/hooks/use-page-actions.ts +33 -2
- package/src/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AfterAsyncApiChannelDescription: any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// interface AfterAsyncApiChannelDescriptionProps {
|
|
3
|
+
// channel: any;
|
|
4
|
+
// }
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AfterAsyncApiChannelDescription = void 0;
|
|
7
|
+
// export function AfterAsyncApiChannelDescription(_props: AfterAsyncApiChannelDescriptionProps) {
|
|
8
|
+
// return null;
|
|
9
|
+
// }
|
|
10
|
+
exports.AfterAsyncApiChannelDescription = null;
|
|
11
|
+
//# sourceMappingURL=AfterAsyncApiChannelDescription.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PageAction } from '../types';
|
|
2
|
-
export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'mcp-cursor';
|
|
2
|
+
export type PageActionType = 'copy' | 'view' | 'chatgpt' | 'claude' | 'mcp-cursor' | 'mcp-claude' | 'mcp-json';
|
|
3
3
|
export declare function usePageActions(pageSlug: string, mcpUrl?: string, actions?: PageActionType[]): PageAction[];
|
|
@@ -33,7 +33,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
33
33
|
const { isPublic } = usePageData() || {};
|
|
34
34
|
const result = (0, react_1.useMemo)(() => {
|
|
35
35
|
var _a, _b;
|
|
36
|
-
if (shouldHideAllActions) {
|
|
36
|
+
if (shouldHideAllActions && !(actions === null || actions === void 0 ? void 0 : actions.length)) {
|
|
37
37
|
return [];
|
|
38
38
|
}
|
|
39
39
|
const origin = dom_1.IS_BROWSER ? window.location.origin : globalThis['SSR_HOSTNAME'];
|
|
@@ -80,6 +80,29 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
};
|
|
83
|
+
case 'mcp-claude':
|
|
84
|
+
if (!mcpUrl) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
buttonText: 'Copy Claude configuration',
|
|
89
|
+
title: 'Copy Claude configuration',
|
|
90
|
+
description: 'Copy MCP configuration for Claude',
|
|
91
|
+
iconComponent: ClaudeIcon_1.ClaudeIcon,
|
|
92
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
clipboard_service_1.ClipboardService.copyCustom(`claude mcp add --transport http server ${mcpUrl}`);
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
case 'mcp-json':
|
|
97
|
+
return {
|
|
98
|
+
buttonText: 'Copy MCP configuration',
|
|
99
|
+
title: 'Copy MCP JSON configuration',
|
|
100
|
+
description: 'Copy MCP JSON configuration',
|
|
101
|
+
iconComponent: CopyIcon_1.CopyIcon,
|
|
102
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
clipboard_service_1.ClipboardService.copyCustom(generateMCPConfig());
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
83
106
|
case 'copy':
|
|
84
107
|
return {
|
|
85
108
|
buttonText: translate('page.actions.copyButtonText', 'Copy'),
|
package/lib/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export * from './components/OpenApiDocs/hooks/BeforeOpenApiOperation';
|
|
|
83
83
|
export * from './components/OpenApiDocs/hooks/OpenApiFooter';
|
|
84
84
|
export * from './components/OpenApiDocs/hooks/OpenApiHeader';
|
|
85
85
|
export * from './components/OpenApiDocs/hooks/AdditionalOverviewInfo';
|
|
86
|
+
export * from './components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription';
|
|
86
87
|
export * from './components/SidebarActions/ChangeViewButton';
|
|
87
88
|
export * from './components/SidebarActions/SidebarActions';
|
|
88
89
|
export * from './components/SidebarActions/styled';
|
package/lib/index.js
CHANGED
|
@@ -136,6 +136,7 @@ __exportStar(require("./components/OpenApiDocs/hooks/BeforeOpenApiOperation"), e
|
|
|
136
136
|
__exportStar(require("./components/OpenApiDocs/hooks/OpenApiFooter"), exports);
|
|
137
137
|
__exportStar(require("./components/OpenApiDocs/hooks/OpenApiHeader"), exports);
|
|
138
138
|
__exportStar(require("./components/OpenApiDocs/hooks/AdditionalOverviewInfo"), exports);
|
|
139
|
+
__exportStar(require("./components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription"), exports);
|
|
139
140
|
/* SidebarActions */
|
|
140
141
|
__exportStar(require("./components/SidebarActions/ChangeViewButton"), exports);
|
|
141
142
|
__exportStar(require("./components/SidebarActions/SidebarActions"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// interface AfterAsyncApiChannelDescriptionProps {
|
|
2
|
+
// channel: any;
|
|
3
|
+
// }
|
|
4
|
+
|
|
5
|
+
// export function AfterAsyncApiChannelDescription(_props: AfterAsyncApiChannelDescriptionProps) {
|
|
6
|
+
// return null;
|
|
7
|
+
// }
|
|
8
|
+
|
|
9
|
+
export const AfterAsyncApiChannelDescription: any = null;
|
|
@@ -18,7 +18,14 @@ const DEFAULT_ENABLED_ACTIONS = ['copy', 'view', 'chatgpt', 'claude'] as const;
|
|
|
18
18
|
const CURSOR_URL =
|
|
19
19
|
'cursor://anysphere.cursor-deeplink/mcp/install?name=$NAME&config=$BASE64_ENCODED_CONFIG';
|
|
20
20
|
|
|
21
|
-
export type PageActionType =
|
|
21
|
+
export type PageActionType =
|
|
22
|
+
| 'copy'
|
|
23
|
+
| 'view'
|
|
24
|
+
| 'chatgpt'
|
|
25
|
+
| 'claude'
|
|
26
|
+
| 'mcp-cursor'
|
|
27
|
+
| 'mcp-claude'
|
|
28
|
+
| 'mcp-json';
|
|
22
29
|
|
|
23
30
|
export function usePageActions(
|
|
24
31
|
pageSlug: string,
|
|
@@ -42,7 +49,7 @@ export function usePageActions(
|
|
|
42
49
|
const { isPublic } = usePageData() || {};
|
|
43
50
|
|
|
44
51
|
const result: PageAction[] = useMemo(() => {
|
|
45
|
-
if (shouldHideAllActions) {
|
|
52
|
+
if (shouldHideAllActions && !actions?.length) {
|
|
46
53
|
return [];
|
|
47
54
|
}
|
|
48
55
|
|
|
@@ -106,6 +113,30 @@ export function usePageActions(
|
|
|
106
113
|
}
|
|
107
114
|
},
|
|
108
115
|
};
|
|
116
|
+
case 'mcp-claude':
|
|
117
|
+
if (!mcpUrl) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
buttonText: 'Copy Claude configuration',
|
|
123
|
+
title: 'Copy Claude configuration',
|
|
124
|
+
description: 'Copy MCP configuration for Claude',
|
|
125
|
+
iconComponent: ClaudeIcon,
|
|
126
|
+
onClick: async () => {
|
|
127
|
+
ClipboardService.copyCustom(`claude mcp add --transport http server ${mcpUrl}`);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
case 'mcp-json':
|
|
131
|
+
return {
|
|
132
|
+
buttonText: 'Copy MCP configuration',
|
|
133
|
+
title: 'Copy MCP JSON configuration',
|
|
134
|
+
description: 'Copy MCP JSON configuration',
|
|
135
|
+
iconComponent: CopyIcon,
|
|
136
|
+
onClick: async () => {
|
|
137
|
+
ClipboardService.copyCustom(generateMCPConfig());
|
|
138
|
+
},
|
|
139
|
+
};
|
|
109
140
|
case 'copy':
|
|
110
141
|
return {
|
|
111
142
|
buttonText: translate('page.actions.copyButtonText', 'Copy'),
|
package/src/index.ts
CHANGED
|
@@ -98,6 +98,7 @@ export * from '@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperatio
|
|
|
98
98
|
export * from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiFooter';
|
|
99
99
|
export * from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiHeader';
|
|
100
100
|
export * from '@redocly/theme/components/OpenApiDocs/hooks/AdditionalOverviewInfo';
|
|
101
|
+
export * from '@redocly/theme/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription';
|
|
101
102
|
/* SidebarActions */
|
|
102
103
|
export * from '@redocly/theme/components/SidebarActions/ChangeViewButton';
|
|
103
104
|
export * from '@redocly/theme/components/SidebarActions/SidebarActions';
|