@rspress/plugin-algolia 2.0.0-beta.3 → 2.0.0-beta.31
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 +1 -1
- package/dist/runtime/Search.css +30 -1
- package/dist/runtime/Search.d.ts +1 -1
- package/dist/runtime/Search.js +11 -11
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +3 -5
- package/dist/runtime/locales.js +23 -23
- package/package.json +11 -13
package/dist/index.d.ts
CHANGED
package/dist/runtime/Search.css
CHANGED
|
@@ -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;
|
package/dist/runtime/Search.d.ts
CHANGED
|
@@ -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
|
package/dist/runtime/Search.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
8
|
-
const Hit = ({ hit, children })=>/*#__PURE__*/
|
|
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 =
|
|
14
|
-
const lang =
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const lang = useLang();
|
|
15
15
|
const { translations, placeholder } = locales?.[lang] ?? {};
|
|
16
|
-
|
|
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__*/
|
|
31
|
-
children: /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
31
|
+
children: /*#__PURE__*/ jsx(DocSearch, {
|
|
32
32
|
placeholder: placeholder,
|
|
33
33
|
translations: translations,
|
|
34
34
|
maxResultsPerGroup: 20,
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { type
|
|
1
|
+
export { type Locales, ZH_LOCALES } from './locales.js';
|
|
2
|
+
export { Search, type SearchProps } from './Search.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
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 };
|
package/dist/runtime/locales.js
CHANGED
|
@@ -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
|
+
"version": "2.0.0-beta.31",
|
|
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.
|
|
42
|
-
"@rsbuild/plugin-react": "~1.
|
|
43
|
-
"@rslib/core": "0.
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"@types/react": "^
|
|
46
|
-
"@types/react-dom": "^
|
|
47
|
-
"react": "^19.1.
|
|
48
|
-
"rsbuild-plugin-publint": "^0.3.
|
|
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/
|
|
53
|
+
"@rspress/core": "^2.0.0-beta.31"
|
|
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": {
|