@docusaurus/theme-search-algolia 3.10.1-canary-6655 → 3.10.2
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 +0 -1
- package/lib/client/index.js +0 -1
- package/lib/theme/SearchBar/index.js +6 -8
- package/lib/theme/SearchPage/index.js +4 -2
- package/lib/theme/SearchPage/styles.module.css +2 -2
- package/package.json +19 -19
- package/src/client/index.ts +0 -1
- package/src/theme/SearchBar/index.tsx +6 -9
- package/src/theme/SearchPage/index.tsx +4 -2
- package/src/theme/SearchPage/styles.module.css +2 -2
- package/lib/client/searchPage.d.ts +0 -14
- package/lib/client/searchPage.js +0 -29
- package/src/client/searchPage.ts +0 -43
package/lib/client/index.d.ts
CHANGED
|
@@ -8,5 +8,4 @@ export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
|
8
8
|
export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
|
|
9
9
|
export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
|
|
10
10
|
export { useAlgoliaAskAi } from './useAlgoliaAskAi';
|
|
11
|
-
export { useSearchQueryString, useSearchLinkCreator } from './searchPage';
|
|
12
11
|
export { mergeFacetFilters } from './utils';
|
package/lib/client/index.js
CHANGED
|
@@ -8,5 +8,4 @@ export { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
|
8
8
|
export { useAlgoliaContextualFacetFilters, useAlgoliaContextualFacetFiltersIfEnabled, } from './useAlgoliaContextualFacetFilters';
|
|
9
9
|
export { useSearchResultUrlProcessor } from './useSearchResultUrlProcessor';
|
|
10
10
|
export { useAlgoliaAskAi } from './useAlgoliaAskAi';
|
|
11
|
-
export { useSearchQueryString, useSearchLinkCreator } from './searchPage';
|
|
12
11
|
export { mergeFacetFilters } from './utils';
|
|
@@ -11,13 +11,15 @@ import {useDocSearchKeyboardEvents} from '@docsearch/react/useDocSearchKeyboardE
|
|
|
11
11
|
import Head from '@docusaurus/Head';
|
|
12
12
|
import Link from '@docusaurus/Link';
|
|
13
13
|
import {useHistory} from '@docusaurus/router';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
isRegexpStringMatch,
|
|
16
|
+
useSearchLinkCreator,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
15
18
|
import {
|
|
16
19
|
useAlgoliaContextualFacetFilters,
|
|
17
20
|
useSearchResultUrlProcessor,
|
|
18
21
|
useAlgoliaAskAi,
|
|
19
22
|
mergeFacetFilters,
|
|
20
|
-
useSearchLinkCreator,
|
|
21
23
|
} from '@docusaurus/theme-search-algolia/client';
|
|
22
24
|
import Translate from '@docusaurus/Translate';
|
|
23
25
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
@@ -82,8 +84,8 @@ function useTransformItems(props) {
|
|
|
82
84
|
function useResultsFooterComponent({closeModal}) {
|
|
83
85
|
return useMemo(
|
|
84
86
|
() =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
({state}) =>
|
|
88
|
+
<ResultsFooter state={state} onClose={closeModal} />,
|
|
87
89
|
[closeModal],
|
|
88
90
|
);
|
|
89
91
|
}
|
|
@@ -191,8 +193,6 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
191
193
|
|
|
192
194
|
{isOpen &&
|
|
193
195
|
DocSearchModal &&
|
|
194
|
-
// TODO fix this
|
|
195
|
-
// eslint-disable-next-line react-hooks/refs
|
|
196
196
|
searchContainer.current &&
|
|
197
197
|
createPortal(
|
|
198
198
|
<DocSearchModal
|
|
@@ -212,8 +212,6 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
212
212
|
searchParameters={searchParameters}
|
|
213
213
|
{...extraAskAiProps}
|
|
214
214
|
/>,
|
|
215
|
-
// TODO fix this
|
|
216
|
-
// eslint-disable-next-line react-hooks/refs
|
|
217
215
|
searchContainer.current,
|
|
218
216
|
)}
|
|
219
217
|
</>
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
PageMetadata,
|
|
19
19
|
useEvent,
|
|
20
20
|
usePluralForm,
|
|
21
|
+
useSearchQueryString,
|
|
21
22
|
} from '@docusaurus/theme-common';
|
|
22
23
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
23
24
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
24
25
|
import {
|
|
25
26
|
useAlgoliaThemeConfig,
|
|
26
27
|
useSearchResultUrlProcessor,
|
|
27
|
-
useSearchQueryString,
|
|
28
28
|
} from '@docusaurus/theme-search-algolia/client';
|
|
29
29
|
import Layout from '@theme/Layout';
|
|
30
30
|
import Heading from '@theme/Heading';
|
|
@@ -309,7 +309,7 @@ function SearchPageContent() {
|
|
|
309
309
|
ExecutionEnvironment.canUseIntersectionObserver &&
|
|
310
310
|
new IntersectionObserver(
|
|
311
311
|
// TODO need to fix this React Compiler lint error
|
|
312
|
-
// eslint-disable-next-line react-
|
|
312
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
313
313
|
(entries) => {
|
|
314
314
|
const {
|
|
315
315
|
isIntersecting,
|
|
@@ -461,6 +461,7 @@ function SearchPageContent() {
|
|
|
461
461
|
key={index}
|
|
462
462
|
className="breadcrumbs__item"
|
|
463
463
|
// Developer provided the HTML, so assume it's safe.
|
|
464
|
+
// eslint-disable-next-line react/no-danger
|
|
464
465
|
dangerouslySetInnerHTML={{__html: html}}
|
|
465
466
|
/>
|
|
466
467
|
))}
|
|
@@ -472,6 +473,7 @@ function SearchPageContent() {
|
|
|
472
473
|
<p
|
|
473
474
|
className={styles.searchResultItemSummary}
|
|
474
475
|
// Developer provided the HTML, so assume it's safe.
|
|
476
|
+
// eslint-disable-next-line react/no-danger
|
|
475
477
|
dangerouslySetInnerHTML={{__html: summary}}
|
|
476
478
|
/>
|
|
477
479
|
)}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
font-style: italic;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
@media only screen and (width
|
|
73
|
+
@media only screen and (max-width: 996px) {
|
|
74
74
|
.searchQueryColumn {
|
|
75
75
|
max-width: 60% !important;
|
|
76
76
|
}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
@media screen and (width
|
|
92
|
+
@media screen and (max-width: 576px) {
|
|
93
93
|
.searchQueryColumn {
|
|
94
94
|
max-width: 100% !important;
|
|
95
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-search-algolia",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"description": "Algolia search component for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": [
|
|
@@ -27,39 +27,39 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js &&
|
|
30
|
+
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
|
|
31
31
|
"watch": "run-p -c copy:watch build:watch",
|
|
32
32
|
"build:watch": "tsc --build --watch",
|
|
33
33
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@algolia/autocomplete-core": "^1.19.
|
|
37
|
-
"@docsearch/react": "^4.
|
|
38
|
-
"@docusaurus/core": "3.10.
|
|
39
|
-
"@docusaurus/logger": "3.10.
|
|
40
|
-
"@docusaurus/plugin-content-docs": "3.10.
|
|
41
|
-
"@docusaurus/theme-common": "3.10.
|
|
42
|
-
"@docusaurus/theme-translations": "3.10.
|
|
43
|
-
"@docusaurus/utils": "3.10.
|
|
44
|
-
"@docusaurus/utils-validation": "3.10.
|
|
45
|
-
"algoliasearch": "^5.
|
|
46
|
-
"algoliasearch-helper": "^3.
|
|
36
|
+
"@algolia/autocomplete-core": "^1.19.2",
|
|
37
|
+
"@docsearch/react": "^3.9.0 || ^4.3.2",
|
|
38
|
+
"@docusaurus/core": "3.10.2",
|
|
39
|
+
"@docusaurus/logger": "3.10.2",
|
|
40
|
+
"@docusaurus/plugin-content-docs": "3.10.2",
|
|
41
|
+
"@docusaurus/theme-common": "3.10.2",
|
|
42
|
+
"@docusaurus/theme-translations": "3.10.2",
|
|
43
|
+
"@docusaurus/utils": "3.10.2",
|
|
44
|
+
"@docusaurus/utils-validation": "3.10.2",
|
|
45
|
+
"algoliasearch": "^5.37.0",
|
|
46
|
+
"algoliasearch-helper": "^3.26.0",
|
|
47
47
|
"clsx": "^2.0.0",
|
|
48
48
|
"eta": "^2.2.0",
|
|
49
|
-
"fs-extra": "^11.
|
|
49
|
+
"fs-extra": "^11.1.1",
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
51
|
"tslib": "^2.6.0",
|
|
52
52
|
"utility-types": "^3.10.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@docusaurus/module-type-aliases": "3.10.
|
|
55
|
+
"@docusaurus/module-type-aliases": "3.10.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"react": "^19.
|
|
59
|
-
"react-dom": "^19.
|
|
58
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
59
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
62
|
+
"node": ">=20.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "f37f9035584917a97a260b91fc2842cba4f8b94f"
|
|
65
65
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -12,5 +12,4 @@ export {
|
|
|
12
12
|
} from './useAlgoliaContextualFacetFilters';
|
|
13
13
|
export {useSearchResultUrlProcessor} from './useSearchResultUrlProcessor';
|
|
14
14
|
export {useAlgoliaAskAi} from './useAlgoliaAskAi';
|
|
15
|
-
export {useSearchQueryString, useSearchLinkCreator} from './searchPage';
|
|
16
15
|
export {mergeFacetFilters} from './utils';
|
|
@@ -18,13 +18,15 @@ import {useDocSearchKeyboardEvents} from '@docsearch/react/useDocSearchKeyboardE
|
|
|
18
18
|
import Head from '@docusaurus/Head';
|
|
19
19
|
import Link from '@docusaurus/Link';
|
|
20
20
|
import {useHistory} from '@docusaurus/router';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
isRegexpStringMatch,
|
|
23
|
+
useSearchLinkCreator,
|
|
24
|
+
} from '@docusaurus/theme-common';
|
|
22
25
|
import {
|
|
23
26
|
useAlgoliaContextualFacetFilters,
|
|
24
27
|
useSearchResultUrlProcessor,
|
|
25
28
|
useAlgoliaAskAi,
|
|
26
29
|
mergeFacetFilters,
|
|
27
|
-
useSearchLinkCreator,
|
|
28
30
|
} from '@docusaurus/theme-search-algolia/client';
|
|
29
31
|
import Translate from '@docusaurus/Translate';
|
|
30
32
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
@@ -138,8 +140,8 @@ function useResultsFooterComponent({
|
|
|
138
140
|
}): DocSearchProps['resultsFooterComponent'] {
|
|
139
141
|
return useMemo(
|
|
140
142
|
() =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
({state}) =>
|
|
144
|
+
<ResultsFooter state={state} onClose={closeModal} />,
|
|
143
145
|
[closeModal],
|
|
144
146
|
);
|
|
145
147
|
}
|
|
@@ -285,8 +287,6 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) {
|
|
|
285
287
|
|
|
286
288
|
{isOpen &&
|
|
287
289
|
DocSearchModal &&
|
|
288
|
-
// TODO fix this
|
|
289
|
-
// eslint-disable-next-line react-hooks/refs
|
|
290
290
|
searchContainer.current &&
|
|
291
291
|
createPortal(
|
|
292
292
|
<DocSearchModal
|
|
@@ -306,9 +306,6 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) {
|
|
|
306
306
|
searchParameters={searchParameters}
|
|
307
307
|
{...extraAskAiProps}
|
|
308
308
|
/>,
|
|
309
|
-
|
|
310
|
-
// TODO fix this
|
|
311
|
-
// eslint-disable-next-line react-hooks/refs
|
|
312
309
|
searchContainer.current,
|
|
313
310
|
)}
|
|
314
311
|
</>
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
PageMetadata,
|
|
29
29
|
useEvent,
|
|
30
30
|
usePluralForm,
|
|
31
|
+
useSearchQueryString,
|
|
31
32
|
} from '@docusaurus/theme-common';
|
|
32
33
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
33
34
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
34
35
|
import {
|
|
35
36
|
useAlgoliaThemeConfig,
|
|
36
37
|
useSearchResultUrlProcessor,
|
|
37
|
-
useSearchQueryString,
|
|
38
38
|
} from '@docusaurus/theme-search-algolia/client';
|
|
39
39
|
import Layout from '@theme/Layout';
|
|
40
40
|
import Heading from '@theme/Heading';
|
|
@@ -372,7 +372,7 @@ function SearchPageContent(): ReactNode {
|
|
|
372
372
|
ExecutionEnvironment.canUseIntersectionObserver &&
|
|
373
373
|
new IntersectionObserver(
|
|
374
374
|
// TODO need to fix this React Compiler lint error
|
|
375
|
-
// eslint-disable-next-line react-
|
|
375
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
376
376
|
(entries) => {
|
|
377
377
|
const {
|
|
378
378
|
isIntersecting,
|
|
@@ -536,6 +536,7 @@ function SearchPageContent(): ReactNode {
|
|
|
536
536
|
key={index}
|
|
537
537
|
className="breadcrumbs__item"
|
|
538
538
|
// Developer provided the HTML, so assume it's safe.
|
|
539
|
+
// eslint-disable-next-line react/no-danger
|
|
539
540
|
dangerouslySetInnerHTML={{__html: html}}
|
|
540
541
|
/>
|
|
541
542
|
))}
|
|
@@ -547,6 +548,7 @@ function SearchPageContent(): ReactNode {
|
|
|
547
548
|
<p
|
|
548
549
|
className={styles.searchResultItemSummary}
|
|
549
550
|
// Developer provided the HTML, so assume it's safe.
|
|
551
|
+
// eslint-disable-next-line react/no-danger
|
|
550
552
|
dangerouslySetInnerHTML={{__html: summary}}
|
|
551
553
|
/>
|
|
552
554
|
)}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
font-style: italic;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
@media only screen and (width
|
|
73
|
+
@media only screen and (max-width: 996px) {
|
|
74
74
|
.searchQueryColumn {
|
|
75
75
|
max-width: 60% !important;
|
|
76
76
|
}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
@media screen and (width
|
|
92
|
+
@media screen and (max-width: 576px) {
|
|
93
93
|
.searchQueryColumn {
|
|
94
94
|
max-width: 100% !important;
|
|
95
95
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
/**
|
|
8
|
-
* Permits to read/write the current search query string
|
|
9
|
-
*/
|
|
10
|
-
export declare function useSearchQueryString(): [string, (newValue: string) => void];
|
|
11
|
-
/**
|
|
12
|
-
* Permits to create links to the search page with the appropriate query string
|
|
13
|
-
*/
|
|
14
|
-
export declare function useSearchLinkCreator(): (searchValue: string) => string;
|
package/lib/client/searchPage.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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 } from 'react';
|
|
8
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
-
import { useQueryString } from '@docusaurus/theme-common';
|
|
10
|
-
import { useAlgoliaThemeConfig } from './useAlgoliaThemeConfig';
|
|
11
|
-
const SEARCH_PARAM_QUERY = 'q';
|
|
12
|
-
/**
|
|
13
|
-
* Permits to read/write the current search query string
|
|
14
|
-
*/
|
|
15
|
-
export function useSearchQueryString() {
|
|
16
|
-
return useQueryString(SEARCH_PARAM_QUERY);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Permits to create links to the search page with the appropriate query string
|
|
20
|
-
*/
|
|
21
|
-
export function useSearchLinkCreator() {
|
|
22
|
-
const { siteConfig: { baseUrl }, } = useDocusaurusContext();
|
|
23
|
-
const { algolia: { searchPagePath }, } = useAlgoliaThemeConfig();
|
|
24
|
-
return useCallback(function createSearchLink(searchValue) {
|
|
25
|
-
// Refer to https://github.com/facebook/docusaurus/pull/2838
|
|
26
|
-
// Note: if searchPagePath is falsy, useSearchPage() will not be called
|
|
27
|
-
return `${baseUrl}${searchPagePath}?${SEARCH_PARAM_QUERY}=${encodeURIComponent(searchValue)}`;
|
|
28
|
-
}, [baseUrl, searchPagePath]);
|
|
29
|
-
}
|
package/src/client/searchPage.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
import {useCallback} from 'react';
|
|
9
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
|
-
import {useQueryString} from '@docusaurus/theme-common';
|
|
11
|
-
import {useAlgoliaThemeConfig} from './useAlgoliaThemeConfig';
|
|
12
|
-
|
|
13
|
-
const SEARCH_PARAM_QUERY = 'q';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Permits to read/write the current search query string
|
|
17
|
-
*/
|
|
18
|
-
export function useSearchQueryString(): [string, (newValue: string) => void] {
|
|
19
|
-
return useQueryString(SEARCH_PARAM_QUERY);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Permits to create links to the search page with the appropriate query string
|
|
24
|
-
*/
|
|
25
|
-
export function useSearchLinkCreator(): (searchValue: string) => string {
|
|
26
|
-
const {
|
|
27
|
-
siteConfig: {baseUrl},
|
|
28
|
-
} = useDocusaurusContext();
|
|
29
|
-
const {
|
|
30
|
-
algolia: {searchPagePath},
|
|
31
|
-
} = useAlgoliaThemeConfig();
|
|
32
|
-
|
|
33
|
-
return useCallback(
|
|
34
|
-
function createSearchLink(searchValue: string) {
|
|
35
|
-
// Refer to https://github.com/facebook/docusaurus/pull/2838
|
|
36
|
-
// Note: if searchPagePath is falsy, useSearchPage() will not be called
|
|
37
|
-
return `${baseUrl}${
|
|
38
|
-
searchPagePath as string
|
|
39
|
-
}?${SEARCH_PARAM_QUERY}=${encodeURIComponent(searchValue)}`;
|
|
40
|
-
},
|
|
41
|
-
[baseUrl, searchPagePath],
|
|
42
|
-
);
|
|
43
|
-
}
|