@rspress/plugin-algolia 2.0.0-beta.9 → 2.0.0-rc.1
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 +21 -39
- package/dist/runtime/Search.js +11 -11
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +3 -5
- package/dist/runtime/locales.js +23 -23
- package/package.json +12 -14
package/dist/index.d.ts
CHANGED
package/dist/runtime/Search.css
CHANGED
|
@@ -1,49 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
align-self: center;
|
|
3
|
-
}
|
|
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);
|
|
1
|
+
[class*="DocSearch"] {
|
|
16
2
|
--docsearch-primary-color: var(--rp-c-brand);
|
|
17
|
-
--docsearch-
|
|
18
|
-
--docsearch-
|
|
19
|
-
--docsearch-
|
|
20
|
-
--docsearch-
|
|
21
|
-
--docsearch-
|
|
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;
|
|
3
|
+
--docsearch-text-color: var(--rp-c-text-1);
|
|
4
|
+
--docsearch-secondary-text-color: var(--rp-c-text-2);
|
|
5
|
+
--docsearch-muted-color: var(--rp-c-text-2);
|
|
6
|
+
--docsearch-subtle-color: var(--rp-c-divider-light);
|
|
7
|
+
--docsearch-container-background: #3c3c3c66;
|
|
26
8
|
--docsearch-modal-background: var(--rp-c-bg);
|
|
9
|
+
--docsearch-searchbox-background: var(--rp-c-bg-soft);
|
|
10
|
+
--docsearch-searchbox-focus-background: var(--rp-c-bg);
|
|
11
|
+
--docsearch-hit-highlight-color: var(--rp-c-brand-tint);
|
|
12
|
+
--docsearch-hit-active-color: var(--rp-c-text-1);
|
|
13
|
+
--docsearch-hit-background: var(--rp-c-bg-soft);
|
|
14
|
+
--docsearch-hit-shadow: var(--rp-shadow-2);
|
|
27
15
|
--docsearch-footer-background: var(--rp-c-bg);
|
|
28
|
-
--docsearch-key-
|
|
29
|
-
--docsearch-key-
|
|
30
|
-
--docsearch-
|
|
31
|
-
--docsearch-
|
|
32
|
-
--docsearch-
|
|
16
|
+
--docsearch-key-background: var(--rp-c-bg-mute);
|
|
17
|
+
--docsearch-key-color: var(--rp-c-text-2);
|
|
18
|
+
--docsearch-highlight-color: var(--rp-c-brand);
|
|
19
|
+
--docsearch-icon-color: var(--rp-c-text-1);
|
|
20
|
+
--docsearch-background-color: var(--rp-c-bg-mute);
|
|
33
21
|
}
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
23
|
+
.DocSearch {
|
|
24
|
+
border-radius: var(--rp-radius-small);
|
|
25
|
+
--docsearch-searchbox-background: color-mix(in srgb, var(--rp-c-bg) 30%, transparent);
|
|
39
26
|
}
|
|
40
27
|
|
|
41
|
-
.DocSearch-Button-Container > .DocSearch-Button-Placeholder
|
|
28
|
+
.DocSearch-Button-Container > .DocSearch-Button-Placeholder {
|
|
42
29
|
font-size: .825rem;
|
|
43
30
|
}
|
|
44
31
|
|
|
45
|
-
.DocSearch-Screen-Icon {
|
|
46
|
-
justify-content: center;
|
|
47
|
-
display: flex;
|
|
48
|
-
}
|
|
49
|
-
|
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
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: '搜索文档',
|
|
4
4
|
translations: {
|
|
5
5
|
button: {
|
|
6
|
-
buttonText:
|
|
7
|
-
buttonAriaLabel:
|
|
6
|
+
buttonText: '搜索',
|
|
7
|
+
buttonAriaLabel: '搜索'
|
|
8
8
|
},
|
|
9
9
|
modal: {
|
|
10
10
|
searchBox: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
clearButtonTitle: '清除查询条件',
|
|
12
|
+
clearButtonAriaLabel: '清除查询条件',
|
|
13
|
+
closeButtonText: '取消',
|
|
14
|
+
closeButtonAriaLabel: '取消'
|
|
15
15
|
},
|
|
16
16
|
startScreen: {
|
|
17
|
-
recentSearchesTitle:
|
|
18
|
-
noRecentSearchesText:
|
|
19
|
-
saveRecentSearchButtonTitle:
|
|
20
|
-
removeRecentSearchButtonTitle:
|
|
21
|
-
favoriteSearchesTitle:
|
|
22
|
-
removeFavoriteSearchButtonTitle:
|
|
17
|
+
recentSearchesTitle: '搜索历史',
|
|
18
|
+
noRecentSearchesText: '没有搜索历史',
|
|
19
|
+
saveRecentSearchButtonTitle: '保存至搜索历史',
|
|
20
|
+
removeRecentSearchButtonTitle: '从搜索历史中移除',
|
|
21
|
+
favoriteSearchesTitle: '收藏',
|
|
22
|
+
removeFavoriteSearchButtonTitle: '从收藏中移除'
|
|
23
23
|
},
|
|
24
24
|
errorScreen: {
|
|
25
|
-
titleText:
|
|
26
|
-
helpText:
|
|
25
|
+
titleText: '无法获取结果',
|
|
26
|
+
helpText: '你可能需要检查你的网络连接'
|
|
27
27
|
},
|
|
28
28
|
footer: {
|
|
29
|
-
selectText:
|
|
30
|
-
navigateText:
|
|
31
|
-
closeText:
|
|
32
|
-
|
|
29
|
+
selectText: '选择',
|
|
30
|
+
navigateText: '切换',
|
|
31
|
+
closeText: '关闭',
|
|
32
|
+
poweredByText: '搜索提供者'
|
|
33
33
|
},
|
|
34
34
|
noResultsScreen: {
|
|
35
|
-
noResultsText:
|
|
36
|
-
suggestedQueryText:
|
|
37
|
-
reportMissingResultsText:
|
|
38
|
-
reportMissingResultsLinkText:
|
|
35
|
+
noResultsText: '无法找到相关结果',
|
|
36
|
+
suggestedQueryText: '你可以尝试查询',
|
|
37
|
+
reportMissingResultsText: '你认为该查询应该有结果?',
|
|
38
|
+
reportMissingResultsLinkText: '点击反馈'
|
|
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-
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
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": {
|
|
@@ -34,31 +34,29 @@
|
|
|
34
34
|
"static"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@docsearch/css": "^3.
|
|
38
|
-
"@docsearch/react": "^3.
|
|
37
|
+
"@docsearch/css": "^4.3.2",
|
|
38
|
+
"@docsearch/react": "^4.3.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@microsoft/api-extractor": "^7.
|
|
42
|
-
"@rsbuild/plugin-react": "~1.
|
|
43
|
-
"@rslib/core": "0.
|
|
41
|
+
"@microsoft/api-extractor": "^7.55.0",
|
|
42
|
+
"@rsbuild/plugin-react": "~1.4.2",
|
|
43
|
+
"@rslib/core": "0.17.2",
|
|
44
44
|
"@types/node": "^22.8.1",
|
|
45
|
-
"@types/react": "^
|
|
46
|
-
"@types/react-dom": "^
|
|
47
|
-
"react": "^19.
|
|
48
|
-
"rsbuild-plugin-publint": "^0.3.
|
|
45
|
+
"@types/react": "^19.2.5",
|
|
46
|
+
"@types/react-dom": "^19.2.3",
|
|
47
|
+
"react": "^19.2.0",
|
|
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.9"
|
|
50
|
+
"@rspress/config": "1.0.0"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
|
-
"@rspress/
|
|
53
|
+
"@rspress/core": "^2.0.0-rc.1"
|
|
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": {
|