@redocly/theme 0.59.0-rc.2 → 0.60.0-next.0
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/LICENSE +7 -1
- package/lib/components/Buttons/AIAssistantButton.js +6 -2
- package/lib/components/Buttons/ConnectMCPButton.d.ts +8 -0
- package/lib/components/Buttons/ConnectMCPButton.js +145 -0
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +42 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +4 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +1 -1
- package/lib/components/Catalog/variables.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +5 -5
- package/lib/components/Link/Link.d.ts +1 -0
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/PageActions/PageActions.js +4 -1
- package/lib/components/PageActions/variables.js +2 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
- package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
- package/lib/components/Search/SearchAiActionButtons.js +43 -0
- package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
- package/lib/components/Search/SearchAiConversationInput.js +39 -7
- package/lib/components/Search/SearchAiDialog.d.ts +3 -6
- package/lib/components/Search/SearchAiDialog.js +20 -9
- package/lib/components/Search/SearchAiMessage.d.ts +9 -5
- package/lib/components/Search/SearchAiMessage.js +146 -22
- package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +8 -0
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +169 -0
- package/lib/components/Search/SearchDialog.js +36 -5
- package/lib/components/Search/SearchGroups.js +2 -2
- package/lib/components/Search/variables.js +36 -64
- package/lib/components/Segmented/Segmented.d.ts +1 -8
- package/lib/components/Segmented/Segmented.js +3 -1
- package/lib/components/Select/SelectInput.js +1 -1
- package/lib/components/Select/variables.js +2 -2
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +66 -17
- package/lib/components/Tag/variables.dark.js +135 -36
- package/lib/components/Tag/variables.js +78 -61
- package/lib/config.d.ts +2 -2
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/mcp.d.ts +1 -0
- package/lib/core/constants/mcp.js +5 -0
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/hooks/index.d.ts +3 -0
- package/lib/core/hooks/index.js +3 -0
- package/lib/core/hooks/menu/use-nested-menu.js +1 -1
- package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
- package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
- package/lib/core/hooks/use-connect-mcp-button.d.ts +13 -0
- package/lib/core/hooks/use-connect-mcp-button.js +50 -0
- package/lib/core/hooks/use-mcp-config.d.ts +9 -0
- package/lib/core/hooks/use-mcp-config.js +27 -0
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +99 -119
- package/lib/core/hooks/use-product-picker.js +2 -1
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
- package/lib/core/hooks/use-telemetry-fallback.js +10 -8
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/styles/dark.js +4 -0
- package/lib/core/styles/global.js +5 -0
- package/lib/core/types/hooks.d.ts +2 -2
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +6 -0
- package/lib/core/types/mcp.js +3 -0
- package/lib/core/types/search.d.ts +11 -4
- package/lib/core/types/search.js +6 -0
- package/lib/core/types/segmented.d.ts +12 -0
- package/lib/core/types/segmented.js +3 -0
- package/lib/core/utils/frontmatter-translate.d.ts +6 -0
- package/lib/core/utils/frontmatter-translate.js +14 -0
- package/lib/core/utils/index.d.ts +2 -0
- package/lib/core/utils/index.js +2 -0
- package/lib/core/utils/mcp.d.ts +2 -0
- package/lib/core/utils/mcp.js +31 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/ConnectIcon/ConnectIcon.d.ts +9 -0
- package/lib/icons/ConnectIcon/ConnectIcon.js +17 -0
- package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
- package/lib/icons/CubeIcon/CubeIcon.js +17 -0
- package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
- package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.d.ts +9 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.js +17 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/markdoc/components/Cards/Card.js +1 -28
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.d.ts +8 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.js +19 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +197 -47
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +57 -12
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +6 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/card.js +0 -1
- package/lib/markdoc/tags/connect-mcp.d.ts +2 -0
- package/lib/markdoc/tags/connect-mcp.js +27 -0
- package/package.json +6 -6
- package/src/components/Buttons/AIAssistantButton.tsx +6 -2
- package/src/components/Buttons/ConnectMCPButton.tsx +180 -0
- package/src/components/Buttons/variables.ts +42 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +5 -0
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +1 -5
- package/src/components/Catalog/variables.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Link/Link.tsx +1 -0
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/PageActions/PageActions.tsx +5 -1
- package/src/components/PageActions/variables.ts +2 -0
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
- package/src/components/Search/SearchAiActionButtons.tsx +76 -0
- package/src/components/Search/SearchAiConversationInput.tsx +61 -18
- package/src/components/Search/SearchAiDialog.tsx +52 -23
- package/src/components/Search/SearchAiMessage.tsx +172 -43
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +210 -0
- package/src/components/Search/SearchDialog.tsx +49 -13
- package/src/components/Search/SearchGroups.tsx +2 -0
- package/src/components/Search/variables.ts +36 -64
- package/src/components/Segmented/Segmented.tsx +15 -20
- package/src/components/Select/SelectInput.tsx +1 -0
- package/src/components/Select/variables.ts +2 -2
- package/src/components/Tag/Tag.tsx +35 -19
- package/src/components/Tag/variables.dark.ts +135 -36
- package/src/components/Tag/variables.ts +78 -61
- package/src/config.ts +2 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/mcp.ts +1 -0
- package/src/core/constants/search.ts +8 -4
- package/src/core/hooks/index.ts +3 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
- package/src/core/hooks/use-connect-mcp-button.ts +79 -0
- package/src/core/hooks/use-mcp-config.ts +43 -0
- package/src/core/hooks/use-page-actions.ts +141 -150
- package/src/core/hooks/use-product-picker.ts +2 -1
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/hooks/use-telemetry-fallback.ts +10 -8
- package/src/core/openapi/index.ts +1 -0
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +6 -1
- package/src/core/types/hooks.ts +5 -1
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +13 -0
- package/src/core/types/mcp.ts +8 -0
- package/src/core/types/search.ts +13 -4
- package/src/core/types/segmented.ts +14 -0
- package/src/core/utils/frontmatter-translate.ts +9 -0
- package/src/core/utils/index.ts +2 -0
- package/src/core/utils/mcp.ts +34 -0
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/ConnectIcon/ConnectIcon.tsx +27 -0
- package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
- package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
- package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
- package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
- package/src/icons/VSCodeIcon/VSCodeIcon.tsx +29 -0
- package/src/index.ts +1 -2
- package/src/markdoc/components/Cards/Card.tsx +1 -28
- package/src/markdoc/components/ConnectMCP/ConnectMCP.tsx +28 -0
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/card.ts +0 -1
- package/src/markdoc/tags/connect-mcp.ts +25 -0
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +0 -1
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +0 -11
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +0 -1
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +0 -5
- package/lib/ext/process-scorecard.d.ts +0 -5
- package/lib/ext/process-scorecard.js +0 -11
- package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +0 -9
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +0 -1
- package/src/ext/process-scorecard.ts +0 -13
|
@@ -6,15 +6,20 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_router_dom_1 = require("react-router-dom");
|
|
7
7
|
const MORE_BUTTON_WIDTH = 80;
|
|
8
8
|
const TABS_GAP = 8;
|
|
9
|
-
function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
|
|
9
|
+
function useTabs({ activeTab, onTabChange, totalTabs, containerRef, }) {
|
|
10
10
|
const [tabs, setTabs] = (0, react_1.useState)({
|
|
11
11
|
visible: Array.from({ length: totalTabs }, (_, i) => i),
|
|
12
12
|
overflow: [],
|
|
13
13
|
});
|
|
14
|
+
const [isReady, setIsReady] = (0, react_1.useState)(false);
|
|
15
|
+
const isFirstCalculation = (0, react_1.useRef)(true);
|
|
14
16
|
const tabRefs = (0, react_1.useRef)([]);
|
|
15
17
|
const tabWidthsRef = (0, react_1.useRef)([]);
|
|
16
18
|
const tabLabelsRef = (0, react_1.useRef)([]);
|
|
17
|
-
const
|
|
19
|
+
const activeTabRef = (0, react_1.useRef)(activeTab);
|
|
20
|
+
const calculateVisibleTabsRef = (0, react_1.useRef)(null);
|
|
21
|
+
// Synchronously update ref before any callbacks or effects run
|
|
22
|
+
activeTabRef.current = activeTab;
|
|
18
23
|
const setTabRef = (0, react_1.useCallback)((element, index) => {
|
|
19
24
|
tabRefs.current[index] = element;
|
|
20
25
|
const width = element === null || element === void 0 ? void 0 : element.offsetWidth;
|
|
@@ -25,18 +30,25 @@ function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
|
|
|
25
30
|
if (label) {
|
|
26
31
|
tabLabelsRef.current[index] = label;
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// Trigger calculation once all tabs are registered
|
|
34
|
+
if (isFirstCalculation.current &&
|
|
35
|
+
tabWidthsRef.current.length >= totalTabs &&
|
|
36
|
+
tabLabelsRef.current.length >= totalTabs &&
|
|
37
|
+
calculateVisibleTabsRef.current) {
|
|
38
|
+
requestAnimationFrame(calculateVisibleTabsRef.current);
|
|
39
|
+
}
|
|
40
|
+
}, [totalTabs]);
|
|
41
|
+
const focusTab = (0, react_1.useCallback)((index) => {
|
|
30
42
|
const currentElement = tabRefs.current[index];
|
|
31
43
|
currentElement === null || currentElement === void 0 ? void 0 : currentElement.focus();
|
|
32
|
-
};
|
|
44
|
+
}, []);
|
|
33
45
|
const onTabSelect = (0, react_1.useCallback)((index) => {
|
|
34
46
|
var _a;
|
|
35
47
|
focusTab(index);
|
|
36
48
|
const label = (_a = tabRefs.current[index]) === null || _a === void 0 ? void 0 : _a.getAttribute('data-label');
|
|
37
49
|
if (label)
|
|
38
50
|
onTabChange(label);
|
|
39
|
-
}, [onTabChange]);
|
|
51
|
+
}, [onTabChange, focusTab]);
|
|
40
52
|
const handleKeyboard = (0, react_1.useCallback)((event, index) => {
|
|
41
53
|
let newIndex = index;
|
|
42
54
|
if (event.key === 'ArrowRight') {
|
|
@@ -59,109 +71,155 @@ function useTabs({ activeTab, onTabChange, totalTabs, containerRef }) {
|
|
|
59
71
|
onTabSelect(newIndex);
|
|
60
72
|
}, [totalTabs, onTabSelect]);
|
|
61
73
|
const replaceLastVisibleTabWithClickedOverflowTab = (0, react_1.useCallback)((clickedIndex) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
newOverflowTabs.unshift(lastVisible);
|
|
71
|
-
newVisibleTabs.splice(newVisibleTabs.length - 1, 1);
|
|
72
|
-
newVisibleTabs.unshift(clickedIndex);
|
|
73
|
-
}
|
|
74
|
-
setTabs({
|
|
75
|
-
visible: newVisibleTabs,
|
|
76
|
-
overflow: newOverflowTabs,
|
|
74
|
+
setTabs((prevTabs) => {
|
|
75
|
+
const { visible: visibleTabs, overflow: overflowTabs } = prevTabs;
|
|
76
|
+
const sortedVisible = [...visibleTabs].sort((a, b) => a - b);
|
|
77
|
+
const lastVisible = sortedVisible[sortedVisible.length - 1];
|
|
78
|
+
return {
|
|
79
|
+
visible: visibleTabs.map((idx) => (idx === lastVisible ? clickedIndex : idx)),
|
|
80
|
+
overflow: overflowTabs.map((idx) => (idx === clickedIndex ? lastVisible : idx)),
|
|
81
|
+
};
|
|
77
82
|
});
|
|
78
|
-
}, [
|
|
83
|
+
}, []);
|
|
79
84
|
const onTabClick = (0, react_1.useCallback)((labelOrIndex) => {
|
|
80
85
|
const clickedIndex = typeof labelOrIndex === 'string'
|
|
81
86
|
? tabRefs.current.findIndex((ref) => (ref === null || ref === void 0 ? void 0 : ref.getAttribute('data-label')) === labelOrIndex)
|
|
82
87
|
: labelOrIndex;
|
|
83
88
|
if (clickedIndex === -1)
|
|
84
89
|
return;
|
|
85
|
-
const hasOverflowTabs = tabs.overflow.length > 0;
|
|
86
|
-
if (hasOverflowTabs && !allTabsHidden && tabs.overflow.includes(clickedIndex)) {
|
|
87
|
-
replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
|
|
88
|
-
}
|
|
89
90
|
const label = tabLabelsRef.current[clickedIndex];
|
|
90
|
-
if (label)
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
if (!label)
|
|
92
|
+
return;
|
|
93
|
+
// If this is an overflow tab, replace it with a visible one
|
|
94
|
+
if (tabs.overflow.includes(clickedIndex)) {
|
|
95
|
+
replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
|
|
93
96
|
}
|
|
94
|
-
|
|
97
|
+
onTabChange(label);
|
|
98
|
+
focusTab(clickedIndex);
|
|
99
|
+
}, [tabs.overflow, onTabChange, replaceLastVisibleTabWithClickedOverflowTab, focusTab]);
|
|
95
100
|
const calculateVisibleTabs = (0, react_1.useCallback)(() => {
|
|
96
101
|
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
97
102
|
if (!container)
|
|
98
103
|
return;
|
|
99
104
|
const containerWidth = container.offsetWidth;
|
|
100
105
|
const tabWidths = tabWidthsRef.current;
|
|
101
|
-
const
|
|
102
|
-
//
|
|
106
|
+
const tabLabels = tabLabelsRef.current;
|
|
107
|
+
// Wait until all tabs are registered before calculating
|
|
108
|
+
if (tabWidths.length < totalTabs || tabLabels.length < totalTabs) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
// Check if container has proper width (not zero)
|
|
112
|
+
if (containerWidth === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Find active tab index by label in tabLabelsRef, not by DOM element
|
|
116
|
+
// because tab might not be rendered if it's in overflow
|
|
117
|
+
const activeTabIndex = tabLabels.findIndex((label) => label === activeTabRef.current);
|
|
103
118
|
let tabsWidth = activeTabIndex !== -1 ? tabWidths[activeTabIndex] : 0;
|
|
104
|
-
const
|
|
105
|
-
const
|
|
119
|
+
const visibleTabs = activeTabIndex !== -1 ? [activeTabIndex] : [];
|
|
120
|
+
const overflowTabs = [];
|
|
106
121
|
for (let i = 0; i < tabWidths.length; i++) {
|
|
107
|
-
|
|
108
|
-
if (i === activeTabIndex) {
|
|
122
|
+
if (i === activeTabIndex)
|
|
109
123
|
continue;
|
|
110
|
-
}
|
|
111
124
|
const tabWidthWithGap = tabWidths[i] + TABS_GAP;
|
|
112
125
|
const projectedWidth = tabsWidth + tabWidthWithGap;
|
|
113
126
|
if (projectedWidth <= containerWidth) {
|
|
114
|
-
|
|
127
|
+
visibleTabs.push(i);
|
|
115
128
|
tabsWidth += tabWidthWithGap;
|
|
116
129
|
}
|
|
117
130
|
else {
|
|
118
|
-
|
|
131
|
+
overflowTabs.push(i);
|
|
119
132
|
}
|
|
120
133
|
}
|
|
121
|
-
if (
|
|
134
|
+
if (overflowTabs.length > 0) {
|
|
122
135
|
tabsWidth += MORE_BUTTON_WIDTH;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (removed !== undefined) {
|
|
127
|
-
|
|
136
|
+
while (tabsWidth > containerWidth && visibleTabs.length > 1) {
|
|
137
|
+
const removed = visibleTabs.pop();
|
|
138
|
+
// Never remove the active tab - it should always stay visible or be the last one
|
|
139
|
+
if (removed !== undefined && removed !== activeTabIndex) {
|
|
140
|
+
overflowTabs.unshift(removed);
|
|
128
141
|
tabsWidth -= tabWidths[removed];
|
|
129
142
|
}
|
|
143
|
+
else if (removed === activeTabIndex) {
|
|
144
|
+
// Put it back if we accidentally removed the active tab
|
|
145
|
+
visibleTabs.push(removed);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// If even with only the active tab visible, it doesn't fit with More button,
|
|
150
|
+
// move all tabs to overflow (show only dropdown)
|
|
151
|
+
if (tabsWidth > containerWidth && visibleTabs.length === 1) {
|
|
152
|
+
overflowTabs.unshift(...visibleTabs);
|
|
153
|
+
visibleTabs.length = 0;
|
|
130
154
|
}
|
|
131
155
|
}
|
|
132
156
|
setTabs({
|
|
133
|
-
visible,
|
|
134
|
-
overflow,
|
|
157
|
+
visible: visibleTabs,
|
|
158
|
+
overflow: overflowTabs,
|
|
135
159
|
});
|
|
136
|
-
|
|
160
|
+
// Set ready state on first calculation
|
|
161
|
+
if (isFirstCalculation.current) {
|
|
162
|
+
isFirstCalculation.current = false;
|
|
163
|
+
setIsReady(true);
|
|
164
|
+
}
|
|
165
|
+
}, [containerRef, totalTabs]);
|
|
166
|
+
// Store calculateVisibleTabs in ref for use in setTabRef
|
|
167
|
+
calculateVisibleTabsRef.current = calculateVisibleTabs;
|
|
168
|
+
// Reset isFirstCalculation when totalTabs changes (new page/tabs)
|
|
137
169
|
(0, react_1.useEffect)(() => {
|
|
138
|
-
|
|
170
|
+
isFirstCalculation.current = true;
|
|
171
|
+
setIsReady(false);
|
|
172
|
+
// Clear refs so we wait for new tabs to register
|
|
173
|
+
tabWidthsRef.current = [];
|
|
174
|
+
tabLabelsRef.current = [];
|
|
175
|
+
}, [totalTabs]);
|
|
176
|
+
// Call calculateVisibleTabs on first render and resize
|
|
177
|
+
(0, react_1.useEffect)(() => {
|
|
178
|
+
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
179
|
+
if (!container)
|
|
139
180
|
return;
|
|
140
|
-
let resizeTimeout =
|
|
181
|
+
let resizeTimeout = null;
|
|
182
|
+
// Use ResizeObserver to wait until container has proper size
|
|
183
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
184
|
+
if (resizeTimeout)
|
|
185
|
+
cancelAnimationFrame(resizeTimeout);
|
|
186
|
+
resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
187
|
+
});
|
|
188
|
+
resizeObserver.observe(container);
|
|
141
189
|
const handleResize = () => {
|
|
142
|
-
if (resizeTimeout)
|
|
190
|
+
if (resizeTimeout)
|
|
143
191
|
cancelAnimationFrame(resizeTimeout);
|
|
144
|
-
}
|
|
145
192
|
resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
146
193
|
};
|
|
147
194
|
window.addEventListener('resize', handleResize);
|
|
148
195
|
return () => {
|
|
196
|
+
resizeObserver.disconnect();
|
|
149
197
|
window.removeEventListener('resize', handleResize);
|
|
150
|
-
|
|
198
|
+
if (resizeTimeout)
|
|
199
|
+
cancelAnimationFrame(resizeTimeout);
|
|
151
200
|
};
|
|
152
201
|
}, [containerRef, totalTabs, calculateVisibleTabs]);
|
|
202
|
+
// Recalculate when activeTab changes to ensure it's visible
|
|
203
|
+
(0, react_1.useEffect)(() => {
|
|
204
|
+
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || isFirstCalculation.current)
|
|
205
|
+
return;
|
|
206
|
+
requestAnimationFrame(calculateVisibleTabs);
|
|
207
|
+
}, [activeTab, containerRef, calculateVisibleTabs]);
|
|
153
208
|
return {
|
|
154
209
|
setTabRef,
|
|
155
210
|
onTabClick,
|
|
156
211
|
handleKeyboard,
|
|
157
212
|
visibleTabs: tabs.visible,
|
|
158
213
|
overflowTabs: tabs.overflow,
|
|
159
|
-
|
|
214
|
+
isReady,
|
|
160
215
|
};
|
|
161
216
|
}
|
|
162
217
|
const useActiveTab = ({ initialTab, tabsId }) => {
|
|
163
218
|
const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
|
|
164
|
-
const
|
|
219
|
+
const initialTabValue = (0, react_1.useMemo)(() => getInitialTab({ initialTab, searchParams, tabsId }),
|
|
220
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
|
+
[]);
|
|
222
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(initialTabValue);
|
|
165
223
|
const prevActiveTabRef = (0, react_1.useRef)(activeTab);
|
|
166
224
|
(0, react_1.useEffect)(() => {
|
|
167
225
|
const hasActiveTabChanged = prevActiveTabRef.current !== activeTab;
|
|
@@ -174,10 +232,10 @@ const useActiveTab = ({ initialTab, tabsId }) => {
|
|
|
174
232
|
return searchParams;
|
|
175
233
|
});
|
|
176
234
|
}, [activeTab, setSearchParams, tabsId]);
|
|
177
|
-
return {
|
|
235
|
+
return (0, react_1.useMemo)(() => ({
|
|
178
236
|
activeTab,
|
|
179
237
|
setActiveTab,
|
|
180
|
-
};
|
|
238
|
+
}), [activeTab]);
|
|
181
239
|
};
|
|
182
240
|
exports.useActiveTab = useActiveTab;
|
|
183
241
|
const getInitialTab = ({ initialTab, searchParams, tabsId }) => {
|
|
@@ -36,20 +36,22 @@ export declare const useTelemetryFallback: () => {
|
|
|
36
36
|
sendLanguagePickerLocaleChangedMessage: () => void;
|
|
37
37
|
sendSearchOpenedMessage: () => void;
|
|
38
38
|
sendSearchQueryMessage: () => void;
|
|
39
|
+
sendSearchAiOpenedMessage: () => void;
|
|
39
40
|
sendSearchAIQueryMessage: () => void;
|
|
41
|
+
sendSearchAIFeedbackMessage: () => void;
|
|
40
42
|
sendFeedbackMessage: () => void;
|
|
41
43
|
sendSearchResultClickedMessage: () => void;
|
|
42
44
|
sendRedirectMessage: () => void;
|
|
43
45
|
sendOpenapiDocsMessage: () => void;
|
|
44
46
|
sendCopyCodeSnippetClickedMessage: () => void;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
sendViewedMessage: () => void;
|
|
48
|
+
sendPerformanceMetricsMessage: () => void;
|
|
49
|
+
sendDownloadDefinitionClickedMessage: () => void;
|
|
50
|
+
sendSelectLanguageClickedMessage: () => void;
|
|
51
|
+
sendExpandCollapseAllClickedMessage: () => void;
|
|
52
|
+
sendSwitchServersClickedMessage: () => void;
|
|
53
|
+
sendExamplesSwitcherClickedMessage: () => void;
|
|
54
|
+
sendTryItOpenedMessage: () => void;
|
|
53
55
|
sendAsyncapiDocsViewedMessage: () => void;
|
|
54
56
|
sendAsyncapiDocsPerformanceMetricsMessage: () => void;
|
|
55
57
|
sendAsyncapiDocsSwitchMessageClickedMessage: () => void;
|
|
@@ -40,20 +40,22 @@ const useTelemetryFallback = () => ({
|
|
|
40
40
|
sendLanguagePickerLocaleChangedMessage: () => { },
|
|
41
41
|
sendSearchOpenedMessage: () => { },
|
|
42
42
|
sendSearchQueryMessage: () => { },
|
|
43
|
+
sendSearchAiOpenedMessage: () => { },
|
|
43
44
|
sendSearchAIQueryMessage: () => { },
|
|
45
|
+
sendSearchAIFeedbackMessage: () => { },
|
|
44
46
|
sendFeedbackMessage: () => { },
|
|
45
47
|
sendSearchResultClickedMessage: () => { },
|
|
46
48
|
sendRedirectMessage: () => { },
|
|
47
49
|
sendOpenapiDocsMessage: () => { },
|
|
48
50
|
sendCopyCodeSnippetClickedMessage: () => { },
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
sendViewedMessage: () => { },
|
|
52
|
+
sendPerformanceMetricsMessage: () => { },
|
|
53
|
+
sendDownloadDefinitionClickedMessage: () => { },
|
|
54
|
+
sendSelectLanguageClickedMessage: () => { },
|
|
55
|
+
sendExpandCollapseAllClickedMessage: () => { },
|
|
56
|
+
sendSwitchServersClickedMessage: () => { },
|
|
57
|
+
sendExamplesSwitcherClickedMessage: () => { },
|
|
58
|
+
sendTryItOpenedMessage: () => { },
|
|
57
59
|
sendAsyncapiDocsViewedMessage: () => { },
|
|
58
60
|
sendAsyncapiDocsPerformanceMetricsMessage: () => { },
|
|
59
61
|
sendAsyncapiDocsSwitchMessageClickedMessage: () => { },
|
|
@@ -2,6 +2,7 @@ export type { UserClaims } from '../types/user-claims';
|
|
|
2
2
|
export type { OperationParameter, ParameterHighlight } from '../types/search';
|
|
3
3
|
export type { TFunction, TOptions } from '../types/l10n';
|
|
4
4
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
5
|
+
export type { SegmentedOption, SegmentedProps } from '../types/segmented';
|
|
5
6
|
export { IS_BROWSER } from '../utils/dom';
|
|
6
7
|
export { addLeadingSlash, removeLeadingSlash, getPathPrefix, combineUrls, addTrailingSlash, withPathPrefix, } from '../utils/urls';
|
|
7
8
|
export { capitalize } from '../utils/string';
|
package/lib/core/styles/dark.js
CHANGED
|
@@ -37,6 +37,10 @@ const replayDarkMode = (0, styled_components_1.css) `
|
|
|
37
37
|
--replay-server-variable-bg-color-hover: rgba(31, 10, 144, 0.4); // @presenter Color
|
|
38
38
|
--replay-path-parameter-bg-color-hover: rgba(5, 88, 99, 0.4); // @presenter Color
|
|
39
39
|
|
|
40
|
+
--replay-runtime-expression-color: rgba(147, 166, 249, 1); // @presenter Color
|
|
41
|
+
--replay-runtime-expression-bg-color: rgba(147, 166, 249, 0.16); // @presenter Color
|
|
42
|
+
--replay-operators-color: rgba(168, 143, 88, 1); // @presenter Color
|
|
43
|
+
|
|
40
44
|
// @tokens End
|
|
41
45
|
`;
|
|
42
46
|
exports.darkMode = (0, styled_components_1.css) `
|
|
@@ -1203,6 +1203,10 @@ const replay = (0, styled_components_1.css) `
|
|
|
1203
1203
|
--replay-server-variable-bg-color-hover: rgba(119, 45, 240, 0.16); // @presenter Color
|
|
1204
1204
|
--replay-path-parameter-bg-color-hover: rgba(4, 117, 161, 0.16); // @presenter Color
|
|
1205
1205
|
|
|
1206
|
+
--replay-runtime-expression-color: rgba(54, 90, 249, 1); // @presenter Color
|
|
1207
|
+
--replay-runtime-expression-bg-color: rgba(54, 90, 249, 0.08); // @presenter Color
|
|
1208
|
+
--replay-operators-color: rgba(193, 142, 31, 1); // @presenter Color
|
|
1209
|
+
|
|
1206
1210
|
// @tokens End
|
|
1207
1211
|
`;
|
|
1208
1212
|
exports.styles = (0, styled_components_1.css) `
|
|
@@ -1216,6 +1220,7 @@ exports.styles = (0, styled_components_1.css) `
|
|
|
1216
1220
|
${variables_5.breadcrumbs}
|
|
1217
1221
|
${variables_19.button}
|
|
1218
1222
|
${variables_20.aiAssistantButton}
|
|
1223
|
+
${variables_20.connectMCPButton}
|
|
1219
1224
|
${variables_38.cards}
|
|
1220
1225
|
${variables_8.catalog}
|
|
1221
1226
|
${variables_10.catalogClassic}
|
|
@@ -60,7 +60,7 @@ export type ThemeHooks = {
|
|
|
60
60
|
breadcrumbs: BreadcrumbItem[];
|
|
61
61
|
currentItemSiblings?: BreadcrumbItem[];
|
|
62
62
|
};
|
|
63
|
-
useSearch: (product?: string, autoSearchDisabled?: boolean) => {
|
|
63
|
+
useSearch: (product?: string, autoSearchDisabled?: boolean, searchSessionId?: string) => {
|
|
64
64
|
query: string;
|
|
65
65
|
setQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
66
66
|
filter: SearchFilterItem[];
|
|
@@ -78,7 +78,7 @@ export type ThemeHooks = {
|
|
|
78
78
|
};
|
|
79
79
|
useAiSearch: (options?: {
|
|
80
80
|
filter?: SearchFilterItem[];
|
|
81
|
-
}) => {
|
|
81
|
+
}, searchSessionId?: string) => {
|
|
82
82
|
askQuestion: (question: string, history?: AiSearchConversationItem[]) => void;
|
|
83
83
|
isGeneratingResponse: boolean;
|
|
84
84
|
question: string;
|
package/lib/core/types/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./breadcrumb"), exports);
|
|
18
18
|
__exportStar(require("./catalog"), exports);
|
|
19
19
|
__exportStar(require("./l10n"), exports);
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
20
21
|
__exportStar(require("./feedback"), exports);
|
|
21
22
|
__exportStar(require("./hooks"), exports);
|
|
22
23
|
__exportStar(require("./markdown"), exports);
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -82,11 +82,18 @@ export type AiSearchErrorConfig = {
|
|
|
82
82
|
messageKey: string;
|
|
83
83
|
messageDefault: string;
|
|
84
84
|
};
|
|
85
|
+
export declare enum FeedbackType {
|
|
86
|
+
Like = "like",
|
|
87
|
+
Dislike = "dislike"
|
|
88
|
+
}
|
|
89
|
+
export type SearchAiMessageResource = {
|
|
90
|
+
url: string;
|
|
91
|
+
title: string;
|
|
92
|
+
};
|
|
85
93
|
export type AiSearchConversationItem = {
|
|
86
94
|
role: AiSearchConversationRole;
|
|
87
95
|
content: string;
|
|
88
|
-
resources?:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}[];
|
|
96
|
+
resources?: SearchAiMessageResource[];
|
|
97
|
+
messageId?: string;
|
|
98
|
+
feedback?: FeedbackType;
|
|
92
99
|
};
|
package/lib/core/types/search.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeedbackType = void 0;
|
|
4
|
+
var FeedbackType;
|
|
5
|
+
(function (FeedbackType) {
|
|
6
|
+
FeedbackType["Like"] = "like";
|
|
7
|
+
FeedbackType["Dislike"] = "dislike";
|
|
8
|
+
})(FeedbackType || (exports.FeedbackType = FeedbackType = {}));
|
|
3
9
|
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SelectOption } from './select';
|
|
3
|
+
export type SegmentedOption<T> = SelectOption<T> & {
|
|
4
|
+
divider?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export type SegmentedProps<T = any> = {
|
|
7
|
+
options: SegmentedOption<T>[];
|
|
8
|
+
value: T;
|
|
9
|
+
onChange: ({ label, value }: SegmentedOption<T>) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: 'regular' | 'small';
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility function for use in React frontmatter
|
|
3
|
+
* This function creates a string that will be processed by the frontmatter loader
|
|
4
|
+
* to convert it into a translation key object
|
|
5
|
+
*/
|
|
6
|
+
export declare const frontmatterTranslate: (key: string, defaultValue: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.frontmatterTranslate = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility function for use in React frontmatter
|
|
6
|
+
* This function creates a string that will be processed by the frontmatter loader
|
|
7
|
+
* to convert it into a translation key object
|
|
8
|
+
*/
|
|
9
|
+
const frontmatterTranslate = (key, defaultValue) => {
|
|
10
|
+
const escapedDefaultValue = defaultValue.replace(/'/g, "\\'");
|
|
11
|
+
return `frontmatterTranslate('${key}', '${escapedDefaultValue}')`;
|
|
12
|
+
};
|
|
13
|
+
exports.frontmatterTranslate = frontmatterTranslate;
|
|
14
|
+
//# sourceMappingURL=frontmatter-translate.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './clipboard-service';
|
|
2
2
|
export * from './css-variables';
|
|
3
3
|
export * from './add-line-numbers';
|
|
4
|
+
export * from './mcp';
|
|
4
5
|
export * from './media-css';
|
|
5
6
|
export * from './theme-helpers';
|
|
6
7
|
export * from './class-names';
|
|
@@ -38,3 +39,4 @@ export * from './enhanced-smoothstep';
|
|
|
38
39
|
export * from './icon-resolver';
|
|
39
40
|
export * from './dynamic';
|
|
40
41
|
export * from './tabs';
|
|
42
|
+
export * from './frontmatter-translate';
|
package/lib/core/utils/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./clipboard-service"), exports);
|
|
18
18
|
__exportStar(require("./css-variables"), exports);
|
|
19
19
|
__exportStar(require("./add-line-numbers"), exports);
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
20
21
|
__exportStar(require("./media-css"), exports);
|
|
21
22
|
__exportStar(require("./theme-helpers"), exports);
|
|
22
23
|
__exportStar(require("./class-names"), exports);
|
|
@@ -54,4 +55,5 @@ __exportStar(require("./enhanced-smoothstep"), exports);
|
|
|
54
55
|
__exportStar(require("./icon-resolver"), exports);
|
|
55
56
|
__exportStar(require("./dynamic"), exports);
|
|
56
57
|
__exportStar(require("./tabs"), exports);
|
|
58
|
+
__exportStar(require("./frontmatter-translate"), exports);
|
|
57
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateMCPDeepLink = generateMCPDeepLink;
|
|
4
|
+
function generateCursorMCPDeepLink(config) {
|
|
5
|
+
const cursorConfig = {
|
|
6
|
+
url: config.url,
|
|
7
|
+
description: 'MCP Server',
|
|
8
|
+
};
|
|
9
|
+
const encodedConfig = btoa(JSON.stringify(cursorConfig));
|
|
10
|
+
return `cursor://anysphere.cursor-deeplink/mcp/install?name=${config.serverName}&config=${encodedConfig}`;
|
|
11
|
+
}
|
|
12
|
+
function generateVSCodeMCPDeepLink(config) {
|
|
13
|
+
const vscodeConfig = {
|
|
14
|
+
name: config.serverName,
|
|
15
|
+
url: config.url,
|
|
16
|
+
type: 'http',
|
|
17
|
+
};
|
|
18
|
+
const encodedConfig = encodeURIComponent(JSON.stringify(vscodeConfig));
|
|
19
|
+
return `vscode:mcp/install?${encodedConfig}`;
|
|
20
|
+
}
|
|
21
|
+
function generateMCPDeepLink(clientType, config) {
|
|
22
|
+
switch (clientType) {
|
|
23
|
+
case 'cursor':
|
|
24
|
+
return generateCursorMCPDeepLink(config);
|
|
25
|
+
case 'vscode':
|
|
26
|
+
return generateVSCodeMCPDeepLink(config);
|
|
27
|
+
default:
|
|
28
|
+
return generateCursorMCPDeepLink(config);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=mcp.js.map
|