@rspress/plugin-algolia 2.0.0-beta.3 → 2.0.0-beta.30

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RspressPlugin } from '@rspress/shared';
1
+ import type { RspressPlugin } from '@rspress/core';
2
2
  interface Options {
3
3
  /**
4
4
  * Algolia meta tag for verification
@@ -1,8 +1,37 @@
1
1
  .DocSearch {
2
- --docsearch-searchbox-background: var(--rp-c-bg-mute);
3
2
  align-self: center;
4
3
  }
5
4
 
5
+ html:not(.rp-dark) {
6
+ & [class*="DocSearch"] {
7
+ --docsearch-searchbox-background: var(--rp-c-bg-mute);
8
+ --docsearch-primary-color: var(--rp-c-brand);
9
+ --docsearch-highlight-color: var(--docsearch-primary-color);
10
+ --docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
11
+ }
12
+ }
13
+
14
+ html.rp-dark [class*="DocSearch"] {
15
+ --docsearch-searchbox-background: var(--rp-c-bg-mute);
16
+ --docsearch-primary-color: var(--rp-c-brand);
17
+ --docsearch-highlight-color: var(--docsearch-primary-color);
18
+ --docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
19
+ --docsearch-searchbox-focus-background: var(--rp-c-bg-mute);
20
+ --docsearch-modal-shadow: none;
21
+ --docsearch-footer-shadow: none;
22
+ --docsearch-logo-color: var(--rp-c-text-2);
23
+ --docsearch-hit-background: var(--rp-c-dark-light-1);
24
+ --docsearch-hit-color: var(--rp-c-text-2);
25
+ --docsearch-hit-shadow: none;
26
+ --docsearch-modal-background: var(--rp-c-bg);
27
+ --docsearch-footer-background: var(--rp-c-bg);
28
+ --docsearch-key-gradient: var(--rp-c-bg);
29
+ --docsearch-key-shadow: var(--rp-c-bg-mute);
30
+ --docsearch-text-color: var(--rp-c-text-2);
31
+ --docsearch-muted-color: var(--rp-c-text-2);
32
+ --docsearch-key-pressed-shadow: none;
33
+ }
34
+
6
35
  @media (width <= 768px) {
7
36
  .DocSearch {
8
37
  --docsearch-searchbox-background: transparent;
@@ -1,7 +1,7 @@
1
1
  import type { DocSearchProps } from '@docsearch/react';
2
2
  import '@docsearch/css';
3
3
  import './Search.css';
4
- import type { Locales } from './locales';
4
+ import type { Locales } from './locales.js';
5
5
  type SearchProps = {
6
6
  /**
7
7
  * @link https://docsearch.algolia.com/docs/api
@@ -1,19 +1,19 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
- import * as __WEBPACK_EXTERNAL_MODULE__docsearch_react_bddc4633__ from "@docsearch/react";
3
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
4
- import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { DocSearch } from "@docsearch/react";
3
+ import { useLang, useNavigate } from "@rspress/core/runtime";
4
+ import { Link } from "@theme";
5
5
  import "@docsearch/css";
6
6
  import "./Search.css";
7
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
8
- const Hit = ({ hit, children })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__.Link, {
7
+ import { useEffect } from "react";
8
+ const Hit = ({ hit, children })=>/*#__PURE__*/ jsx(Link, {
9
9
  href: hit.url,
10
10
  children: children
11
11
  });
12
12
  function Search({ locales = {}, docSearchProps }) {
13
- const navigate = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.useNavigate)();
14
- const lang = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.useLang)();
13
+ const navigate = useNavigate();
14
+ const lang = useLang();
15
15
  const { translations, placeholder } = locales?.[lang] ?? {};
