@rspress-theme-anatole/theme-default 0.7.47 → 0.7.49

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.
@@ -1,50 +1,50 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
- import "react";
3
- const SvgLoading = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
4
- width: 32,
5
- height: 32,
6
- viewBox: "0 0 24 24",
7
- ...props,
8
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("g", {
9
- fill: "none",
10
- stroke: "var(--rp-c-brand)",
11
- strokeLinecap: "round",
12
- strokeWidth: 2,
13
- children: [
14
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
15
- strokeDasharray: 60,
16
- strokeDashoffset: 60,
17
- strokeOpacity: 0.3,
18
- d: "M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",
19
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animate", {
20
- fill: "freeze",
21
- attributeName: "stroke-dashoffset",
22
- dur: "1.3s",
23
- values: "60;0"
24
- })
25
- }),
26
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("path", {
27
- strokeDasharray: 15,
28
- strokeDashoffset: 15,
29
- d: "M12 3a9 9 0 0 1 9 9",
30
- children: [
31
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animate", {
32
- fill: "freeze",
33
- attributeName: "stroke-dashoffset",
34
- dur: "0.3s",
35
- values: "15;0"
36
- }),
37
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animateTransform", {
38
- attributeName: "transform",
39
- dur: "1.5s",
40
- repeatCount: "indefinite",
41
- type: "rotate",
42
- values: "0 12 12;360 12 12"
43
- })
44
- ]
45
- })
46
- ]
47
- })
48
- });
49
- const loading_rslib_entry_ = SvgLoading;
50
- export { loading_rslib_entry_ as default };
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgLoading = (props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
4
+ width: 32,
5
+ height: 32,
6
+ viewBox: "0 0 24 24",
7
+ ...props,
8
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("g", {
9
+ fill: "none",
10
+ stroke: "#32363E",
11
+ strokeLinecap: "round",
12
+ strokeWidth: 2,
13
+ children: [
14
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
15
+ strokeDasharray: 60,
16
+ strokeDashoffset: 60,
17
+ strokeOpacity: 0.3,
18
+ d: "M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",
19
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animate", {
20
+ fill: "freeze",
21
+ attributeName: "stroke-dashoffset",
22
+ dur: "1.3s",
23
+ values: "60;0"
24
+ })
25
+ }),
26
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("path", {
27
+ strokeDasharray: 15,
28
+ strokeDashoffset: 15,
29
+ d: "M12 3a9 9 0 0 1 9 9",
30
+ children: [
31
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animate", {
32
+ fill: "freeze",
33
+ attributeName: "stroke-dashoffset",
34
+ dur: "0.3s",
35
+ values: "15;0"
36
+ }),
37
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("animateTransform", {
38
+ attributeName: "transform",
39
+ dur: "1.5s",
40
+ repeatCount: "indefinite",
41
+ type: "rotate",
42
+ values: "0 12 12;360 12 12"
43
+ })
44
+ ]
45
+ })
46
+ ]
47
+ })
48
+ });
49
+ const loading_rslib_entry_ = SvgLoading;
50
+ export { loading_rslib_entry_ as default };
package/dist/bundle.js CHANGED
@@ -6667,7 +6667,7 @@ function SearchPanel({ focused, setFocused }) {
6667
6667
  }
6668
6668
  };
6669
6669
  const { siteData, page: { lang, version, frontmatter, routePath } } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
6670
- const { searchPlaceholderText = 'Search Docs', scopedSearchPrefixText = 'Search in' } = useLocaleSiteData();
6670
+ const { searchPlaceholderText = 'Search Docs', scopedSearchPrefixText = 'Search in', searchingText = 'Searching...' } = useLocaleSiteData();
6671
6671
  const { search, title: siteTitle, base } = siteData;
6672
6672
  const versionedSearch = search && 'remote' !== search.mode && search.versioned;
6673
6673
  const DEFAULT_RESULT = [
@@ -6718,6 +6718,15 @@ function SearchPanel({ focused, setFocused }) {
6718
6718
  });
6719
6719
  return products;
6720
6720
  };
6721
+ const getRelatedProductsForScope = (primaryProductName) => {
6722
+ const relatedProducts = getRelatedProductsFromFrontmatter(frontmatter);
6723
+ if (!primaryProductName) return relatedProducts;
6724
+ if (relatedProducts.includes(primaryProductName)) return relatedProducts;
6725
+ return [
6726
+ primaryProductName,
6727
+ ...relatedProducts
6728
+ ];
6729
+ };
6721
6730
  const getScopedPathInfo = (pathname, basePath, localeLangs) => {
6722
6731
  const pathParts = pathname.split('/').filter(Boolean);
6723
6732
  let startIndex = 0;
@@ -6742,7 +6751,7 @@ function SearchPanel({ focused, setFocused }) {
6742
6751
  scopeType: 'product',
6743
6752
  productName: secondSegment,
6744
6753
  scopePath: `/${secondSegment}`,
6745
- relatedProducts: null
6754
+ relatedProducts: getRelatedProductsForScope(secondSegment)
6746
6755
  };
6747
6756
  }
6748
6757
  const productName = normalizeProductName(firstSegment || '');
