@redocly/theme 0.64.0-next.3 → 0.64.0-next.4
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/Catalog/CatalogTags.js +5 -2
- package/lib/components/LanguagePicker/LanguagePicker.js +5 -6
- package/lib/components/Search/SearchAiMessage.js +9 -6
- package/lib/components/SvgViewer/SvgViewer.js +0 -3
- package/lib/components/SvgViewer/variables.js +1 -1
- package/lib/core/constants/search.d.ts +3 -3
- package/lib/core/contexts/MarkdownLinkContext.d.ts +5 -0
- package/lib/core/contexts/MarkdownLinkContext.js +6 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- package/lib/core/styles/dark.js +28 -32
- package/lib/core/styles/global.js +2 -2
- package/lib/core/types/hooks.d.ts +2 -9
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +1 -1
- package/lib/markdoc/attributes/diagram-file.d.ts +5 -0
- package/lib/markdoc/attributes/diagram-file.js +16 -0
- package/lib/markdoc/components/Diagram/Diagram.d.ts +15 -0
- package/lib/markdoc/components/Diagram/Diagram.js +135 -0
- package/lib/markdoc/components/Diagram/variables.d.ts +1 -0
- package/lib/markdoc/components/Diagram/variables.js +15 -0
- package/lib/markdoc/components/MarkdownLink/MarkdownLink.d.ts +7 -0
- package/lib/markdoc/components/MarkdownLink/MarkdownLink.js +61 -0
- package/lib/markdoc/components/default.d.ts +2 -1
- package/lib/markdoc/components/default.js +2 -1
- package/lib/markdoc/default.d.ts +7 -0
- package/lib/markdoc/default.js +3 -0
- package/lib/markdoc/tags/diagram.d.ts +2 -0
- package/lib/markdoc/tags/diagram.js +63 -0
- package/package.json +3 -3
- package/src/components/Catalog/CatalogTags.tsx +6 -1
- package/src/components/LanguagePicker/LanguagePicker.tsx +5 -5
- package/src/components/Search/SearchAiMessage.tsx +15 -10
- package/src/components/SvgViewer/SvgViewer.tsx +0 -4
- package/src/components/SvgViewer/variables.ts +1 -1
- package/src/core/constants/search.ts +2 -3
- package/src/core/contexts/MarkdownLinkContext.tsx +9 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/styles/dark.ts +0 -4
- package/src/core/styles/global.ts +2 -2
- package/src/core/types/hooks.ts +2 -7
- package/src/core/types/l10n.ts +9 -9
- package/src/core/types/search.ts +1 -1
- package/src/markdoc/attributes/diagram-file.ts +9 -0
- package/src/markdoc/components/Diagram/Diagram.tsx +173 -0
- package/src/markdoc/components/Diagram/variables.ts +12 -0
- package/src/markdoc/components/MarkdownLink/MarkdownLink.tsx +21 -0
- package/src/markdoc/components/default.ts +2 -1
- package/src/markdoc/default.ts +3 -0
- package/src/markdoc/tags/diagram.ts +73 -0
- package/lib/components/SvgViewer/variables.dark.d.ts +0 -1
- package/lib/components/SvgViewer/variables.dark.js +0 -8
- package/lib/markdoc/components/Mermaid/Mermaid.d.ts +0 -9
- package/lib/markdoc/components/Mermaid/Mermaid.js +0 -94
- package/lib/markdoc/components/Mermaid/variables.d.ts +0 -1
- package/lib/markdoc/components/Mermaid/variables.dark.d.ts +0 -1
- package/lib/markdoc/components/Mermaid/variables.dark.js +0 -8
- package/lib/markdoc/components/Mermaid/variables.js +0 -16
- package/src/components/SvgViewer/variables.dark.ts +0 -5
- package/src/markdoc/components/Mermaid/Mermaid.tsx +0 -93
- package/src/markdoc/components/Mermaid/variables.dark.ts +0 -5
- package/src/markdoc/components/Mermaid/variables.ts +0 -13
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.MarkdownLink = MarkdownLink;
|
|
48
|
+
const react_1 = __importStar(require("react"));
|
|
49
|
+
const contexts_1 = require("../../../core/contexts");
|
|
50
|
+
const Link_1 = require("../../../components/Link/Link");
|
|
51
|
+
function MarkdownLink(_a) {
|
|
52
|
+
var { href } = _a, props = __rest(_a, ["href"]);
|
|
53
|
+
const markdownLinkContext = (0, react_1.useContext)(contexts_1.MarkdownLinkContext);
|
|
54
|
+
const onClick = (0, react_1.useCallback)(() => {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = markdownLinkContext === null || markdownLinkContext === void 0 ? void 0 : markdownLinkContext.onMarkdownLinkClick) === null || _a === void 0 ? void 0 : _a.call(markdownLinkContext);
|
|
57
|
+
}, [markdownLinkContext]);
|
|
58
|
+
const linkProps = Object.assign(Object.assign({}, props), { languageInsensitive: true, onClick });
|
|
59
|
+
return react_1.default.createElement(Link_1.Link, Object.assign({ to: href }, linkProps));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=MarkdownLink.js.map
|
|
@@ -2,7 +2,7 @@ export * from '../../markdoc/components/Admonition/Admonition';
|
|
|
2
2
|
export * from '../../markdoc/components/InlineSvg/InlineSvg';
|
|
3
3
|
export * from '../../markdoc/components/MarkdocExample/MarkdocExample';
|
|
4
4
|
export * from '../../markdoc/components/Heading/Heading';
|
|
5
|
-
export * from '../../markdoc/components/
|
|
5
|
+
export * from '../../markdoc/components/Diagram/Diagram';
|
|
6
6
|
export * from '../../markdoc/components/HtmlBlock/HtmlBlock';
|
|
7
7
|
export * from '../../markdoc/components/Tabs/Tab';
|
|
8
8
|
export * from '../../markdoc/components/Tabs/TabList';
|
|
@@ -22,3 +22,4 @@ export * from '../../markdoc/components/CodeGroup/CodeGroup';
|
|
|
22
22
|
export * from '../../markdoc/components/Icon/Icon';
|
|
23
23
|
export * from '../../markdoc/components/ConnectMCP/ConnectMCP';
|
|
24
24
|
export * from '../../markdoc/components/LoginButton/LoginButton';
|
|
25
|
+
export * from '../../markdoc/components/MarkdownLink/MarkdownLink';
|
|
@@ -18,7 +18,7 @@ __exportStar(require("../../markdoc/components/Admonition/Admonition"), exports)
|
|
|
18
18
|
__exportStar(require("../../markdoc/components/InlineSvg/InlineSvg"), exports);
|
|
19
19
|
__exportStar(require("../../markdoc/components/MarkdocExample/MarkdocExample"), exports);
|
|
20
20
|
__exportStar(require("../../markdoc/components/Heading/Heading"), exports);
|
|
21
|
-
__exportStar(require("../../markdoc/components/
|
|
21
|
+
__exportStar(require("../../markdoc/components/Diagram/Diagram"), exports);
|
|
22
22
|
__exportStar(require("../../markdoc/components/HtmlBlock/HtmlBlock"), exports);
|
|
23
23
|
__exportStar(require("../../markdoc/components/Tabs/Tab"), exports);
|
|
24
24
|
__exportStar(require("../../markdoc/components/Tabs/TabList"), exports);
|
|
@@ -38,4 +38,5 @@ __exportStar(require("../../markdoc/components/CodeGroup/CodeGroup"), exports);
|
|
|
38
38
|
__exportStar(require("../../markdoc/components/Icon/Icon"), exports);
|
|
39
39
|
__exportStar(require("../../markdoc/components/ConnectMCP/ConnectMCP"), exports);
|
|
40
40
|
__exportStar(require("../../markdoc/components/LoginButton/LoginButton"), exports);
|
|
41
|
+
__exportStar(require("../../markdoc/components/MarkdownLink/MarkdownLink"), exports);
|
|
41
42
|
//# sourceMappingURL=default.js.map
|
package/lib/markdoc/default.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from '../markdoc/attributes/code-snippet-file';
|
|
2
|
+
export * from '../markdoc/attributes/diagram-file';
|
|
2
3
|
export * from '../markdoc/attributes/img-src';
|
|
3
4
|
export * from '../markdoc/attributes/img-srcset';
|
|
4
5
|
export * from '../markdoc/attributes/relative-path';
|
|
@@ -24,6 +25,7 @@ import { codeGroup } from '../markdoc/tags/code-group';
|
|
|
24
25
|
import { icon } from '../markdoc/tags/icon';
|
|
25
26
|
import { connectMcp } from '../markdoc/tags/connect-mcp';
|
|
26
27
|
import { loginButton } from '../markdoc/tags/login-button';
|
|
28
|
+
import { diagram } from '../markdoc/tags/diagram';
|
|
27
29
|
export declare const tags: {
|
|
28
30
|
[admonition.tagName]: import("@markdoc/markdoc").Schema & {
|
|
29
31
|
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
@@ -125,4 +127,9 @@ export declare const tags: {
|
|
|
125
127
|
resolver?: string;
|
|
126
128
|
}>;
|
|
127
129
|
};
|
|
130
|
+
[diagram.tagName]: import("@markdoc/markdoc").Schema & {
|
|
131
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
132
|
+
resolver?: string;
|
|
133
|
+
}>;
|
|
134
|
+
};
|
|
128
135
|
};
|
package/lib/markdoc/default.js
CHANGED
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.tags = exports.components = void 0;
|
|
40
40
|
/* Attributes */
|
|
41
41
|
__exportStar(require("../markdoc/attributes/code-snippet-file"), exports);
|
|
42
|
+
__exportStar(require("../markdoc/attributes/diagram-file"), exports);
|
|
42
43
|
__exportStar(require("../markdoc/attributes/img-src"), exports);
|
|
43
44
|
__exportStar(require("../markdoc/attributes/img-srcset"), exports);
|
|
44
45
|
__exportStar(require("../markdoc/attributes/relative-path"), exports);
|
|
@@ -66,6 +67,7 @@ const code_group_1 = require("../markdoc/tags/code-group");
|
|
|
66
67
|
const icon_1 = require("../markdoc/tags/icon");
|
|
67
68
|
const connect_mcp_1 = require("../markdoc/tags/connect-mcp");
|
|
68
69
|
const login_button_1 = require("../markdoc/tags/login-button");
|
|
70
|
+
const diagram_1 = require("../markdoc/tags/diagram");
|
|
69
71
|
exports.tags = {
|
|
70
72
|
[admonition_1.admonition.tagName]: admonition_1.admonition.schema,
|
|
71
73
|
[debug_1.debug.tagName]: debug_1.debug.schema,
|
|
@@ -87,5 +89,6 @@ exports.tags = {
|
|
|
87
89
|
[icon_1.icon.tagName]: icon_1.icon.schema,
|
|
88
90
|
[connect_mcp_1.connectMcp.tagName]: connect_mcp_1.connectMcp.schema,
|
|
89
91
|
[login_button_1.loginButton.tagName]: login_button_1.loginButton.schema,
|
|
92
|
+
[diagram_1.diagram.tagName]: diagram_1.diagram.schema,
|
|
90
93
|
};
|
|
91
94
|
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.diagram = void 0;
|
|
7
|
+
const markdoc_1 = __importDefault(require("@markdoc/markdoc"));
|
|
8
|
+
const diagram_file_1 = require("../../markdoc/attributes/diagram-file");
|
|
9
|
+
const DIAGRAM_TYPES = ['mermaid', 'plantuml', 'excalidraw'];
|
|
10
|
+
const DIAGRAM_ALIGNMENTS = ['left', 'center', 'right'];
|
|
11
|
+
exports.diagram = {
|
|
12
|
+
schema: {
|
|
13
|
+
attributes: {
|
|
14
|
+
file: { type: diagram_file_1.DiagramFile, required: true },
|
|
15
|
+
type: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
matches: DIAGRAM_TYPES,
|
|
19
|
+
},
|
|
20
|
+
align: {
|
|
21
|
+
type: String,
|
|
22
|
+
matches: DIAGRAM_ALIGNMENTS,
|
|
23
|
+
},
|
|
24
|
+
width: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
rawContent: { type: String, render: false }, // internal — populated by resolver
|
|
28
|
+
},
|
|
29
|
+
render: 'Diagram',
|
|
30
|
+
selfClosing: true,
|
|
31
|
+
transform: (node, config) => {
|
|
32
|
+
const attributes = node.transformAttributes(config);
|
|
33
|
+
const rawContent = node.attributes.rawContent;
|
|
34
|
+
const diagramType = node.attributes.type;
|
|
35
|
+
if (typeof rawContent === 'string') {
|
|
36
|
+
return new markdoc_1.default.Tag('Diagram', Object.assign(Object.assign({}, attributes), { diagramType, diagramSource: rawContent }), []);
|
|
37
|
+
}
|
|
38
|
+
return new markdoc_1.default.Tag(node.tag, attributes, []);
|
|
39
|
+
},
|
|
40
|
+
validate(node) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
const type = node.attributes.type;
|
|
43
|
+
if (type && !DIAGRAM_TYPES.includes(type)) {
|
|
44
|
+
errors.push({
|
|
45
|
+
id: 'invalid-diagram-type',
|
|
46
|
+
level: 'error',
|
|
47
|
+
message: `Invalid diagram type "${type}". Must be one of: ${DIAGRAM_TYPES.join(', ')}`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const align = node.attributes.align;
|
|
51
|
+
if (align && !DIAGRAM_ALIGNMENTS.includes(align)) {
|
|
52
|
+
errors.push({
|
|
53
|
+
id: 'invalid-diagram-align',
|
|
54
|
+
level: 'error',
|
|
55
|
+
message: `Invalid diagram align "${align}". Must be one of: ${DIAGRAM_ALIGNMENTS.join(', ')}`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return errors;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
tagName: 'diagram',
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=diagram.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.64.0-next.
|
|
3
|
+
"version": "0.64.0-next.4",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vitest": "4.0.10",
|
|
64
64
|
"vitest-when": "0.6.2",
|
|
65
65
|
"webpack": "5.105.2",
|
|
66
|
-
"@redocly/realm-asyncapi-sdk": "0.10.0-next.
|
|
66
|
+
"@redocly/realm-asyncapi-sdk": "0.10.0-next.1"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@tanstack/react-query": "5.62.3",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"openapi-sampler": "^1.7.2",
|
|
82
82
|
"react-calendar": "5.1.0",
|
|
83
83
|
"react-date-picker": "11.0.0",
|
|
84
|
-
"@redocly/config": "0.46.
|
|
84
|
+
"@redocly/config": "0.46.1"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -48,6 +48,7 @@ export function CatalogTags({
|
|
|
48
48
|
if (shouldUseVariantWithTooltip) {
|
|
49
49
|
const displayedItems = items.slice(0, itemsToShow);
|
|
50
50
|
const remainingCount = items.length - itemsToShow;
|
|
51
|
+
const moreLabel = translate('catalog.tags.more', 'more');
|
|
51
52
|
|
|
52
53
|
return (
|
|
53
54
|
<Tooltip tip={items.join(', ')} placement="bottom" className="catalog">
|
|
@@ -70,7 +71,11 @@ export function CatalogTags({
|
|
|
70
71
|
</Tag>
|
|
71
72
|
))}
|
|
72
73
|
|
|
73
|
-
{remainingCount > 0 &&
|
|
74
|
+
{remainingCount > 0 && (
|
|
75
|
+
<MoreTagsButton>
|
|
76
|
+
+ {remainingCount} <span data-translation-key="catalog.tags.more">{moreLabel}</span>
|
|
77
|
+
</MoreTagsButton>
|
|
78
|
+
)}
|
|
74
79
|
</CatalogTagsWrapper>
|
|
75
80
|
</Tooltip>
|
|
76
81
|
);
|
|
@@ -52,17 +52,17 @@ export function LanguagePicker(props: LanguagePickerProps): JSX.Element | null {
|
|
|
52
52
|
placement={props.placement}
|
|
53
53
|
alignment={props.alignment}
|
|
54
54
|
trigger={languagePickerButton}
|
|
55
|
+
dataAttributes={{
|
|
56
|
+
'data-component-name': 'LanguagePicker/LanguagePicker',
|
|
57
|
+
'data-current-locale': currentLocale.code,
|
|
58
|
+
}}
|
|
55
59
|
>
|
|
56
60
|
<DropdownMenu items={languageItems} />
|
|
57
61
|
</LanguageDropdown>
|
|
58
62
|
);
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
const LanguageDropdown = styled(Dropdown)
|
|
62
|
-
dataAttributes: {
|
|
63
|
-
'data-component-name': 'LanguagePicker/LanguagePicker',
|
|
64
|
-
},
|
|
65
|
-
}))`
|
|
65
|
+
const LanguageDropdown = styled(Dropdown)`
|
|
66
66
|
display: none;
|
|
67
67
|
height: auto;
|
|
68
68
|
@media screen and (min-width: ${breakpoints.medium}) {
|
|
@@ -26,6 +26,17 @@ function MarkdownSegment({ text }: { text: string }): JSX.Element {
|
|
|
26
26
|
const markdown = useMarkdownText(text);
|
|
27
27
|
return <ResponseText as="div" children={markdown} data-testid="response-text" />;
|
|
28
28
|
}
|
|
29
|
+
function getToolCallDisplayText(toolName: string): {
|
|
30
|
+
inProgressText: string;
|
|
31
|
+
completedText: string;
|
|
32
|
+
} {
|
|
33
|
+
return (
|
|
34
|
+
TOOL_CALL_DISPLAY_TEXT[toolName] ?? {
|
|
35
|
+
inProgressText: `Executing ${toolName}...`,
|
|
36
|
+
completedText: `${toolName} executed`,
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
29
40
|
|
|
30
41
|
export type SearchAiMessageProps = {
|
|
31
42
|
role: AiSearchConversationRole;
|
|
@@ -121,17 +132,11 @@ function SearchAiMessageComponent({
|
|
|
121
132
|
if (segment.type === 'tool') {
|
|
122
133
|
const toolCallCompleted = Boolean(segment.toolCall.result);
|
|
123
134
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const toolCallInProgressText =
|
|
129
|
-
TOOL_CALL_DISPLAY_TEXT[segment.toolCall.name]?.inProgressText ??
|
|
130
|
-
translate('search.ai.toolCall.searching', 'Searching...');
|
|
135
|
+
const { inProgressText, completedText } = getToolCallDisplayText(
|
|
136
|
+
segment.toolCall.name,
|
|
137
|
+
);
|
|
131
138
|
|
|
132
|
-
const toolCallDisplayText = toolCallCompleted
|
|
133
|
-
? toolCallCompletedText
|
|
134
|
-
: toolCallInProgressText;
|
|
139
|
+
const toolCallDisplayText = toolCallCompleted ? completedText : inProgressText;
|
|
135
140
|
|
|
136
141
|
return (
|
|
137
142
|
<ToolCallsInfoWrapper key={`tool-${index}`} data-testid="tool-calls-info">
|
|
@@ -129,9 +129,6 @@ export function SvgViewer({
|
|
|
129
129
|
|
|
130
130
|
const handleWheel = useCallback(
|
|
131
131
|
(e: WheelEvent) => {
|
|
132
|
-
e.preventDefault();
|
|
133
|
-
e.stopPropagation();
|
|
134
|
-
|
|
135
132
|
setIsWheelZooming(true);
|
|
136
133
|
if (wheelTimeoutRef.current) clearTimeout(wheelTimeoutRef.current);
|
|
137
134
|
wheelTimeoutRef.current = setTimeout(() => setIsWheelZooming(false), 150);
|
|
@@ -186,7 +183,6 @@ export function SvgViewer({
|
|
|
186
183
|
|
|
187
184
|
const handleTouchMove = useCallback(
|
|
188
185
|
(e: ReactTouchEvent) => {
|
|
189
|
-
e.preventDefault();
|
|
190
186
|
if (e.touches.length === 2 && pinchState) {
|
|
191
187
|
const distance = getTouchDistance(e.touches);
|
|
192
188
|
setScale(clampScale(pinchState.scale * (distance / pinchState.distance)));
|
|
@@ -6,7 +6,7 @@ export const svgViewer = css`
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
--svg-viewer-overlay-bg-color: var(--bg-color-modal-overlay); // @presenter Color
|
|
9
|
-
--svg-viewer-bg-color: var(--bg-color); // @presenter Color
|
|
9
|
+
--svg-viewer-bg-color: var(--bg-color-raised); // @presenter Color
|
|
10
10
|
--svg-viewer-border-radius: var(--border-radius-xl); // @presenter BorderRadius
|
|
11
11
|
--svg-viewer-box-shadow: var(--bg-raised-shadow); // @presenter BoxShadow
|
|
12
12
|
|
|
@@ -46,9 +46,8 @@ export const AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
|
46
46
|
|
|
47
47
|
export const SEARCH_DEBOUNCE_TIME_MS = 300;
|
|
48
48
|
|
|
49
|
-
export const TOOL_CALL_DISPLAY_TEXT:
|
|
50
|
-
|
|
51
|
-
{ inProgressText: string; completedText: string }
|
|
49
|
+
export const TOOL_CALL_DISPLAY_TEXT: Partial<
|
|
50
|
+
Record<string, { inProgressText: string; completedText: string }>
|
|
52
51
|
> = {
|
|
53
52
|
[ToolCallName.SearchDocumentation]: {
|
|
54
53
|
inProgressText: 'Searching documentation...',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export type MarkdownLinkClickHandler = () => void;
|
|
4
|
+
|
|
5
|
+
export type MarkdownLinkContextValue = {
|
|
6
|
+
onMarkdownLinkClick?: MarkdownLinkClickHandler;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const MarkdownLinkContext = createContext<MarkdownLinkContextValue | null>(null);
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
3
|
import { scorecardDarkMode } from '@redocly/theme/components/Scorecard/variables.dark';
|
|
4
|
-
import { mermaidDarkMode } from '@redocly/theme/markdoc/components/Mermaid/variables.dark'
|
|
5
4
|
import { menuDarkMode } from '@redocly/theme/components/Menu/variables.dark';
|
|
6
5
|
import { buttonDarkMode } from '@redocly/theme/components/Button/variables.dark';
|
|
7
6
|
import { aiAssistantButtonDarkMode } from '@redocly/theme/components/Buttons/variables.dark';
|
|
@@ -16,7 +15,6 @@ import { pageActionsDarkMode } from '@redocly/theme/components/PageActions/varia
|
|
|
16
15
|
import { tooltipDarkMode } from '@redocly/theme/components/Tooltip/variables.dark';
|
|
17
16
|
import { bannerDarkMode } from '@redocly/theme/components/Banner/variables.dark';
|
|
18
17
|
import { admonitionDarkMode } from '@redocly/theme/components/Admonition/variables.dark';
|
|
19
|
-
import { svgViewerDarkMode } from '@redocly/theme/components/SvgViewer/variables.dark';
|
|
20
18
|
|
|
21
19
|
import { activeBrandPaletteDark } from './palette.dark';
|
|
22
20
|
|
|
@@ -343,7 +341,6 @@ export const darkMode = css`
|
|
|
343
341
|
${tagDarkMode}
|
|
344
342
|
${statusCodeDarkMode}
|
|
345
343
|
${menuDarkMode}
|
|
346
|
-
${mermaidDarkMode}
|
|
347
344
|
${scorecardDarkMode}
|
|
348
345
|
${replayDarkMode}
|
|
349
346
|
${switcherDarkMode}
|
|
@@ -353,7 +350,6 @@ export const darkMode = css`
|
|
|
353
350
|
${tooltipDarkMode}
|
|
354
351
|
${bannerDarkMode}
|
|
355
352
|
${admonitionDarkMode}
|
|
356
|
-
${svgViewerDarkMode}
|
|
357
353
|
${badgesDarkMode}
|
|
358
354
|
${activeBrandPaletteDark}
|
|
359
355
|
/**
|
|
@@ -28,7 +28,7 @@ import { productPicker } from '@redocly/theme/components/Product/variables';
|
|
|
28
28
|
import { markdown } from '@redocly/theme/components/Markdown/variables';
|
|
29
29
|
import { banner } from '@redocly/theme/components/Banner/variables';
|
|
30
30
|
import { markdownTabs } from '@redocly/theme/markdoc/components/Tabs/variables';
|
|
31
|
-
import {
|
|
31
|
+
import { diagram } from '@redocly/theme/markdoc/components/Diagram/variables';
|
|
32
32
|
import { lastUpdated } from '@redocly/theme/components/LastUpdated/variables';
|
|
33
33
|
import { logo } from '@redocly/theme/components/Logo/variables';
|
|
34
34
|
import { statusCode } from '@redocly/theme/components/StatusCode/variables';
|
|
@@ -1303,7 +1303,7 @@ export const styles = css<{ palette?: string }>`
|
|
|
1303
1303
|
${logo}
|
|
1304
1304
|
${markdown}
|
|
1305
1305
|
${markdownTabs}
|
|
1306
|
-
${
|
|
1306
|
+
${diagram}
|
|
1307
1307
|
${menu}
|
|
1308
1308
|
${mobileMenu}
|
|
1309
1309
|
${modal}
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -23,8 +23,8 @@ import type {
|
|
|
23
23
|
SearchFilterItem,
|
|
24
24
|
SearchFacetQuery,
|
|
25
25
|
AiSearchConversationItem,
|
|
26
|
-
ToolCallName,
|
|
27
26
|
ContentSegment,
|
|
27
|
+
ToolCall,
|
|
28
28
|
} from './search';
|
|
29
29
|
import type { SubmitFeedbackParams } from './feedback';
|
|
30
30
|
import type { TFunction } from './l10n';
|
|
@@ -125,12 +125,7 @@ export type ThemeHooks = {
|
|
|
125
125
|
error: null | AiSearchError;
|
|
126
126
|
conversation: AiSearchConversationItem[];
|
|
127
127
|
setConversation: React.Dispatch<React.SetStateAction<AiSearchConversationItem[]>>;
|
|
128
|
-
toolCalls: Array<
|
|
129
|
-
name: ToolCallName;
|
|
130
|
-
args: unknown;
|
|
131
|
-
position: number;
|
|
132
|
-
result?: { documentCount: number };
|
|
133
|
-
}>;
|
|
128
|
+
toolCalls: Array<ToolCall>;
|
|
134
129
|
contentSegments: ContentSegment[];
|
|
135
130
|
};
|
|
136
131
|
useMarkdownText: (text: string) => React.ReactNode;
|
package/src/core/types/l10n.ts
CHANGED
|
@@ -99,9 +99,9 @@ export type TranslationKey =
|
|
|
99
99
|
| 'search.ai.feedback.title'
|
|
100
100
|
| 'search.ai.feedback.detailsPlaceholder'
|
|
101
101
|
| 'search.ai.feedback.thanks'
|
|
102
|
-
| 'search.ai.
|
|
103
|
-
| 'search.ai.
|
|
104
|
-
| 'search.ai.toolCall.
|
|
102
|
+
| 'search.ai.toolCall.executed'
|
|
103
|
+
| 'search.ai.toolCall.executing'
|
|
104
|
+
| 'search.ai.toolCall.withArgs'
|
|
105
105
|
| 'search.ai.button'
|
|
106
106
|
| 'search.ai.label'
|
|
107
107
|
| 'search.ai.disclaimer'
|
|
@@ -426,12 +426,12 @@ export type TranslationKey =
|
|
|
426
426
|
| 'loaders.loading'
|
|
427
427
|
| 'filter.dateRange.from'
|
|
428
428
|
| 'filter.dateRange.to'
|
|
429
|
-
| '
|
|
430
|
-
| '
|
|
431
|
-
| '
|
|
432
|
-
| '
|
|
433
|
-
| '
|
|
434
|
-
| '
|
|
429
|
+
| 'diagram.openFullscreen'
|
|
430
|
+
| 'diagram.zoomIn'
|
|
431
|
+
| 'diagram.zoomOut'
|
|
432
|
+
| 'diagram.reset'
|
|
433
|
+
| 'diagram.close'
|
|
434
|
+
| 'diagram.viewer';
|
|
435
435
|
|
|
436
436
|
export type Locale = { code: string; name: string };
|
|
437
437
|
|
package/src/core/types/search.ts
CHANGED