@docusaurus/theme-search-algolia 3.8.1-canary-6396 → 3.8.1-canary-6399
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/client/index.d.ts +3 -1
- package/lib/client/index.js +3 -1
- package/lib/client/useAlgoliaAskAi.d.ts +32 -0
- package/lib/client/useAlgoliaAskAi.js +59 -0
- package/lib/client/useAlgoliaContextualFacetFilters.d.ts +3 -1
- package/lib/client/useAlgoliaContextualFacetFilters.js +11 -0
- package/lib/client/utils.d.ts +9 -0
- package/lib/client/utils.js +21 -0
- package/lib/theme/SearchBar/index.js +10 -11
- package/lib/theme/SearchBar/styles.css +4 -0
- package/lib/theme/SearchPage/index.js +70 -25
- package/lib/theme/SearchPage/styles.module.css +12 -4
- package/lib/theme/SearchTranslations/index.d.ts +47 -0
- package/lib/theme/SearchTranslations/index.js +186 -31
- package/lib/validateThemeConfig.d.ts +4 -3
- package/lib/validateThemeConfig.js +65 -4
- package/package.json +12 -12
- package/src/client/index.ts +6 -1
- package/src/client/useAlgoliaAskAi.ts +108 -0
- package/src/client/useAlgoliaContextualFacetFilters.ts +17 -1
- package/src/client/utils.ts +40 -0
- package/src/theme/SearchBar/index.tsx +38 -20
- package/src/theme/SearchBar/styles.css +4 -0
- package/src/theme/SearchPage/index.tsx +71 -25
- package/src/theme/SearchPage/styles.module.css +12 -4
- package/src/theme/SearchTranslations/index.ts +237 -32
- package/src/theme-search-algolia.d.ts +46 -16
- package/src/validateThemeConfig.ts +86 -9
package/lib/client/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
8
|
-
export { useAlgoliaContextualFacetFilters } from './useAlgoliaContextualFacetFilters';
|
|
8
|
+
export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
|
|
9
9
|
export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
|
|
10
|
+
export { useAlgoliaAskAi } from './useAlgoliaAskAi';
|
|
11
|
+
export { mergeFacetFilters } from './utils';
|
package/lib/client/index.js
CHANGED
|
@@ -5,5 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
8
|
-
export { useAlgoliaContextualFacetFilters } from './useAlgoliaContextualFacetFilters';
|
|
8
|
+
export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
|
|
9
9
|
export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
|
|
10
|
+
export { useAlgoliaAskAi } from './useAlgoliaAskAi';
|
|
11
|
+
export { mergeFacetFilters } from './utils';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type DocSearchModalProps, type DocSearchTranslations } from '@docsearch/react';
|
|
8
|
+
import type { AskAiConfig } from '@docusaurus/theme-search-algolia';
|
|
9
|
+
interface DocSearchV4PropsLite {
|
|
10
|
+
indexName: string;
|
|
11
|
+
apiKey: string;
|
|
12
|
+
appId: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
translations?: DocSearchTranslations;
|
|
15
|
+
searchParameters?: DocSearchModalProps['searchParameters'];
|
|
16
|
+
askAi?: AskAiConfig;
|
|
17
|
+
}
|
|
18
|
+
type UseAskAiResult = {
|
|
19
|
+
canHandleAskAi: boolean;
|
|
20
|
+
isAskAiActive: boolean;
|
|
21
|
+
currentPlaceholder: string | undefined;
|
|
22
|
+
onAskAiToggle: (active: boolean) => void;
|
|
23
|
+
askAi?: AskAiConfig;
|
|
24
|
+
extraAskAiProps: Partial<DocSearchModalProps> & {
|
|
25
|
+
askAi?: AskAiConfig;
|
|
26
|
+
canHandleAskAi?: boolean;
|
|
27
|
+
isAskAiActive?: boolean;
|
|
28
|
+
onAskAiToggle?: (active: boolean) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare function useAlgoliaAskAi(props: DocSearchV4PropsLite): UseAskAiResult;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
8
|
+
import { version as docsearchVersion, } from '@docsearch/react';
|
|
9
|
+
import translations from '@theme/SearchTranslations';
|
|
10
|
+
import { useAlgoliaContextualFacetFiltersIfEnabled } from './useAlgoliaContextualFacetFilters';
|
|
11
|
+
import { mergeFacetFilters } from './utils';
|
|
12
|
+
const isV4 = docsearchVersion.startsWith('4.');
|
|
13
|
+
// We need to apply contextualSearch facetFilters to AskAI filters
|
|
14
|
+
// This can't be done at config normalization time because contextual filters
|
|
15
|
+
// can only be determined at runtime
|
|
16
|
+
function applyAskAiContextualSearch(askAi, contextualSearchFilters) {
|
|
17
|
+
if (!askAi) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
if (!contextualSearchFilters) {
|
|
21
|
+
return askAi;
|
|
22
|
+
}
|
|
23
|
+
const askAiFacetFilters = askAi.searchParameters?.facetFilters;
|
|
24
|
+
return {
|
|
25
|
+
...askAi,
|
|
26
|
+
searchParameters: {
|
|
27
|
+
...askAi.searchParameters,
|
|
28
|
+
facetFilters: mergeFacetFilters(askAiFacetFilters, contextualSearchFilters),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function useAlgoliaAskAi(props) {
|
|
33
|
+
const [isAskAiActive, setIsAskAiActive] = useState(false);
|
|
34
|
+
const contextualSearchFilters = useAlgoliaContextualFacetFiltersIfEnabled();
|
|
35
|
+
const askAi = useMemo(() => {
|
|
36
|
+
return applyAskAiContextualSearch(props.askAi, contextualSearchFilters);
|
|
37
|
+
}, [props.askAi, contextualSearchFilters]);
|
|
38
|
+
const canHandleAskAi = Boolean(askAi);
|
|
39
|
+
const currentPlaceholder = isAskAiActive && isV4
|
|
40
|
+
? translations.modal?.searchBox?.placeholderTextAskAi
|
|
41
|
+
: translations.modal?.searchBox?.placeholderText || props?.placeholder;
|
|
42
|
+
const onAskAiToggle = useCallback((askAiToggle) => {
|
|
43
|
+
setIsAskAiActive(askAiToggle);
|
|
44
|
+
}, []);
|
|
45
|
+
const extraAskAiProps = {
|
|
46
|
+
askAi,
|
|
47
|
+
canHandleAskAi,
|
|
48
|
+
isAskAiActive,
|
|
49
|
+
onAskAiToggle,
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
canHandleAskAi,
|
|
53
|
+
isAskAiActive,
|
|
54
|
+
currentPlaceholder,
|
|
55
|
+
onAskAiToggle,
|
|
56
|
+
askAi,
|
|
57
|
+
extraAskAiProps,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import type { FacetFilters } from 'algoliasearch/lite';
|
|
8
|
+
export declare function useAlgoliaContextualFacetFilters(): FacetFilters;
|
|
9
|
+
export declare function useAlgoliaContextualFacetFiltersIfEnabled(): FacetFilters | undefined;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { DEFAULT_SEARCH_TAG } from '@docusaurus/theme-common/internal';
|
|
8
8
|
import { useDocsContextualSearchTags } from '@docusaurus/plugin-content-docs/client';
|
|
9
9
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
|
+
import { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
10
11
|
function useSearchTags() {
|
|
11
12
|
// only docs have custom search tags per version
|
|
12
13
|
const docsTags = useDocsContextualSearchTags();
|
|
@@ -21,3 +22,13 @@ export function useAlgoliaContextualFacetFilters() {
|
|
|
21
22
|
const tagsFilter = tags.map((tag) => `docusaurus_tag:${tag}`);
|
|
22
23
|
return [languageFilter, tagsFilter];
|
|
23
24
|
}
|
|
25
|
+
export function useAlgoliaContextualFacetFiltersIfEnabled() {
|
|
26
|
+
const { algolia: { contextualSearch }, } = useAlgoliaThemeConfig();
|
|
27
|
+
const facetFilters = useAlgoliaContextualFacetFilters();
|
|
28
|
+
if (contextualSearch) {
|
|
29
|
+
return facetFilters;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { FacetFilters } from 'algoliasearch/lite';
|
|
8
|
+
export declare function mergeFacetFilters(f1: FacetFilters, f2: FacetFilters): FacetFilters;
|
|
9
|
+
export declare function mergeFacetFilters(f1: FacetFilters | undefined, f2: FacetFilters | undefined): FacetFilters | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export function mergeFacetFilters(f1, f2) {
|
|
8
|
+
if (f1 === undefined) {
|
|
9
|
+
return f2;
|
|
10
|
+
}
|
|
11
|
+
if (f2 === undefined) {
|
|
12
|
+
return f1;
|
|
13
|
+
}
|
|
14
|
+
const normalize = (f) => typeof f === 'string' ? [f] : f;
|
|
15
|
+
// Historical behavior: we flatten everything
|
|
16
|
+
// TODO I'm pretty sure this is incorrect
|
|
17
|
+
// see https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/?client=javascript
|
|
18
|
+
// Note: Algolia is working to provide a reliable facet merging strategy
|
|
19
|
+
// see https://github.com/facebook/docusaurus/pull/11327#issuecomment-3284742923
|
|
20
|
+
return [...normalize(f1), ...normalize(f2)];
|
|
21
|
+
}
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
useAlgoliaContextualFacetFilters,
|
|
19
19
|
useSearchResultUrlProcessor,
|
|
20
|
+
useAlgoliaAskAi,
|
|
21
|
+
mergeFacetFilters,
|
|
20
22
|
} from '@docusaurus/theme-search-algolia/client';
|
|
21
23
|
import Translate from '@docusaurus/Translate';
|
|
22
24
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
@@ -102,10 +104,6 @@ function ResultsFooter({state, onClose}) {
|
|
|
102
104
|
);
|
|
103
105
|
}
|
|
104
106
|
function useSearchParameters({contextualSearch, ...props}) {
|
|
105
|
-
function mergeFacetFilters(f1, f2) {
|
|
106
|
-
const normalize = (f) => (typeof f === 'string' ? [f] : f);
|
|
107
|
-
return [...normalize(f1), ...normalize(f2)];
|
|
108
|
-
}
|
|
109
107
|
const contextualSearchFacetFilters = useAlgoliaContextualFacetFilters();
|
|
110
108
|
const configFacetFilters = props.searchParameters?.facetFilters ?? [];
|
|
111
109
|
const facetFilters = contextualSearch
|
|
@@ -125,10 +123,11 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
125
123
|
const transformItems = useTransformItems(props);
|
|
126
124
|
const transformSearchClient = useTransformSearchClient();
|
|
127
125
|
const searchContainer = useRef(null);
|
|
128
|
-
// TODO remove "as any" after React 19 upgrade
|
|
129
126
|
const searchButtonRef = useRef(null);
|
|
130
127
|
const [isOpen, setIsOpen] = useState(false);
|
|
131
128
|
const [initialQuery, setInitialQuery] = useState(undefined);
|
|
129
|
+
const {isAskAiActive, currentPlaceholder, onAskAiToggle, extraAskAiProps} =
|
|
130
|
+
useAlgoliaAskAi(props);
|
|
132
131
|
const prepareSearchContainer = useCallback(() => {
|
|
133
132
|
if (!searchContainer.current) {
|
|
134
133
|
const divElement = document.createElement('div');
|
|
@@ -144,7 +143,8 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
144
143
|
setIsOpen(false);
|
|
145
144
|
searchButtonRef.current?.focus();
|
|
146
145
|
setInitialQuery(undefined);
|
|
147
|
-
|
|
146
|
+
onAskAiToggle(false);
|
|
147
|
+
}, [onAskAiToggle]);
|
|
148
148
|
const handleInput = useCallback(
|
|
149
149
|
(event) => {
|
|
150
150
|
if (event.key === 'f' && (event.metaKey || event.ctrlKey)) {
|
|
@@ -165,6 +165,8 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
165
165
|
onClose: closeModal,
|
|
166
166
|
onInput: handleInput,
|
|
167
167
|
searchButtonRef,
|
|
168
|
+
isAskAiActive: isAskAiActive ?? false,
|
|
169
|
+
onAskAiToggle: onAskAiToggle ?? (() => {}),
|
|
168
170
|
});
|
|
169
171
|
return (
|
|
170
172
|
<>
|
|
@@ -190,8 +192,6 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
190
192
|
|
|
191
193
|
{isOpen &&
|
|
192
194
|
DocSearchModal &&
|
|
193
|
-
// TODO need to fix this React Compiler lint error
|
|
194
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
195
195
|
searchContainer.current &&
|
|
196
196
|
createPortal(
|
|
197
197
|
<DocSearchModal
|
|
@@ -205,13 +205,12 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
205
205
|
{...(props.searchPagePath && {
|
|
206
206
|
resultsFooterComponent,
|
|
207
207
|
})}
|
|
208
|
-
placeholder={
|
|
208
|
+
placeholder={currentPlaceholder}
|
|
209
209
|
{...props}
|
|
210
210
|
translations={props.translations?.modal ?? translations.modal}
|
|
211
211
|
searchParameters={searchParameters}
|
|
212
|
+
{...extraAskAiProps}
|
|
212
213
|
/>,
|
|
213
|
-
// TODO need to fix this React Compiler lint error
|
|
214
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
215
214
|
searchContainer.current,
|
|
216
215
|
)}
|
|
217
216
|
</>
|
|
@@ -114,6 +114,64 @@ function SearchVersionSelectList({docsSearchVersionsHelpers}) {
|
|
|
114
114
|
</div>
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
+
function AlgoliaLogo() {
|
|
118
|
+
return (
|
|
119
|
+
<svg
|
|
120
|
+
width="80"
|
|
121
|
+
height="24"
|
|
122
|
+
aria-label="Algolia"
|
|
123
|
+
role="img"
|
|
124
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
125
|
+
viewBox="0 0 2196.2 500"
|
|
126
|
+
style={{maxWidth: '150px'}}>
|
|
127
|
+
<defs>
|
|
128
|
+
{/* eslint-disable-next-line @docusaurus/no-untranslated-text */}
|
|
129
|
+
<style>{`.cls-1,.cls-2{fill:#003dff}.cls-2{fill-rule:evenodd}`}</style>
|
|
130
|
+
</defs>
|
|
131
|
+
<path
|
|
132
|
+
className="cls-2"
|
|
133
|
+
d="M1070.38,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"
|
|
134
|
+
/>
|
|
135
|
+
<rect
|
|
136
|
+
className="cls-1"
|
|
137
|
+
x="1845.88"
|
|
138
|
+
y="104.73"
|
|
139
|
+
width="62.58"
|
|
140
|
+
height="277.9"
|
|
141
|
+
rx="5.9"
|
|
142
|
+
ry="5.9"
|
|
143
|
+
/>
|
|
144
|
+
<path
|
|
145
|
+
className="cls-2"
|
|
146
|
+
d="M1851.78,71.38h50.77c3.26,0,5.9-2.64,5.9-5.9V5.9c0-3.62-3.24-6.39-6.82-5.83l-50.77,7.95c-2.87,.45-4.99,2.92-4.99,5.83v51.62c0,3.26,2.64,5.9,5.9,5.9Z"
|
|
147
|
+
/>
|
|
148
|
+
<path
|
|
149
|
+
className="cls-2"
|
|
150
|
+
d="M1764.03,275.3V5.91c0-3.63-3.24-6.39-6.82-5.83l-50.46,7.94c-2.87,.45-4.99,2.93-4.99,5.84l.17,273.22c0,12.92,0,92.7,95.97,95.49,3.33,.1,6.09-2.58,6.09-5.91v-40.78c0-2.96-2.19-5.51-5.12-5.84-34.85-4.01-34.85-47.57-34.85-54.72Z"
|
|
151
|
+
/>
|
|
152
|
+
<path
|
|
153
|
+
className="cls-2"
|
|
154
|
+
d="M1631.95,142.72c-11.14-12.25-24.83-21.65-40.78-28.31-15.92-6.53-33.26-9.85-52.07-9.85-18.78,0-36.15,3.17-51.92,9.85-15.59,6.66-29.29,16.05-40.76,28.31-11.47,12.23-20.38,26.87-26.76,44.03-6.38,17.17-9.24,37.37-9.24,58.36,0,20.99,3.19,36.87,9.55,54.21,6.38,17.32,15.14,32.11,26.45,44.36,11.29,12.23,24.83,21.62,40.6,28.46,15.77,6.83,40.12,10.33,52.4,10.48,12.25,0,36.78-3.82,52.7-10.48,15.92-6.68,29.46-16.23,40.78-28.46,11.29-12.25,20.05-27.04,26.25-44.36,6.22-17.34,9.24-33.22,9.24-54.21,0-20.99-3.34-41.19-10.03-58.36-6.38-17.17-15.14-31.8-26.43-44.03Zm-44.43,163.75c-11.47,15.75-27.56,23.7-48.09,23.7-20.55,0-36.63-7.8-48.1-23.7-11.47-15.75-17.21-34.01-17.21-61.2,0-26.89,5.59-49.14,17.06-64.87,11.45-15.75,27.54-23.52,48.07-23.52,20.55,0,36.63,7.78,48.09,23.52,11.47,15.57,17.36,37.98,17.36,64.87,0,27.19-5.72,45.3-17.19,61.2Z"
|
|
155
|
+
/>
|
|
156
|
+
<path
|
|
157
|
+
className="cls-2"
|
|
158
|
+
d="M894.42,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"
|
|
159
|
+
/>
|
|
160
|
+
<path
|
|
161
|
+
className="cls-2"
|
|
162
|
+
d="M2133.97,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-14.52,22.58-22.99,49.63-22.99,78.73,0,44.89,20.13,84.92,51.59,111.1,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47,1.23,0,2.46-.03,3.68-.09,.36-.02,.71-.05,1.07-.07,.87-.05,1.75-.11,2.62-.2,.34-.03,.68-.08,1.02-.12,.91-.1,1.82-.21,2.73-.34,.21-.03,.42-.07,.63-.1,32.89-5.07,61.56-30.82,70.9-62.81v57.83c0,3.26,2.64,5.9,5.9,5.9h50.42c3.26,0,5.9-2.64,5.9-5.9V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,206.92c-12.2,10.16-27.97,13.98-44.84,15.12-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-42.24,0-77.12-35.89-77.12-79.37,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33v142.83Z"
|
|
163
|
+
/>
|
|
164
|
+
<path
|
|
165
|
+
className="cls-2"
|
|
166
|
+
d="M1314.05,104.73h-49.33c-48.36,0-90.91,25.48-115.75,64.1-11.79,18.34-19.6,39.64-22.11,62.59-.58,5.3-.88,10.68-.88,16.14s.31,11.15,.93,16.59c4.28,38.09,23.14,71.61,50.66,94.52,2.93,2.6,6.05,4.98,9.31,7.14,12.86,8.49,28.11,13.47,44.52,13.47h0c17.99,0,34.61-5.93,48.16-15.97,16.29-11.58,28.88-28.54,34.48-47.75v50.26h-.11v11.08c0,21.84-5.71,38.27-17.34,49.36-11.61,11.08-31.04,16.63-58.25,16.63-11.12,0-28.79-.59-46.6-2.41-2.83-.29-5.46,1.5-6.27,4.22l-12.78,43.11c-1.02,3.46,1.27,7.02,4.83,7.53,21.52,3.08,42.52,4.68,54.65,4.68,48.91,0,85.16-10.75,108.89-32.21,21.48-19.41,33.15-48.89,35.2-88.52V110.63c0-3.26-2.64-5.9-5.9-5.9h-56.32Zm0,64.1s.65,139.13,0,143.36c-12.08,9.77-27.11,13.59-43.49,14.7-.16,.01-.33,.03-.49,.04-1.12,.07-2.24,.1-3.36,.1-1.32,0-2.63-.03-3.94-.1-40.41-2.11-74.52-37.26-74.52-79.38,0-10.25,1.96-20.01,5.42-28.98,11.22-29.12,38.77-49.74,71.06-49.74h49.33Z"
|
|
167
|
+
/>
|
|
168
|
+
<path
|
|
169
|
+
className="cls-1"
|
|
170
|
+
d="M249.83,0C113.3,0,2,110.09,.03,246.16c-2,138.19,110.12,252.7,248.33,253.5,42.68,.25,83.79-10.19,120.3-30.03,3.56-1.93,4.11-6.83,1.08-9.51l-23.38-20.72c-4.75-4.21-11.51-5.4-17.36-2.92-25.48,10.84-53.17,16.38-81.71,16.03-111.68-1.37-201.91-94.29-200.13-205.96,1.76-110.26,92-199.41,202.67-199.41h202.69V407.41l-115-102.18c-3.72-3.31-9.42-2.66-12.42,1.31-18.46,24.44-48.53,39.64-81.93,37.34-46.33-3.2-83.87-40.5-87.34-86.81-4.15-55.24,39.63-101.52,94-101.52,49.18,0,89.68,37.85,93.91,85.95,.38,4.28,2.31,8.27,5.52,11.12l29.95,26.55c3.4,3.01,8.79,1.17,9.63-3.3,2.16-11.55,2.92-23.58,2.07-35.92-4.82-70.34-61.8-126.93-132.17-131.26-80.68-4.97-148.13,58.14-150.27,137.25-2.09,77.1,61.08,143.56,138.19,145.26,32.19,.71,62.03-9.41,86.14-26.95l150.26,133.2c6.44,5.71,16.61,1.14,16.61-7.47V9.48C499.66,4.25,495.42,0,490.18,0H249.83Z"
|
|
171
|
+
/>
|
|
172
|
+
</svg>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
117
175
|
function getSearchPageTitle(searchQuery) {
|
|
118
176
|
return searchQuery
|
|
119
177
|
? translate(
|
|
@@ -361,36 +419,23 @@ function SearchPageContent() {
|
|
|
361
419
|
documentsFoundPlural(searchResultState.totalResults)}
|
|
362
420
|
</div>
|
|
363
421
|
|
|
364
|
-
<div
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
422
|
+
<div className={clsx('col', 'col--4', styles.searchLogoColumn)}>
|
|
423
|
+
<span>
|
|
424
|
+
{translate({
|
|
425
|
+
id: 'theme.SearchPage.algoliaLabel',
|
|
426
|
+
message: 'Powered by',
|
|
427
|
+
description:
|
|
428
|
+
'The text explain that the search powered by Algolia',
|
|
429
|
+
})}
|
|
430
|
+
</span>
|
|
371
431
|
<Link
|
|
372
432
|
to="https://www.algolia.com/"
|
|
373
433
|
aria-label={translate({
|
|
374
434
|
id: 'theme.SearchPage.algoliaLabel',
|
|
375
|
-
message: '
|
|
376
|
-
description: 'The
|
|
435
|
+
message: 'Powered by Algolia',
|
|
436
|
+
description: 'The description label for Algolia mention',
|
|
377
437
|
})}>
|
|
378
|
-
<
|
|
379
|
-
<g fill="none">
|
|
380
|
-
<path
|
|
381
|
-
className={styles.algoliaLogoPathFill}
|
|
382
|
-
d="M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"
|
|
383
|
-
/>
|
|
384
|
-
<path
|
|
385
|
-
fill="#5468FF"
|
|
386
|
-
d="M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"
|
|
387
|
-
/>
|
|
388
|
-
<path
|
|
389
|
-
fill="white"
|
|
390
|
-
d="M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"
|
|
391
|
-
/>
|
|
392
|
-
</g>
|
|
393
|
-
</svg>
|
|
438
|
+
<AlgoliaLogo />
|
|
394
439
|
</Link>
|
|
395
440
|
</div>
|
|
396
441
|
</div>
|
|
@@ -33,12 +33,20 @@
|
|
|
33
33
|
font-weight: bold;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.
|
|
37
|
-
|
|
36
|
+
.searchLogoColumn {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 0.5rem;
|
|
40
|
+
justify-content: flex-end;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
.
|
|
41
|
-
|
|
43
|
+
.searchLogoColumn a {
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.searchLogoColumn span {
|
|
48
|
+
color: var(--docsearch-muted-color);
|
|
49
|
+
font-weight: normal;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
.searchResultItem {
|
|
@@ -7,5 +7,52 @@
|
|
|
7
7
|
import type { DocSearchTranslations } from '@docsearch/react';
|
|
8
8
|
declare const translations: DocSearchTranslations & {
|
|
9
9
|
placeholder: string;
|
|
10
|
+
modal: {
|
|
11
|
+
searchBox: {
|
|
12
|
+
placeholderText: string;
|
|
13
|
+
placeholderTextAskAi: string;
|
|
14
|
+
placeholderTextAskAiStreaming: string;
|
|
15
|
+
enterKeyHintAskAi: string;
|
|
16
|
+
searchInputLabel: string;
|
|
17
|
+
backToKeywordSearchButtonText: string;
|
|
18
|
+
backToKeywordSearchButtonAriaLabel: string;
|
|
19
|
+
enterKeyHint: string;
|
|
20
|
+
clearButtonTitle: string;
|
|
21
|
+
clearButtonAriaLabel: string;
|
|
22
|
+
closeButtonText: string;
|
|
23
|
+
resetButtonTitle: string;
|
|
24
|
+
resetButtonAriaLabel: string;
|
|
25
|
+
cancelButtonText: string;
|
|
26
|
+
cancelButtonAriaLabel: string;
|
|
27
|
+
closeButtonAriaLabel: string;
|
|
28
|
+
};
|
|
29
|
+
startScreen: {
|
|
30
|
+
recentConversationsTitle: string;
|
|
31
|
+
removeRecentConversationButtonTitle: string;
|
|
32
|
+
};
|
|
33
|
+
resultsScreen: {
|
|
34
|
+
askAiPlaceholder: string;
|
|
35
|
+
};
|
|
36
|
+
askAiScreen: {
|
|
37
|
+
disclaimerText: string;
|
|
38
|
+
relatedSourcesText: string;
|
|
39
|
+
thinkingText: string;
|
|
40
|
+
copyButtonText: string;
|
|
41
|
+
copyButtonCopiedText: string;
|
|
42
|
+
copyButtonTitle: string;
|
|
43
|
+
likeButtonTitle: string;
|
|
44
|
+
dislikeButtonTitle: string;
|
|
45
|
+
thanksForFeedbackText: string;
|
|
46
|
+
preToolCallText: string;
|
|
47
|
+
duringToolCallText: string;
|
|
48
|
+
afterToolCallText: string;
|
|
49
|
+
};
|
|
50
|
+
footer: {
|
|
51
|
+
submitQuestionText: string;
|
|
52
|
+
poweredByText: string;
|
|
53
|
+
backToSearchText: string;
|
|
54
|
+
searchByText: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
10
57
|
};
|
|
11
58
|
export default translations;
|