16
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
16
+ useEffect(()=>{
17
17
  const preconnect = document.createElement('link');
18
18
  const appId = docSearchProps.appId;
19
19
  preconnect.id = appId;
@@ -27,8 +27,8 @@ function Search({ locales = {}, docSearchProps }) {
27
27
  }, [
28
28
  docSearchProps.appId
29
29
  ]);
30
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
31
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__docsearch_react_bddc4633__.DocSearch, {
30
+ return /*#__PURE__*/ jsx(Fragment, {
31
+ children: /*#__PURE__*/ jsx(DocSearch, {
32
32
  placeholder: placeholder,
33
33
  translations: translations,
34
34
  maxResultsPerGroup: 20,
@@ -1,2 +1,2 @@
1
- export { Search, type SearchProps } from './Search';
2
- export { type Locales, ZH_LOCALES } from './locales';
1
+ export { type Locales, ZH_LOCALES } from './locales.js';
2
+ export { Search, type SearchProps } from './Search.js';
@@ -1,5 +1,3 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__Search_js_267571c1__ from "./Search.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE__locales_js_0c471cb7__ from "./locales.js";
3
- var __webpack_exports__Search = __WEBPACK_EXTERNAL_MODULE__Search_js_267571c1__.Search;
4
- var __webpack_exports__ZH_LOCALES = __WEBPACK_EXTERNAL_MODULE__locales_js_0c471cb7__.ZH_LOCALES;
5
- export { __webpack_exports__Search as Search, __webpack_exports__ZH_LOCALES as ZH_LOCALES };
1
+ import { ZH_LOCALES } from "./locales.js";
2
+ import { Search } from "./Search.js";
3
+ export { Search, ZH_LOCALES };
@@ -1,41 +1,41 @@
1
1
  const ZH_LOCALES = {
2
2
  zh: {
3
- placeholder: '搜索文档',
3
+ placeholder: "\u641C\u7D22\u6587\u6863",
4
4
  translations: {
5
5
  button: {
6
- buttonText: '搜索',
7
- buttonAriaLabel: '搜索'
6
+ buttonText: "\u641C\u7D22",
7
+ buttonAriaLabel: "\u641C\u7D22"
8
8
  },
9
9
  modal: {
10
10
  searchBox: {
11
- resetButtonTitle: '清除查询条件',
12
- resetButtonAriaLabel: '清除查询条件',
13
- cancelButtonText: '取消',
14
- cancelButtonAriaLabel: '取消'
11
+ resetButtonTitle: "\u6E05\u9664\u67E5\u8BE2\u6761\u4EF6",
12
+ resetButtonAriaLabel: "\u6E05\u9664\u67E5\u8BE2\u6761\u4EF6",
13
+ cancelButtonText: "\u53D6\u6D88",
14
+ cancelButtonAriaLabel: "\u53D6\u6D88"
15
15
  },
16
16
  startScreen: {
17
- recentSearchesTitle: '搜索历史',
18
- noRecentSearchesText: '没有搜索历史',
19
- saveRecentSearchButtonTitle: '保存至搜索历史',
20
- removeRecentSearchButtonTitle: '从搜索历史中移除',
21
- favoriteSearchesTitle: '收藏',
22
- removeFavoriteSearchButtonTitle: '从收藏中移除'
17
+ recentSearchesTitle: "\u641C\u7D22\u5386\u53F2",
18
+ noRecentSearchesText: "\u6CA1\u6709\u641C\u7D22\u5386\u53F2",
19
+ saveRecentSearchButtonTitle: "\u4FDD\u5B58\u81F3\u641C\u7D22\u5386\u53F2",
20
+ removeRecentSearchButtonTitle: "\u4ECE\u641C\u7D22\u5386\u53F2\u4E2D\u79FB\u9664",
21
+ favoriteSearchesTitle: "\u6536\u85CF",
22
+ removeFavoriteSearchButtonTitle: "\u4ECE\u6536\u85CF\u4E2D\u79FB\u9664"
23
23
  },
24
24
  errorScreen: {
25
- titleText: '无法获取结果',
26
- helpText: '你可能需要检查你的网络连接'
25
+ titleText: "\u65E0\u6CD5\u83B7\u53D6\u7ED3\u679C",
26
+ helpText: "\u4F60\u53EF\u80FD\u9700\u8981\u68C0\u67E5\u4F60\u7684\u7F51\u7EDC\u8FDE\u63A5"
27
27
  },
28
28
  footer: {
29
- selectText: '选择',
30
- navigateText: '切换',
31
- closeText: '关闭',
32
- searchByText: '搜索提供者'
29
+ selectText: "\u9009\u62E9",
30
+ navigateText: "\u5207\u6362",
31
+ closeText: "\u5173\u95ED",
32
+ searchByText: "\u641C\u7D22\u63D0\u4F9B\u8005"
33
33
  },
34
34
  noResultsScreen: {
35
- noResultsText: '无法找到相关结果',
36
- suggestedQueryText: '你可以尝试查询',
37
- reportMissingResultsText: '你认为该查询应该有结果?',
38
- reportMissingResultsLinkText: '点击反馈'
35
+ noResultsText: "\u65E0\u6CD5\u627E\u5230\u76F8\u5173\u7ED3\u679C",
36
+ suggestedQueryText: "\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u67E5\u8BE2",
37
+ reportMissingResultsText: "\u4F60\u8BA4\u4E3A\u8BE5\u67E5\u8BE2\u5E94\u8BE5\u6709\u7ED3\u679C\uFF1F",
38
+ reportMissingResultsLinkText: "\u70B9\u51FB\u53CD\u9988"
39
39
  }
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/plugin-algolia",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.30",
4
4
  "description": "A plugin for rspress to search with algolia in docs.",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -38,27 +38,25 @@
38
38
  "@docsearch/react": "^3.9.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@microsoft/api-extractor": "^7.52.5",
42
- "@rsbuild/plugin-react": "~1.1.1",
43
- "@rslib/core": "0.6.7",
44
- "@types/node": "^18.11.17",
45
- "@types/react": "^18.3.20",
46
- "@types/react-dom": "^18.3.6",
47
- "react": "^19.1.0",
48
- "rsbuild-plugin-publint": "^0.3.1",
41
+ "@microsoft/api-extractor": "^7.52.11",
42
+ "@rsbuild/plugin-react": "~1.4.0",
43
+ "@rslib/core": "0.12.4",
44
+ "@types/node": "^22.8.1",
45
+ "@types/react": "^19.1.12",
46
+ "@types/react-dom": "^19.1.9",
47
+ "react": "^19.1.1",
48
+ "rsbuild-plugin-publint": "^0.3.3",
49
49
  "typescript": "^5.8.2",
50
- "@rspress/config": "1.0.0",
51
- "@rspress/shared": "2.0.0-beta.3"
50
+ "@rspress/config": "1.0.0"
52
51
  },
53
52
  "peerDependencies": {
54
- "@rspress/runtime": "^2.0.0-beta.3"
53
+ "@rspress/core": "^2.0.0-beta.30"
55
54
  },
56
55
  "engines": {
57
56
  "node": ">=18.0.0"
58
57
  },
59
58
  "publishConfig": {
60
59
  "access": "public",
61
- "provenance": true,
62
60
  "registry": "https://registry.npmjs.org/"
63
61
  },
64
62
  "scripts": {