@@ -6750,7 +6759,7 @@ function SearchPanel({ focused, setFocused }) {
6750
6759
  scopeType: 'product',
6751
6760
  productName: productName,
6752
6761
  scopePath: `/${productName}`,
6753
- relatedProducts: null
6762
+ relatedProducts: getRelatedProductsForScope(productName)
6754
6763
  };
6755
6764
  return {
6756
6765
  scopeType: null,
@@ -6807,6 +6816,7 @@ function SearchPanel({ focused, setFocused }) {
6807
6816
  const searcher = await ensureSearcherReady();
6808
6817
  const query = searchInputRef.current?.value;
6809
6818
  if (query) {
6819
+ setIsSearching(true);
6810
6820
  const matched = await searcher.match(query);
6811
6821
  setSearchResult(matched || DEFAULT_RESULT);
6812
6822
  setIsSearching(false);
@@ -6960,11 +6970,11 @@ function SearchPanel({ focused, setFocused }) {
6960
6970
  }
6961
6971
 
6962
6972
  if (scope.scopeType === 'product') {
6963
- // Product page: only show results from this product
6964
- const matches = cleanPath.startsWith(scope.scopePath + '/') ||
6965
- cleanPath === scope.scopePath ||
6966
- cleanPath.startsWith(scope.scopePath + '.html');
6967
- return matches;
6973
+ const relatedProducts = scope.relatedProducts || [];
6974
+ const scopePaths = relatedProducts.length > 0 ? relatedProducts.map(product => `/${product}`) : [
6975
+ scope.scopePath
6976
+ ].filter(Boolean);
6977
+ return scopePaths.some(scopePath => cleanPath.startsWith(scopePath + '/') || cleanPath === scopePath || cleanPath.startsWith(scopePath + '.html'));
6968
6978
  }
6969
6979
 
6970
6980
  if (scope.scopeType === 'solution') {
@@ -7004,6 +7014,7 @@ function SearchPanel({ focused, setFocused }) {
7004
7014
  let newQuery = value;
7005
7015
  setQuery(newQuery);
7006
7016
  if (search && 'remote' === search.mode && search.searchLoading) setIsSearching(true);
7017
+ if (newQuery) setIsSearching(true);
7007
7018
  if (newQuery) {
7008
7019
  try {
7009
7020
  await ensureSearcherReady();
@@ -7030,7 +7041,7 @@ function SearchPanel({ focused, setFocused }) {
7030
7041
  if (defaultSearchResult) searchResult.push(...defaultSearchResult);
7031
7042
  if ('onSearch' in __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__) {
7032
7043
  const key = 'onSearch';
7033
- const customSearchResult = await __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__[key](newQuery, searchResult);
7044
+ const customSearchResult = await __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__[key](newQuery, searchResult, searchScope);
7034
7045
  if (customSearchResult) searchResult.push(...customSearchResult.map((item) => ({
7035
7046
  renderType: types_RenderType.Custom,
7036
7047
  ...item
@@ -7096,10 +7107,16 @@ function SearchPanel({ focused, setFocused }) {
7096
7107
  const renderSearchResultItem = (suggestionList, query, isSearching) => {
7097
7108
  if (isSearching) return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
7098
7109
  className: "flex flex-col items-center",
7099
- children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SvgWrapper, {
7100
- icon: __WEBPACK_EXTERNAL_MODULE__theme_assets_loading_5f550a25__["default"],
7101
- className: "m-8 opacity-80"
7102
- })
7110
+ children: [
7111
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(SvgWrapper, {
7112
+ icon: __WEBPACK_EXTERNAL_MODULE__theme_assets_loading_5f550a25__["default"],
7113
+ className: "m-8 opacity-80"
7114
+ }),
7115
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
7116
+ className: "text-sm opacity-60 -mt-4 mb-8",
7117
+ children: searchingText
7118
+ })
7119
+ ]
7103
7120
  });
7104
7121
  if (0 === suggestionList.length && 'inited' === initStatus) return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(NoSearchResult, {
7105
7122
  query: query
@@ -7218,7 +7235,7 @@ function SearchPanel({ focused, setFocused }) {
7218
7235
  })
7219
7236
  ]
7220
7237
  }),
7221
- query && 'inited' === initStatus ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
7238
+ query && 'initial' !== initStatus ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
7222
7239
  className: `${Search_index_module.searchHits} rspress-scrollbar`,
7223
7240
  ref: searchResultRef,
7224
7241
  children: renderSearchResult(searchResult, search, isSearching)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/theme-default",
3
3
  "author": "Anatole Tong",
4
- "version": "0.7.47",
4
+ "version": "0.7.49",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -21,8 +21,8 @@
21
21
  "types": "./dist/bundle.d.ts",
22
22
  "dependencies": {
23
23
  "@mdx-js/react": "2.3.0",
24
- "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.47",
25
- "@rspress-theme-anatole/shared": "0.7.47",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.49",
25
+ "@rspress-theme-anatole/shared": "0.7.49",
26
26
  "@rspress/runtime": "1.43.8",
27
27
  "body-scroll-lock": "4.0.0-beta.0",
28
28
  "copy-to-clipboard": "^3.3.3",