@docusaurus/theme-search-algolia 2.0.0-beta.18 → 2.0.0-beta.19

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.
@@ -8,7 +8,7 @@ import {useContextualSearchFilters} from '@docusaurus/theme-common';
8
8
  // Translate search-engine agnostic search filters to Algolia search filters
9
9
  export function useAlgoliaContextualFacetFilters() {
10
10
  const {locale, tags} = useContextualSearchFilters();
11
- // seems safe to convert locale->language, see AlgoliaSearchMetadata comment
11
+ // Seems safe to convert locale->language, see AlgoliaSearchMetadata comment
12
12
  const languageFilter = `language:${locale}`;
13
13
  const tagsFilter = tags.map((tag) => `docusaurus_tag:${tag}`);
14
14
  return [languageFilter, tagsFilter];
@@ -15,7 +15,6 @@ import {isRegexpStringMatch, useSearchPage} from '@docusaurus/theme-common';
15
15
  import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
16
16
  import {useAlgoliaContextualFacetFilters} from '@docusaurus/theme-search-algolia/client';
17
17
  import Translate, {translate} from '@docusaurus/Translate';
18
- import styles from './styles.module.css';
19
18
  let DocSearchModal = null;
20
19
  function Hit({hit, children}) {
21
20
  return <Link to={hit.url}>{children}</Link>;
@@ -45,7 +44,7 @@ function DocSearch({contextualSearch, externalUrlRegex, ...props}) {
45
44
  mergeFacetFilters(contextualSearchFacetFilters, configFacetFilters)
46
45
  : // ... or use config facetFilters
47
46
  configFacetFilters;
48
- // we let user override default searchParameters if he wants to
47
+ // We let user override default searchParameters if she wants to
49
48
  const searchParameters = {
50
49
  ...props.searchParameters,
51
50
  facetFilters,
@@ -159,19 +158,17 @@ function DocSearch({contextualSearch, externalUrlRegex, ...props}) {
159
158
  />
160
159
  </Head>
161
160
 
162
- <div className={styles.searchBox}>
163
- <DocSearchButton
164
- onTouchStart={importDocSearchModalIfNeeded}
165
- onFocus={importDocSearchModalIfNeeded}
166
- onMouseOver={importDocSearchModalIfNeeded}
167
- onClick={onOpen}
168
- ref={searchButtonRef}
169
- translations={{
170
- buttonText: translatedSearchLabel,
171
- buttonAriaLabel: translatedSearchLabel,
172
- }}
173
- />
174
- </div>
161
+ <DocSearchButton
162
+ onTouchStart={importDocSearchModalIfNeeded}
163
+ onFocus={importDocSearchModalIfNeeded}
164
+ onMouseOver={importDocSearchModalIfNeeded}
165
+ onClick={onOpen}
166
+ ref={searchButtonRef}
167
+ translations={{
168
+ buttonText: translatedSearchLabel,
169
+ buttonAriaLabel: translatedSearchLabel,
170
+ }}
171
+ />
175
172
 
176
173
  {isOpen &&
177
174
  DocSearchModal &&
@@ -9,7 +9,7 @@ Object.defineProperty(exports, '__esModule', {value: true});
9
9
  exports.validateThemeConfig = exports.Schema = exports.DEFAULT_CONFIG = void 0;
10
10
  const utils_validation_1 = require('@docusaurus/utils-validation');
11
11
  exports.DEFAULT_CONFIG = {
12
- // enabled by default, as it makes sense in most cases
12
+ // Enabled by default, as it makes sense in most cases
13
13
  // see also https://github.com/facebook/docusaurus/issues/5880
14
14
  contextualSearch: true,
15
15
  searchParameters: {},
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
6
9
  "exports": {
7
10
  "./client": "./lib/client/index.js",
8
11
  ".": "./lib/index.js"
@@ -26,24 +29,24 @@
26
29
  },
27
30
  "dependencies": {
28
31
  "@docsearch/react": "^3.0.0",
29
- "@docusaurus/core": "2.0.0-beta.18",
30
- "@docusaurus/logger": "2.0.0-beta.18",
31
- "@docusaurus/plugin-content-docs": "2.0.0-beta.18",
32
- "@docusaurus/theme-common": "2.0.0-beta.18",
33
- "@docusaurus/theme-translations": "2.0.0-beta.18",
34
- "@docusaurus/utils": "2.0.0-beta.18",
35
- "@docusaurus/utils-validation": "2.0.0-beta.18",
32
+ "@docusaurus/core": "2.0.0-beta.19",
33
+ "@docusaurus/logger": "2.0.0-beta.19",
34
+ "@docusaurus/plugin-content-docs": "2.0.0-beta.19",
35
+ "@docusaurus/theme-common": "2.0.0-beta.19",
36
+ "@docusaurus/theme-translations": "2.0.0-beta.19",
37
+ "@docusaurus/utils": "2.0.0-beta.19",
38
+ "@docusaurus/utils-validation": "2.0.0-beta.19",
36
39
  "algoliasearch": "^4.13.0",
37
- "algoliasearch-helper": "^3.7.4",
40
+ "algoliasearch-helper": "^3.8.2",
38
41
  "clsx": "^1.1.1",
39
42
  "eta": "^1.12.3",
40
- "fs-extra": "^10.0.1",
43
+ "fs-extra": "^10.1.0",
41
44
  "lodash": "^4.17.21",
42
- "tslib": "^2.3.1",
45
+ "tslib": "^2.4.0",
43
46
  "utility-types": "^3.10.0"
44
47
  },
45
48
  "devDependencies": {
46
- "@docusaurus/module-type-aliases": "2.0.0-beta.18"
49
+ "@docusaurus/module-type-aliases": "2.0.0-beta.19"
47
50
  },
48
51
  "peerDependencies": {
49
52
  "react": "^16.8.4 || ^17.0.0",
@@ -52,5 +55,5 @@
52
55
  "engines": {
53
56
  "node": ">=14"
54
57
  },
55
- "gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
58
+ "gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
56
59
  }
@@ -11,7 +11,7 @@ import {useContextualSearchFilters} from '@docusaurus/theme-common';
11
11
  export function useAlgoliaContextualFacetFilters(): [string, string[]] {
12
12
  const {locale, tags} = useContextualSearchFilters();
13
13
 
14
- // seems safe to convert locale->language, see AlgoliaSearchMetadata comment
14
+ // Seems safe to convert locale->language, see AlgoliaSearchMetadata comment
15
15
  const languageFilter = `language:${locale}`;
16
16
 
17
17
  const tagsFilter = tags.map((tag) => `docusaurus_tag:${tag}`);
@@ -14,9 +14,9 @@ import Link from '@docusaurus/Link';
14
14
  import Head from '@docusaurus/Head';
15
15
  import {isRegexpStringMatch, useSearchPage} from '@docusaurus/theme-common';
16
16
  import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
17
+ import type {SearchClient} from 'algoliasearch/lite';
17
18
  import {useAlgoliaContextualFacetFilters} from '@docusaurus/theme-search-algolia/client';
18
19
  import Translate, {translate} from '@docusaurus/Translate';
19
- import styles from './styles.module.css';
20
20
 
21
21
  import type {
22
22
  DocSearchModal as DocSearchModalType,
@@ -99,7 +99,7 @@ function DocSearch({
99
99
  : // ... or use config facetFilters
100
100
  configFacetFilters;
101
101
 
102
- // we let user override default searchParameters if he wants to
102
+ // We let user override default searchParameters if she wants to
103
103
  const searchParameters: DocSearchProps['searchParameters'] = {
104
104
  ...props.searchParameters,
105
105
  facetFilters,
@@ -145,7 +145,7 @@ function DocSearch({
145
145
  }, [setIsOpen]);
146
146
 
147
147
  const onInput = useCallback(
148
- (event) => {
148
+ (event: KeyboardEvent) => {
149
149
  importDocSearchModalIfNeeded().then(() => {
150
150
  setIsOpen(true);
151
151
  setInitialQuery(event.key);
@@ -194,7 +194,7 @@ function DocSearch({
194
194
  );
195
195
 
196
196
  const transformSearchClient = useCallback(
197
- (searchClient) => {
197
+ (searchClient: SearchClient) => {
198
198
  searchClient.addAlgoliaAgent(
199
199
  'docusaurus',
200
200
  siteMetadata.docusaurusVersion,
@@ -232,19 +232,17 @@ function DocSearch({
232
232
  />
233
233
  </Head>
234
234
 
235
- <div className={styles.searchBox}>
236
- <DocSearchButton
237
- onTouchStart={importDocSearchModalIfNeeded}
238
- onFocus={importDocSearchModalIfNeeded}
239
- onMouseOver={importDocSearchModalIfNeeded}
240
- onClick={onOpen}
241
- ref={searchButtonRef}
242
- translations={{
243
- buttonText: translatedSearchLabel,
244
- buttonAriaLabel: translatedSearchLabel,
245
- }}
246
- />
247
- </div>
235
+ <DocSearchButton
236
+ onTouchStart={importDocSearchModalIfNeeded}
237
+ onFocus={importDocSearchModalIfNeeded}
238
+ onMouseOver={importDocSearchModalIfNeeded}
239
+ onClick={onOpen}
240
+ ref={searchButtonRef}
241
+ translations={{
242
+ buttonText: translatedSearchLabel,
243
+ buttonAriaLabel: translatedSearchLabel,
244
+ }}
245
+ />
248
246
 
249
247
  {isOpen &&
250
248
  DocSearchModal &&
@@ -12,7 +12,7 @@ import type {
12
12
  } from '@docusaurus/types';
13
13
 
14
14
  export const DEFAULT_CONFIG = {
15
- // enabled by default, as it makes sense in most cases
15
+ // Enabled by default, as it makes sense in most cases
16
16
  // see also https://github.com/facebook/docusaurus/issues/5880
17
17
  contextualSearch: true,
18
18
 
@@ -1,20 +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
- @media (max-width: 996px) {
9
- .searchBox {
10
- position: absolute;
11
- right: var(--ifm-navbar-padding-horizontal);
12
- }
13
- }
14
-
15
- @media (min-width: 997px) {
16
- .searchBox {
17
- padding: var(--ifm-navbar-item-padding-vertical)
18
- var(--ifm-navbar-item-padding-horizontal);
19
- }
20
- }
@@ -1,20 +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
- @media (max-width: 996px) {
9
- .searchBox {
10
- position: absolute;
11
- right: var(--ifm-navbar-padding-horizontal);
12
- }
13
- }
14
-
15
- @media (min-width: 997px) {
16
- .searchBox {
17
- padding: var(--ifm-navbar-item-padding-vertical)
18
- var(--ifm-navbar-item-padding-horizontal);
19
- }
20
- }