@redocly/theme 0.61.0 → 0.62.0-custom.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/lib/components/Admonition/Admonition.js +14 -18
- package/lib/components/Admonition/variables.dark.d.ts +1 -0
- package/lib/components/Admonition/variables.dark.js +18 -0
- package/lib/components/Admonition/variables.js +24 -28
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.d.ts +1 -0
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +12 -0
- package/lib/components/Badge/Badge.d.ts +2 -1
- package/lib/components/Badge/Badge.js +24 -2
- package/lib/components/Banner/Banner.js +19 -1
- package/lib/components/Banner/variables.js +1 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +9 -6
- package/lib/components/Breadcrumbs/Breadcrumbs.js +24 -15
- package/lib/components/Buttons/AIAssistantButton.js +7 -4
- package/lib/components/Catalog/CatalogEntities.js +10 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +5 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +13 -11
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +7 -5
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +9 -7
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +2 -2
- package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +8 -6
- package/lib/components/Filter/FilterCheckboxes.js +1 -1
- package/lib/components/JsonViewer/JsonViewer.js +2 -2
- package/lib/components/JsonViewer/{Helpers.js → helpers.js} +2 -1
- package/lib/components/LanguagePicker/LanguagePicker.js +1 -1
- package/lib/components/Markdown/Markdown.js +2 -2
- package/lib/components/Menu/MenuItem.js +41 -15
- package/lib/components/Navbar/NavbarItem.js +1 -1
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.d.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +12 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +6 -0
- package/lib/components/PageActions/PageActions.js +25 -8
- package/lib/components/Search/SearchAiDialog.d.ts +4 -2
- package/lib/components/Search/SearchAiDialog.js +23 -4
- package/lib/components/Search/SearchAiMessage.d.ts +4 -2
- package/lib/components/Search/SearchAiMessage.js +82 -23
- package/lib/components/Search/SearchDialog.js +50 -25
- package/lib/components/Select/variables.js +2 -2
- package/lib/components/SvgViewer/SvgViewer.d.ts +15 -0
- package/lib/components/SvgViewer/SvgViewer.js +312 -0
- package/lib/components/SvgViewer/variables.d.ts +1 -0
- package/lib/components/SvgViewer/variables.dark.d.ts +1 -0
- package/lib/components/SvgViewer/variables.dark.js +8 -0
- package/lib/components/SvgViewer/variables.js +17 -0
- package/lib/components/Tag/Tag.js +1 -1
- package/lib/components/Tag/variables.dark.js +6 -0
- package/lib/components/Tag/variables.js +6 -0
- package/lib/components/Tooltip/Tooltip.d.ts +2 -3
- package/lib/components/Tooltip/Tooltip.js +66 -113
- package/lib/components/Tooltip/variables.dark.js +4 -0
- package/lib/components/Tooltip/variables.js +3 -3
- package/lib/components/UserMenu/LoginButton.d.ts +8 -2
- package/lib/components/UserMenu/LoginButton.js +4 -3
- package/lib/core/constants/search.d.ts +5 -1
- package/lib/core/constants/search.js +24 -1
- package/lib/core/hooks/search/use-search-dialog.js +2 -2
- package/lib/core/hooks/use-color-switcher.d.ts +1 -0
- package/lib/core/hooks/use-color-switcher.js +8 -1
- package/lib/core/hooks/use-mcp-config.js +2 -1
- package/lib/core/hooks/use-modal-scroll-lock.js +24 -10
- package/lib/core/hooks/use-outside-click.d.ts +3 -1
- package/lib/core/hooks/use-outside-click.js +8 -4
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +44 -11
- package/lib/core/hooks/use-product-picker.js +1 -1
- package/lib/core/hooks/use-unique-svg-ids.d.ts +6 -0
- package/lib/core/hooks/use-unique-svg-ids.js +15 -0
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/openapi/index.js +3 -1
- package/lib/core/styles/dark.js +4 -0
- package/lib/core/styles/global.js +31 -15
- package/lib/core/types/catalog.d.ts +1 -1
- package/lib/core/types/hooks.d.ts +23 -2
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +24 -0
- package/lib/core/types/search.js +9 -1
- package/lib/core/utils/content-segments.d.ts +2 -0
- package/lib/core/utils/content-segments.js +22 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/transform-revisions-to-version-history.js +8 -51
- package/lib/ext/process-scorecard.d.ts +5 -0
- package/lib/ext/process-scorecard.js +11 -0
- package/lib/icons/FitToViewIcon/FitToViewIcon.d.ts +9 -0
- package/lib/icons/FitToViewIcon/FitToViewIcon.js +25 -0
- package/lib/icons/WarningCycleIcon/WarningCycleIcon.d.ts +9 -0
- package/lib/icons/WarningCycleIcon/WarningCycleIcon.js +24 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/layouts/DocumentationLayout.js +4 -25
- package/lib/layouts/DocumentationLayoutBottom.d.ts +11 -0
- package/lib/layouts/DocumentationLayoutBottom.js +28 -0
- package/lib/layouts/DocumentationLayoutTop.d.ts +13 -0
- package/lib/layouts/DocumentationLayoutTop.js +33 -0
- package/lib/layouts/Forbidden.js +22 -18
- package/lib/markdoc/components/Cards/Card.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
- package/lib/markdoc/components/Heading/Heading.js +40 -2
- package/lib/markdoc/components/LoginButton/LoginButton.d.ts +9 -0
- package/lib/markdoc/components/LoginButton/LoginButton.js +48 -0
- package/lib/markdoc/components/Mermaid/Mermaid.js +70 -2
- 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/login-button.d.ts +2 -0
- package/lib/markdoc/tags/login-button.js +32 -0
- package/package.json +9 -9
- package/src/components/Admonition/Admonition.tsx +14 -18
- package/src/components/Admonition/variables.dark.ts +15 -0
- package/src/components/Admonition/variables.ts +24 -28
- package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +10 -0
- package/src/components/Badge/Badge.tsx +18 -2
- package/src/components/Banner/Banner.tsx +23 -1
- package/src/components/Banner/variables.ts +1 -0
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -3
- package/src/components/Breadcrumbs/BreadcrumbDropdown.tsx +11 -8
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +24 -15
- package/src/components/Buttons/AIAssistantButton.tsx +7 -4
- package/src/components/Catalog/CatalogEntities.tsx +10 -8
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +7 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +13 -11
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +7 -5
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +9 -7
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -2
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +9 -5
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +3 -1
- package/src/components/CodeBlock/CodeBlockControls.tsx +16 -10
- package/src/components/Filter/FilterCheckboxes.tsx +1 -1
- package/src/components/JsonViewer/JsonViewer.tsx +1 -2
- package/src/components/JsonViewer/{Helpers.tsx → helpers.tsx} +1 -0
- package/src/components/LanguagePicker/LanguagePicker.tsx +1 -1
- package/src/components/Markdown/Markdown.tsx +2 -2
- package/src/components/Menu/MenuItem.tsx +61 -16
- package/src/components/Navbar/NavbarItem.tsx +3 -1
- package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +10 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +2 -0
- package/src/components/PageActions/PageActions.tsx +38 -15
- package/src/components/Search/SearchAiDialog.tsx +31 -2
- package/src/components/Search/SearchAiMessage.tsx +103 -17
- package/src/components/Search/SearchDialog.tsx +70 -37
- package/src/components/Select/variables.ts +2 -2
- package/src/components/SvgViewer/SvgViewer.tsx +405 -0
- package/src/components/SvgViewer/variables.dark.ts +5 -0
- package/src/components/SvgViewer/variables.ts +14 -0
- package/src/components/Tag/Tag.tsx +2 -1
- package/src/components/Tag/variables.dark.ts +6 -0
- package/src/components/Tag/variables.ts +6 -0
- package/src/components/Tooltip/Tooltip.tsx +77 -120
- package/src/components/Tooltip/variables.dark.ts +4 -0
- package/src/components/Tooltip/variables.ts +3 -3
- package/src/components/UserMenu/LoginButton.tsx +23 -8
- package/src/core/constants/search.ts +27 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +10 -1
- package/src/core/hooks/search/use-search-dialog.ts +2 -2
- package/src/core/hooks/use-color-switcher.ts +10 -2
- package/src/core/hooks/use-mcp-config.ts +2 -1
- package/src/core/hooks/use-modal-scroll-lock.ts +29 -10
- package/src/core/hooks/use-outside-click.ts +16 -5
- package/src/core/hooks/use-page-actions.ts +66 -25
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-unique-svg-ids.ts +12 -0
- package/src/core/openapi/index.ts +1 -0
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +31 -15
- package/src/core/types/catalog.ts +1 -1
- package/src/core/types/hooks.ts +29 -1
- package/src/core/types/l10n.ts +12 -1
- package/src/core/types/search.ts +19 -0
- package/src/core/utils/content-segments.ts +27 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/transform-revisions-to-version-history.ts +8 -80
- package/src/ext/process-scorecard.ts +14 -0
- package/src/icons/FitToViewIcon/FitToViewIcon.tsx +26 -0
- package/src/icons/WarningCycleIcon/WarningCycleIcon.tsx +32 -0
- package/src/index.ts +9 -0
- package/src/layouts/DocumentationLayout.tsx +4 -30
- package/src/layouts/DocumentationLayoutBottom.tsx +42 -0
- package/src/layouts/DocumentationLayoutTop.tsx +52 -0
- package/src/layouts/Forbidden.tsx +36 -21
- package/src/markdoc/components/Cards/Card.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +1 -1
- package/src/markdoc/components/Heading/Heading.tsx +52 -4
- package/src/markdoc/components/LoginButton/LoginButton.tsx +38 -0
- package/src/markdoc/components/Mermaid/Mermaid.tsx +57 -8
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/login-button.ts +30 -0
- package/lib/components/Tooltip/TooltipWrapper.d.ts +0 -12
- package/lib/components/Tooltip/TooltipWrapper.js +0 -34
- package/src/components/Tooltip/TooltipWrapper.tsx +0 -70
- /package/lib/components/JsonViewer/{Helpers.d.ts → helpers.d.ts} +0 -0
|
@@ -37,6 +37,7 @@ const DEFAULT_ENABLED_ACTIONS = [
|
|
|
37
37
|
'claude',
|
|
38
38
|
'docs-mcp-cursor',
|
|
39
39
|
'docs-mcp-vscode',
|
|
40
|
+
'docs-mcp-json',
|
|
40
41
|
];
|
|
41
42
|
function usePageActions(pageSlug, mcpUrl, actions) {
|
|
42
43
|
var _a, _b, _c;
|
|
@@ -65,13 +66,15 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
65
66
|
mcpConfig: config,
|
|
66
67
|
translate,
|
|
67
68
|
onClickCallback: isDocsMcp
|
|
68
|
-
? () => telemetry.sendPageActionsButtonClickedMessage(
|
|
69
|
+
? () => telemetry.sendPageActionsButtonClickedMessage([
|
|
70
|
+
Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: `docs-mcp-${clientType}` }),
|
|
71
|
+
])
|
|
69
72
|
: undefined,
|
|
70
73
|
});
|
|
71
74
|
}, [mcpUrl, mcpConfig, translate, telemetry, pageSlug]);
|
|
72
75
|
const result = (0, react_1.useMemo)(() => {
|
|
73
76
|
var _a, _b, _c;
|
|
74
|
-
if (shouldHideAllActions) {
|
|
77
|
+
if (shouldHideAllActions && !(actions === null || actions === void 0 ? void 0 : actions.length)) {
|
|
75
78
|
return [];
|
|
76
79
|
}
|
|
77
80
|
const origin = dom_1.IS_BROWSER
|
|
@@ -98,7 +101,9 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
98
101
|
}
|
|
99
102
|
const text = yield result.text();
|
|
100
103
|
clipboard_service_1.ClipboardService.copyCustom(text);
|
|
101
|
-
telemetry.sendPageActionsButtonClickedMessage(
|
|
104
|
+
telemetry.sendPageActionsButtonClickedMessage([
|
|
105
|
+
Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'copy' }),
|
|
106
|
+
]);
|
|
102
107
|
}
|
|
103
108
|
catch (error) {
|
|
104
109
|
console.error(error);
|
|
@@ -112,21 +117,28 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
112
117
|
iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
|
|
113
118
|
link: mdPageUrl,
|
|
114
119
|
onClick: () => {
|
|
115
|
-
telemetry.sendPageActionsButtonClickedMessage(
|
|
120
|
+
telemetry.sendPageActionsButtonClickedMessage([
|
|
121
|
+
Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'view' }),
|
|
122
|
+
]);
|
|
123
|
+
window.location.href = mdPageUrl;
|
|
116
124
|
},
|
|
117
125
|
}),
|
|
118
126
|
chatgpt: () => {
|
|
119
127
|
if (!isPublic) {
|
|
120
128
|
return null;
|
|
121
129
|
}
|
|
130
|
+
const link = getExternalAiPromptLink('https://chat.openai.com', mdPageUrl);
|
|
122
131
|
return {
|
|
123
132
|
buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
|
|
124
133
|
title: translate('page.actions.chatGptTitle', 'Open in ChatGPT'),
|
|
125
134
|
description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
|
|
126
135
|
iconComponent: ChatGptIcon_1.ChatGptIcon,
|
|
127
|
-
link
|
|
136
|
+
link,
|
|
128
137
|
onClick: () => {
|
|
129
|
-
telemetry.sendPageActionsButtonClickedMessage(
|
|
138
|
+
telemetry.sendPageActionsButtonClickedMessage([
|
|
139
|
+
Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'chatgpt' }),
|
|
140
|
+
]);
|
|
141
|
+
window.location.href = link;
|
|
130
142
|
},
|
|
131
143
|
};
|
|
132
144
|
},
|
|
@@ -134,17 +146,37 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
134
146
|
if (!isPublic) {
|
|
135
147
|
return null;
|
|
136
148
|
}
|
|
149
|
+
const link = getExternalAiPromptLink('https://claude.ai/new', mdPageUrl);
|
|
137
150
|
return {
|
|
138
151
|
buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
|
|
139
152
|
title: translate('page.actions.claudeTitle', 'Open in Claude'),
|
|
140
153
|
description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
|
|
141
154
|
iconComponent: ClaudeIcon_1.ClaudeIcon,
|
|
142
|
-
link
|
|
155
|
+
link,
|
|
143
156
|
onClick: () => {
|
|
144
|
-
telemetry.sendPageActionsButtonClickedMessage(
|
|
157
|
+
telemetry.sendPageActionsButtonClickedMessage([
|
|
158
|
+
Object.assign(Object.assign({}, createPageActionResource(pageSlug, pageUrl)), { action_type: 'claude' }),
|
|
159
|
+
]);
|
|
160
|
+
window.location.href = link;
|
|
145
161
|
},
|
|
146
162
|
};
|
|
147
163
|
},
|
|
164
|
+
'docs-mcp-json': () => {
|
|
165
|
+
return {
|
|
166
|
+
buttonText: 'Copy MCP configuration',
|
|
167
|
+
title: 'Copy MCP JSON configuration',
|
|
168
|
+
description: 'Copy MCP JSON configuration',
|
|
169
|
+
iconComponent: CopyIcon_1.CopyIcon,
|
|
170
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
clipboard_service_1.ClipboardService.copyCustom(JSON.stringify({
|
|
172
|
+
'mcp-server': {
|
|
173
|
+
url: mcpUrl,
|
|
174
|
+
description: 'MCP Server',
|
|
175
|
+
},
|
|
176
|
+
}, null, 2));
|
|
177
|
+
}),
|
|
178
|
+
};
|
|
179
|
+
},
|
|
148
180
|
};
|
|
149
181
|
return (((_c = (_b = themeConfig.navigation) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.items) || actions || DEFAULT_ENABLED_ACTIONS)
|
|
150
182
|
.map((action) => { var _a; return (_a = actionHandlers[action]) === null || _a === void 0 ? void 0 : _a.call(actionHandlers); })
|
|
@@ -157,6 +189,7 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
157
189
|
translate,
|
|
158
190
|
isPublic,
|
|
159
191
|
createMCPHandler,
|
|
192
|
+
mcpUrl,
|
|
160
193
|
telemetry,
|
|
161
194
|
]);
|
|
162
195
|
return result;
|
|
@@ -181,7 +214,7 @@ function createMCPAction({ clientType, mcpConfig, translate, onClickCallback, })
|
|
|
181
214
|
return Object.assign(Object.assign({}, sharedProps), { buttonText: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), title: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), description: translate('page.actions.connectMcp.vscodeDescription', 'Install MCP server on VS Code'), iconComponent: VSCodeIcon_1.VSCodeIcon });
|
|
182
215
|
}
|
|
183
216
|
function shouldHidePageActions(pageProps, themeConfig, openapiExcludeFromSearch) {
|
|
184
|
-
var _a, _b, _c, _d, _e, _f;
|
|
217
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
185
218
|
// Can't use any actions if no markdown files are generated for LLMs
|
|
186
219
|
if ((_b = (_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.seo) === null || _a === void 0 ? void 0 : _a.llmstxt) === null || _b === void 0 ? void 0 : _b.hide) {
|
|
187
220
|
return true;
|
|
@@ -191,8 +224,8 @@ function shouldHidePageActions(pageProps, themeConfig, openapiExcludeFromSearch)
|
|
|
191
224
|
return true;
|
|
192
225
|
}
|
|
193
226
|
// Page is excluded from search
|
|
194
|
-
const
|
|
195
|
-
|
|
227
|
+
const isOpenApiPage = ((_e = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _e === void 0 ? void 0 : _e.type) === 'openapi' || ((_f = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _f === void 0 ? void 0 : _f.subType) === 'openapi-operation';
|
|
228
|
+
const isPageExcludedFromSearch = ((_g = pageProps === null || pageProps === void 0 ? void 0 : pageProps.frontmatter) === null || _g === void 0 ? void 0 : _g.excludeFromSearch) || (isOpenApiPage && openapiExcludeFromSearch);
|
|
196
229
|
if (isPageExcludedFromSearch) {
|
|
197
230
|
return true;
|
|
198
231
|
}
|
|
@@ -15,7 +15,7 @@ function useProductPicker() {
|
|
|
15
15
|
function setProduct(product) {
|
|
16
16
|
if (!product)
|
|
17
17
|
return;
|
|
18
|
-
telemetry.sendProductPickedMessage({ product: product.slug });
|
|
18
|
+
telemetry.sendProductPickedMessage([{ object: 'product', product: product.slug }]);
|
|
19
19
|
if (typeof document === 'undefined')
|
|
20
20
|
return;
|
|
21
21
|
if (product.name) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that appends a per-component-instance suffix to SVG ids.
|
|
3
|
+
* This prevents collisions when multiple identical SVGs are rendered on the same page,
|
|
4
|
+
* which can break `url(#...)` references (gradients, clipPath, masks, filters) on reflow.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useUniqueSvgIds(): (id: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUniqueSvgIds = useUniqueSvgIds;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* Returns a function that appends a per-component-instance suffix to SVG ids.
|
|
7
|
+
* This prevents collisions when multiple identical SVGs are rendered on the same page,
|
|
8
|
+
* which can break `url(#...)` references (gradients, clipPath, masks, filters) on reflow.
|
|
9
|
+
*/
|
|
10
|
+
function useUniqueSvgIds() {
|
|
11
|
+
const reactId = (0, react_1.useId)();
|
|
12
|
+
const safeSuffix = reactId.replace(/:/g, '_');
|
|
13
|
+
return (id) => `${id}-${safeSuffix}`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=use-unique-svg-ids.js.map
|
|
@@ -25,3 +25,4 @@ export { SecurityVariablesEnvSuffix } from '../constants/environments';
|
|
|
25
25
|
export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
|
|
26
26
|
export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
|
|
27
27
|
export { SearchSessionProvider, SearchSessionContext } from '../contexts/SearchContext';
|
|
28
|
+
export { useUniqueSvgIds } from '../hooks/use-unique-svg-ids';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SearchSessionContext = exports.SearchSessionProvider = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.getOperationColor = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.capitalize = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
3
|
+
exports.useUniqueSvgIds = exports.SearchSessionContext = exports.SearchSessionProvider = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.ClipboardService = exports.getOperationColor = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.capitalize = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
4
4
|
var dom_1 = require("../utils/dom");
|
|
5
5
|
Object.defineProperty(exports, "IS_BROWSER", { enumerable: true, get: function () { return dom_1.IS_BROWSER; } });
|
|
6
6
|
var urls_1 = require("../utils/urls");
|
|
@@ -54,4 +54,6 @@ Object.defineProperty(exports, "ThemeDataContext", { enumerable: true, get: func
|
|
|
54
54
|
var SearchContext_1 = require("../contexts/SearchContext");
|
|
55
55
|
Object.defineProperty(exports, "SearchSessionProvider", { enumerable: true, get: function () { return SearchContext_1.SearchSessionProvider; } });
|
|
56
56
|
Object.defineProperty(exports, "SearchSessionContext", { enumerable: true, get: function () { return SearchContext_1.SearchSessionContext; } });
|
|
57
|
+
var use_unique_svg_ids_1 = require("../hooks/use-unique-svg-ids");
|
|
58
|
+
Object.defineProperty(exports, "useUniqueSvgIds", { enumerable: true, get: function () { return use_unique_svg_ids_1.useUniqueSvgIds; } });
|
|
57
59
|
//# sourceMappingURL=index.js.map
|
package/lib/core/styles/dark.js
CHANGED
|
@@ -17,6 +17,8 @@ const variables_dark_12 = require("../../components/Catalog/variables.dark");
|
|
|
17
17
|
const variables_dark_13 = require("../../components/PageActions/variables.dark");
|
|
18
18
|
const variables_dark_14 = require("../../components/Tooltip/variables.dark");
|
|
19
19
|
const variables_dark_15 = require("../../components/Banner/variables.dark");
|
|
20
|
+
const variables_dark_16 = require("../../components/Admonition/variables.dark");
|
|
21
|
+
const variables_dark_17 = require("../../components/SvgViewer/variables.dark");
|
|
20
22
|
const replayDarkMode = (0, styled_components_1.css) `
|
|
21
23
|
/**
|
|
22
24
|
* @tokens Replay Colors
|
|
@@ -329,6 +331,8 @@ exports.darkMode = (0, styled_components_1.css) `
|
|
|
329
331
|
${variables_dark_13.pageActionsDarkMode}
|
|
330
332
|
${variables_dark_14.tooltipDarkMode}
|
|
331
333
|
${variables_dark_15.bannerDarkMode}
|
|
334
|
+
${variables_dark_16.admonitionDarkMode}
|
|
335
|
+
${variables_dark_17.svgViewerDarkMode}
|
|
332
336
|
|
|
333
337
|
/**
|
|
334
338
|
* @tokens Dark Theme Scrollbar Config
|
|
@@ -44,6 +44,7 @@ const variables_39 = require("../../markdoc/components/Cards/variables");
|
|
|
44
44
|
const variables_40 = require("../../markdoc/components/CodeWalkthrough/variables");
|
|
45
45
|
const variables_41 = require("../../components/SkipContent/variables");
|
|
46
46
|
const variables_42 = require("../../components/PageActions/variables");
|
|
47
|
+
const variables_43 = require("../../components/SvgViewer/variables");
|
|
47
48
|
const dark_1 = require("./dark");
|
|
48
49
|
const themeColors = (0, styled_components_1.css) `
|
|
49
50
|
/* === Palette === */
|
|
@@ -958,23 +959,41 @@ const pages = (0, styled_components_1.css) `
|
|
|
958
959
|
*/
|
|
959
960
|
|
|
960
961
|
--page-403-font-family: var(--font-family-base); // @presenter FontFamily
|
|
962
|
+
--page-403-margin-vertical: var(--spacing-xl); // @presenter Spacing
|
|
963
|
+
--page-403-margin-horizontal: calc(var(--spacing-xxl) * 2); // @presenter Spacing
|
|
964
|
+
--page-403-gap: var(--spacing-lg); // @presenter Spacing
|
|
965
|
+
--page-403-max-width: 680px; // @presenter Width
|
|
966
|
+
|
|
967
|
+
--page-403-status-text-color: var(--text-color-helper); // @presenter Color
|
|
968
|
+
--page-403-status-font-size: var(--font-size-lg); // @presenter FontSize
|
|
969
|
+
--page-403-status-font-weight: var(--font-weight-semibold); // @presenter FontWeight
|
|
970
|
+
--page-403-status-line-height: var(--line-height-lg); // @presenter LineHeight
|
|
971
|
+
|
|
972
|
+
--page-403-title-text-color: var(--text-color-primary); // @presenter Color
|
|
973
|
+
--page-403-title-font-size: 42px; // @presenter FontSize
|
|
974
|
+
--page-403-title-font-weight: var(--font-weight-bold); // @presenter FontWeight
|
|
975
|
+
--page-403-title-line-height: 50px; // @presenter LineHeight
|
|
976
|
+
|
|
977
|
+
--page-403-description-text-color: var(--text-color-secondary); // @presenter Color
|
|
978
|
+
--page-403-description-font-size: var(--font-size-xl); // @presenter FontSize
|
|
979
|
+
--page-403-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
980
|
+
--page-403-description-line-height: var(--line-height-xl); // @presenter LineHeight
|
|
981
|
+
|
|
982
|
+
// @tokens End
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* @tokens 403 Page OIDC Forbidden
|
|
986
|
+
* @presenter Color
|
|
987
|
+
*/
|
|
961
988
|
|
|
962
|
-
--page-403-header-text-color: var(--h1-text-color);
|
|
989
|
+
--page-403-header-text-color: var(--h1-text-color); // @presenter Color
|
|
963
990
|
--page-403-header-font-size: var(--h1-font-size); // @presenter FontSize
|
|
964
991
|
--page-403-header-font-weight: var(--h1-font-weight); // @presenter FontWeight
|
|
965
992
|
--page-403-header-line-height: var(--h1-line-height); // @presenter LineHeight
|
|
966
993
|
--page-403-header-margin: 0; // @presenter Spacing
|
|
967
|
-
|
|
968
|
-
--page-403-description-text-color: var(--text-color-secondary);
|
|
969
|
-
--page-403-description-font-size: 1.5em; // @presenter FontSize
|
|
970
|
-
--page-403-description-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
971
|
-
--page-403-description-line-height: 1; // @presenter LineHeight
|
|
972
994
|
--page-403-description-margin: 0; // @presenter Spacing
|
|
973
|
-
|
|
974
|
-
--page-403-
|
|
975
|
-
|
|
976
|
-
--page-403-oidc-description-font-size: var(--font-size-lg);
|
|
977
|
-
--page-403-oidc-description-margin: var(--spacing-md) var(--spacing-sm);
|
|
995
|
+
--page-403-oidc-description-font-size: var(--font-size-lg); // @presenter FontSize
|
|
996
|
+
--page-403-oidc-description-margin: var(--spacing-md) var(--spacing-sm); // @presenter Spacing
|
|
978
997
|
|
|
979
998
|
// @tokens End
|
|
980
999
|
|
|
@@ -1071,10 +1090,6 @@ const error = (0, styled_components_1.css) `
|
|
|
1071
1090
|
--compilation-error-file-header-margin: 0 0 var(--spacing-xs) 0;
|
|
1072
1091
|
`;
|
|
1073
1092
|
const modal = (0, styled_components_1.css) `
|
|
1074
|
-
body:has(.scroll-lock) {
|
|
1075
|
-
overflow: hidden;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
1093
|
--modal-box-shadow: var(--bg-raised-shadow);
|
|
1079
1094
|
--modal-bg-color: var(--bg-color);
|
|
1080
1095
|
`;
|
|
@@ -1278,6 +1293,7 @@ exports.styles = (0, styled_components_1.css) `
|
|
|
1278
1293
|
${replay}
|
|
1279
1294
|
${variables_41.skipContent}
|
|
1280
1295
|
${variables_42.pageActions}
|
|
1296
|
+
${variables_43.svgViewer}
|
|
1281
1297
|
|
|
1282
1298
|
background-color: var(--bg-color);
|
|
1283
1299
|
color: var(--text-color-primary);
|
|
@@ -127,7 +127,7 @@ export type BffCatalogRelatedEntity = {
|
|
|
127
127
|
key: string;
|
|
128
128
|
title: string;
|
|
129
129
|
summary?: string | null;
|
|
130
|
-
readonly source: '
|
|
130
|
+
readonly source: 'remote' | 'file';
|
|
131
131
|
relationRole: 'source' | 'target';
|
|
132
132
|
relationType: EntityRelationType;
|
|
133
133
|
sourceFile?: string | null;
|
|
@@ -8,7 +8,7 @@ import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
|
8
8
|
import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
|
|
9
9
|
import type { UserMenuData } from './user-menu';
|
|
10
10
|
import type { ItemState } from './sidebar';
|
|
11
|
-
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
11
|
+
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem, ToolCallName, ContentSegment } from './search';
|
|
12
12
|
import type { SubmitFeedbackParams } from './feedback';
|
|
13
13
|
import type { TFunction } from './l10n';
|
|
14
14
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
@@ -96,6 +96,15 @@ export type ThemeHooks = {
|
|
|
96
96
|
error: null | AiSearchError;
|
|
97
97
|
conversation: AiSearchConversationItem[];
|
|
98
98
|
setConversation: React.Dispatch<React.SetStateAction<AiSearchConversationItem[]>>;
|
|
99
|
+
toolCalls: Array<{
|
|
100
|
+
name: ToolCallName;
|
|
101
|
+
args: unknown;
|
|
102
|
+
position: number;
|
|
103
|
+
result?: {
|
|
104
|
+
documentCount: number;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
contentSegments: ContentSegment[];
|
|
99
108
|
};
|
|
100
109
|
useMarkdownText: (text: string) => React.ReactNode;
|
|
101
110
|
useFacetQuery: (field: string) => {
|
|
@@ -138,7 +147,19 @@ export type ThemeHooks = {
|
|
|
138
147
|
items: BffCatalogEntityRevision[];
|
|
139
148
|
};
|
|
140
149
|
useCatalogClassic: (config: CatalogConfig) => FilteredCatalog;
|
|
141
|
-
useTelemetry: () => Omit<AsyncApiRealmUI.Telemetry, 'init' | 'updateCloudEventData' | 'forceFlush' | 'startSpan' | 'constructCloudEvent' | 'sendToOtelService'
|
|
150
|
+
useTelemetry: () => Omit<AsyncApiRealmUI.Telemetry, 'init' | 'updateCloudEventData' | 'forceFlush' | 'startSpan' | 'constructCloudEvent' | 'sendToOtelService'> & {
|
|
151
|
+
send<TEventType extends AsyncApiRealmUI.EventType>(event: TEventType, data?: AsyncApiRealmUI.EventPayload<TEventType>): void;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated This method is deprecated. Use send(event, data) instead.
|
|
154
|
+
*/
|
|
155
|
+
send<TEventType extends AsyncApiRealmUI.EventType>(params: AsyncApiRealmUI.SendEventParams<TEventType>): void;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated This hook is deprecated. Use `useTelemetry` instead.
|
|
159
|
+
*/
|
|
160
|
+
useOtelTelemetry: () => {
|
|
161
|
+
send<TEventType extends AsyncApiRealmUI.EventType>(params: AsyncApiRealmUI.SendEventParams<TEventType>): void;
|
|
162
|
+
};
|
|
142
163
|
useUserTeams: () => string[];
|
|
143
164
|
usePageData: () => PageData | null;
|
|
144
165
|
usePageSharedData: <T = unknown>(dataId: string) => T;
|
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.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' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | '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' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | '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.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | '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' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to';
|
|
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.assistant' | '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.toolResult.found' | 'search.ai.toolResult.found.documents' | 'search.ai.toolCall.searching' | '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' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | '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' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | '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.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | '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' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'mermaid.openFullscreen' | 'mermaid.zoomIn' | 'mermaid.zoomOut' | 'mermaid.reset' | 'mermaid.close' | 'mermaid.viewer';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -91,10 +91,34 @@ export type SearchAiMessageResource = {
|
|
|
91
91
|
url: string;
|
|
92
92
|
title: string;
|
|
93
93
|
};
|
|
94
|
+
export type ToolCall = {
|
|
95
|
+
name: ToolCallName;
|
|
96
|
+
args: unknown;
|
|
97
|
+
position: number;
|
|
98
|
+
result?: {
|
|
99
|
+
documentCount: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export type ContentSegment = {
|
|
103
|
+
type: 'text';
|
|
104
|
+
text: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'tool';
|
|
107
|
+
toolCall: ToolCall;
|
|
108
|
+
};
|
|
94
109
|
export type AiSearchConversationItem = {
|
|
95
110
|
role: AiSearchConversationRole;
|
|
96
111
|
content: string;
|
|
97
112
|
resources?: SearchAiMessageResource[];
|
|
98
113
|
messageId?: string;
|
|
99
114
|
feedback?: FeedbackType;
|
|
115
|
+
toolCalls?: ToolCall[];
|
|
116
|
+
contentSegments?: ContentSegment[];
|
|
100
117
|
};
|
|
118
|
+
export declare enum ToolCallName {
|
|
119
|
+
SearchDocumentation = "search_documentation",
|
|
120
|
+
ListApis = "list-apis",
|
|
121
|
+
GetEndpoints = "get-endpoints",
|
|
122
|
+
GetSecuritySchemes = "get-security-schemes",
|
|
123
|
+
GetFullApiDescription = "get-full-api-description"
|
|
124
|
+
}
|
package/lib/core/types/search.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeedbackType = void 0;
|
|
3
|
+
exports.ToolCallName = exports.FeedbackType = void 0;
|
|
4
4
|
var FeedbackType;
|
|
5
5
|
(function (FeedbackType) {
|
|
6
6
|
FeedbackType["Like"] = "like";
|
|
7
7
|
FeedbackType["Dislike"] = "dislike";
|
|
8
8
|
})(FeedbackType || (exports.FeedbackType = FeedbackType = {}));
|
|
9
|
+
var ToolCallName;
|
|
10
|
+
(function (ToolCallName) {
|
|
11
|
+
ToolCallName["SearchDocumentation"] = "search_documentation";
|
|
12
|
+
ToolCallName["ListApis"] = "list-apis";
|
|
13
|
+
ToolCallName["GetEndpoints"] = "get-endpoints";
|
|
14
|
+
ToolCallName["GetSecuritySchemes"] = "get-security-schemes";
|
|
15
|
+
ToolCallName["GetFullApiDescription"] = "get-full-api-description";
|
|
16
|
+
})(ToolCallName || (exports.ToolCallName = ToolCallName = {}));
|
|
9
17
|
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitContentByToolCalls = splitContentByToolCalls;
|
|
4
|
+
function splitContentByToolCalls(content, toolCalls) {
|
|
5
|
+
if (!toolCalls || toolCalls.length === 0) {
|
|
6
|
+
return [{ type: 'text', text: content || '' }];
|
|
7
|
+
}
|
|
8
|
+
const segments = [];
|
|
9
|
+
let lastPos = 0;
|
|
10
|
+
for (const toolCall of toolCalls) {
|
|
11
|
+
if (content && toolCall.position > lastPos) {
|
|
12
|
+
segments.push({ type: 'text', text: content.substring(lastPos, toolCall.position) });
|
|
13
|
+
}
|
|
14
|
+
segments.push({ type: 'tool', toolCall });
|
|
15
|
+
lastPos = toolCall.position;
|
|
16
|
+
}
|
|
17
|
+
if (content && lastPos < content.length) {
|
|
18
|
+
segments.push({ type: 'text', text: content.substring(lastPos) });
|
|
19
|
+
}
|
|
20
|
+
return segments;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=content-segments.js.map
|
package/lib/core/utils/index.js
CHANGED
|
@@ -59,4 +59,5 @@ __exportStar(require("./get-operation-color"), exports);
|
|
|
59
59
|
__exportStar(require("./frontmatter-translate"), exports);
|
|
60
60
|
__exportStar(require("./transform-revisions-to-version-history"), exports);
|
|
61
61
|
__exportStar(require("./build-revision-url"), exports);
|
|
62
|
+
__exportStar(require("./content-segments"), exports);
|
|
62
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,44 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.transformRevisionsToVersionHistory = transformRevisionsToVersionHistory;
|
|
4
4
|
const constants_1 = require("../../core/constants");
|
|
5
5
|
const date_1 = require("./date");
|
|
6
|
-
function compareVersionsDescending(versionA, versionB) {
|
|
7
|
-
return versionB.localeCompare(versionA, undefined, { numeric: true });
|
|
8
|
-
}
|
|
9
|
-
function extractGroupComparisonData(group) {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const version = group.version;
|
|
12
|
-
const isNotSpecified = version === constants_1.VERSION_NOT_SPECIFIED;
|
|
13
|
-
// Get version dates (oldest revision date for each group - the version's creation date)
|
|
14
|
-
// This ensures versions stay in their original order even when new revisions are added
|
|
15
|
-
const date = group.singleRevisionDate ||
|
|
16
|
-
(group.revisions && group.revisions.length > 0
|
|
17
|
-
? (_a = group.revisions[group.revisions.length - 1]) === null || _a === void 0 ? void 0 : _a.revisionDate
|
|
18
|
-
: undefined) ||
|
|
19
|
-
'';
|
|
20
|
-
const time = date ? new Date(date).getTime() : 0;
|
|
21
|
-
const hasCurrent = (_b = group.hasCurrentRevisionFromBackend) !== null && _b !== void 0 ? _b : false;
|
|
22
|
-
return { version, isNotSpecified, time, hasCurrent };
|
|
23
|
-
}
|
|
24
|
-
function compareVersionGroupsDescending(groupA, groupB) {
|
|
25
|
-
const { version: versionA, isNotSpecified: isNotSpecifiedA, time: timeA, hasCurrent: hasCurrentA, } = extractGroupComparisonData(groupA);
|
|
26
|
-
const { version: versionB, isNotSpecified: isNotSpecifiedB, time: timeB, hasCurrent: hasCurrentB, } = extractGroupComparisonData(groupB);
|
|
27
|
-
// First, compare by version date (oldest first, so most recent versions come first)
|
|
28
|
-
const dateComparison = timeB - timeA;
|
|
29
|
-
if (dateComparison !== 0) {
|
|
30
|
-
return dateComparison;
|
|
31
|
-
}
|
|
32
|
-
// If dates are equal, prioritize the one with isCurrent from backend
|
|
33
|
-
if (hasCurrentA !== hasCurrentB) {
|
|
34
|
-
return hasCurrentB ? 1 : -1; // hasCurrentB comes first if true
|
|
35
|
-
}
|
|
36
|
-
// If both have same isCurrent status, compare by version
|
|
37
|
-
// If both are unknown or both are real versions, compare by version
|
|
38
|
-
if (isNotSpecifiedA === isNotSpecifiedB) {
|
|
39
|
-
return compareVersionsDescending(versionA, versionB);
|
|
40
|
-
}
|
|
41
|
-
// If one is unknown and one is a real version, unknown comes last
|
|
42
|
-
return isNotSpecifiedA ? 1 : -1;
|
|
43
|
-
}
|
|
44
6
|
function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, currentVersion, locale = typeof navigator !== 'undefined' ? navigator.language : 'en-US', }) {
|
|
45
7
|
const normalizedCurrentVersion = currentVersion === null ? constants_1.VERSION_NOT_SPECIFIED : currentVersion;
|
|
46
8
|
const versionMap = new Map();
|
|
@@ -54,17 +16,12 @@ function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, cu
|
|
|
54
16
|
});
|
|
55
17
|
const versionGroups = Array.from(versionMap.entries()).map(([version, versionRevisions]) => {
|
|
56
18
|
var _a, _b, _c;
|
|
57
|
-
const
|
|
58
|
-
const dateA = a.revision ? new Date(a.revision).getTime() : 0;
|
|
59
|
-
const dateB = b.revision ? new Date(b.revision).getTime() : 0;
|
|
60
|
-
return dateB - dateA;
|
|
61
|
-
});
|
|
62
|
-
const latestRevision = sortedRevisions[0];
|
|
19
|
+
const latestRevision = versionRevisions[0];
|
|
63
20
|
const versionMatches = normalizedCurrentVersion === undefined || normalizedCurrentVersion === version;
|
|
64
21
|
let isCurrent;
|
|
65
22
|
if (currentRevisionDate !== undefined) {
|
|
66
23
|
// Check if revision matches AND version matches
|
|
67
|
-
const revisionMatches =
|
|
24
|
+
const revisionMatches = versionRevisions.some((rev) => rev.revision === currentRevisionDate);
|
|
68
25
|
isCurrent = revisionMatches && versionMatches;
|
|
69
26
|
}
|
|
70
27
|
else {
|
|
@@ -73,9 +30,9 @@ function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, cu
|
|
|
73
30
|
isCurrent = ((_a = latestRevision === null || latestRevision === void 0 ? void 0 : latestRevision.isCurrent) !== null && _a !== void 0 ? _a : false) && versionMatches;
|
|
74
31
|
}
|
|
75
32
|
// Check if any revision in this version group is the default version
|
|
76
|
-
const isDefaultVersion =
|
|
77
|
-
const revisions =
|
|
78
|
-
?
|
|
33
|
+
const isDefaultVersion = versionRevisions.some((rev) => rev.isDefaultVersion === true);
|
|
34
|
+
const revisions = versionRevisions.length > 1
|
|
35
|
+
? versionRevisions.map((rev, index) => {
|
|
79
36
|
var _a;
|
|
80
37
|
const revisionMatches = currentRevisionDate
|
|
81
38
|
? rev.revision === currentRevisionDate
|
|
@@ -86,7 +43,7 @@ function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, cu
|
|
|
86
43
|
index === 0 &&
|
|
87
44
|
isCurrent;
|
|
88
45
|
return {
|
|
89
|
-
name: `r.${
|
|
46
|
+
name: `r.${versionRevisions.length - index}`,
|
|
90
47
|
date: (0, date_1.toLocalizedShortDateTime)(rev.revision, locale),
|
|
91
48
|
revisionDate: rev.revision,
|
|
92
49
|
isActive: isActiveRevision || isCurrentByDefault,
|
|
@@ -102,9 +59,9 @@ function transformRevisionsToVersionHistory({ revisions, currentRevisionDate, cu
|
|
|
102
59
|
hasCurrentRevisionFromBackend: (_b = latestRevision === null || latestRevision === void 0 ? void 0 : latestRevision.isCurrent) !== null && _b !== void 0 ? _b : false,
|
|
103
60
|
isDefaultVersion,
|
|
104
61
|
revisions,
|
|
105
|
-
singleRevisionDate:
|
|
62
|
+
singleRevisionDate: versionRevisions.length === 1 ? (_c = versionRevisions[0]) === null || _c === void 0 ? void 0 : _c.revision : undefined,
|
|
106
63
|
};
|
|
107
64
|
});
|
|
108
|
-
return versionGroups
|
|
65
|
+
return versionGroups;
|
|
109
66
|
}
|
|
110
67
|
//# sourceMappingURL=transform-revisions-to-version-history.js.map
|