@docusaurus/theme-search-algolia 0.0.0-4511 → 0.0.0-4518

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.
@@ -4,7 +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
- /* eslint-disable @typescript-eslint/ban-ts-comment */
8
7
  import React, { useState, useRef, useCallback, useMemo } from 'react';
9
8
  import { createPortal } from 'react-dom';
10
9
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
@@ -59,9 +58,7 @@ function DocSearch({ contextualSearch, externalUrlRegex, ...props }) {
59
58
  return Promise.resolve();
60
59
  }
61
60
  return Promise.all([
62
- // @ts-ignore
63
61
  import('@docsearch/react/modal'),
64
- // @ts-ignore
65
62
  import('@docsearch/react/style'),
66
63
  import('./styles.css'),
67
64
  ]).then(([{ DocSearchModal: Modal }]) => {
@@ -152,7 +149,6 @@ function DocSearch({ contextualSearch, externalUrlRegex, ...props }) {
152
149
  }
153
150
  function SearchBar() {
154
151
  const { siteConfig } = useDocusaurusContext();
155
- // @ts-ignore
156
152
  return <DocSearch {...siteConfig.themeConfig.algolia}/>;
157
153
  }
158
154
  export default SearchBar;
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  /* eslint-disable jsx-a11y/no-autofocus */
8
- /* eslint-disable @typescript-eslint/ban-ts-comment */
9
8
  import React, { useEffect, useState, useReducer, useRef } from 'react';
10
9
  import algoliaSearch from 'algoliasearch/lite';
11
10
  import algoliaSearchHelper from 'algoliasearch-helper';
@@ -61,9 +60,8 @@ function SearchVersionSelectList({ docsSearchVersionsHelpers, }) {
61
60
  </div>);
62
61
  }
63
62
  function SearchPage() {
64
- const { siteConfig: { themeConfig: {
65
- // @ts-ignore
66
- algolia: { appId, apiKey, indexName, externalUrlRegex }, }, }, i18n: { currentLocale }, } = useDocusaurusContext();
63
+ const { siteConfig: { themeConfig }, i18n: { currentLocale }, } = useDocusaurusContext();
64
+ const { algolia: { appId, apiKey, indexName, externalUrlRegex }, } = themeConfig;
67
65
  const documentsFoundPlural = useDocumentsFoundPlural();
68
66
  const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
69
67
  const { searchQuery, setSearchQuery } = useSearchPage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "0.0.0-4511",
3
+ "version": "0.0.0-4518",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@docsearch/react": "^3.0.0-alpha.39",
28
- "@docusaurus/core": "0.0.0-4511",
29
- "@docusaurus/logger": "0.0.0-4511",
30
- "@docusaurus/theme-common": "0.0.0-4511",
31
- "@docusaurus/theme-translations": "0.0.0-4511",
32
- "@docusaurus/utils": "0.0.0-4511",
33
- "@docusaurus/utils-validation": "0.0.0-4511",
28
+ "@docusaurus/core": "0.0.0-4518",
29
+ "@docusaurus/logger": "0.0.0-4518",
30
+ "@docusaurus/theme-common": "0.0.0-4518",
31
+ "@docusaurus/theme-translations": "0.0.0-4518",
32
+ "@docusaurus/utils": "0.0.0-4518",
33
+ "@docusaurus/utils-validation": "0.0.0-4518",
34
34
  "algoliasearch": "^4.10.5",
35
35
  "algoliasearch-helper": "^3.5.5",
36
36
  "clsx": "^1.1.1",
@@ -40,7 +40,7 @@
40
40
  "utility-types": "^3.10.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@docusaurus/module-type-aliases": "0.0.0-4511",
43
+ "@docusaurus/module-type-aliases": "0.0.0-4518",
44
44
  "fs-extra": "^10.0.0"
45
45
  },
46
46
  "peerDependencies": {
@@ -53,5 +53,5 @@
53
53
  "engines": {
54
54
  "node": ">=14"
55
55
  },
56
- "gitHead": "9188df1b5a9380116d19b5dc907f754500686284"
56
+ "gitHead": "734bca0f3ea8d04fa3b908d56ea0fb159ab47ab3"
57
57
  }
package/src/deps.d.ts ADDED
@@ -0,0 +1,10 @@
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
+ declare module '@docsearch/react/modal';
9
+
10
+ declare module '@docsearch/react/style';
@@ -4,7 +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
- /* eslint-disable @typescript-eslint/ban-ts-comment */
8
7
 
9
8
  import React, {useState, useRef, useCallback, useMemo} from 'react';
10
9
  import {createPortal} from 'react-dom';
@@ -120,9 +119,7 @@ function DocSearch({
120
119
  }
121
120
 
122
121
  return Promise.all([
123
- // @ts-ignore
124
122
  import('@docsearch/react/modal'),
125
- // @ts-ignore
126
123
  import('@docsearch/react/style'),
127
124
  import('./styles.css'),
128
125
  ]).then(([{DocSearchModal: Modal}]) => {
@@ -271,8 +268,7 @@ function DocSearch({
271
268
 
272
269
  function SearchBar(): JSX.Element {
273
270
  const {siteConfig} = useDocusaurusContext();
274
- // @ts-ignore
275
- return <DocSearch {...siteConfig.themeConfig.algolia} />;
271
+ return <DocSearch {...(siteConfig.themeConfig.algolia as DocSearchProps)} />;
276
272
  }
277
273
 
278
274
  export default SearchBar;
@@ -6,7 +6,6 @@
6
6
  */
7
7
 
8
8
  /* eslint-disable jsx-a11y/no-autofocus */
9
- /* eslint-disable @typescript-eslint/ban-ts-comment */
10
9
 
11
10
  import React, {useEffect, useState, useReducer, useRef} from 'react';
12
11
 
@@ -29,6 +28,7 @@ import {useAllDocsData} from '@docusaurus/plugin-content-docs/client';
29
28
  import Layout from '@theme/Layout';
30
29
  import Translate, {translate} from '@docusaurus/Translate';
31
30
  import styles from './styles.module.css';
31
+ import type {ThemeConfig} from '@docusaurus/theme-search-algolia';
32
32
 
33
33
  // Very simple pluralization: probably good enough for now
34
34
  function useDocumentsFoundPlural() {
@@ -151,14 +151,12 @@ type ResultDispatcher =
151
151
 
152
152
  function SearchPage(): JSX.Element {
153
153
  const {
154
- siteConfig: {
155
- themeConfig: {
156
- // @ts-ignore
157
- algolia: {appId, apiKey, indexName, externalUrlRegex},
158
- },
159
- },
154
+ siteConfig: {themeConfig},
160
155
  i18n: {currentLocale},
161
156
  } = useDocusaurusContext();
157
+ const {
158
+ algolia: {appId, apiKey, indexName, externalUrlRegex},
159
+ } = themeConfig as ThemeConfig;
162
160
  const documentsFoundPlural = useDocumentsFoundPlural();
163
161
 
164
162
  const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();