@rspress-theme-anatole/theme-default 0.7.46 → 0.7.48

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
@@ -4353,6 +4353,25 @@ function HomepageTopSearch({ frontmatter, routePath }) {
4353
4353
  function IntroBanner({ frontmatter, routePath }) {
4354
4354
  const banner = frontmatter?.banner || DEFAULT_HERO;
4355
4355
 
4356
+ // Build breadcrumb items: root first, then parents array, then current
4357
+ const buildBreadcrumbs = () => {
4358
+ const items = [];
4359
+
4360
+ // Add root if exists
4361
+ if (banner.root?.text) {
4362
+ items.push(banner.root);
4363
+ }
4364
+
4365
+ // Add parents array if exists
4366
+ if (banner.parents && Array.isArray(banner.parents)) {
4367
+ items.push(...banner.parents);
4368
+ }
4369
+
4370
+ return items;
4371
+ };
4372
+
4373
+ const breadcrumbItems = buildBreadcrumbs();
4374
+
4356
4375
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
4357
4376
  style: {
4358
4377
  height: "233px",
@@ -4373,19 +4392,22 @@ function IntroBanner({ frontmatter, routePath }) {
4373
4392
  marginBottom: "10px"
4374
4393
  },
4375
4394
  children: [
4376
- banner.root?.text && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
4377
- "a",
4378
- {
4379
- href: banner.root.link || "#",
4380
- style: {
4381
- textDecoration: "underline",
4382
- color: "#32363E",
4383
- fontWeight: "600"
4384
- },
4385
- children: banner.root.text
4386
- }
4387
- ),
4388
- " > ",
4395
+ ...breadcrumbItems.map((item, index) => [
4396
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
4397
+ "a",
4398
+ {
4399
+ href: item.link,
4400
+ style: {
4401
+ textDecoration: "underline",
4402
+ color: "#32363E",
4403
+ fontWeight: "600"
4404
+ },
4405
+ children: item.text
4406
+ },
4407
+ `breadcrumb-${index}`
4408
+ ),
4409
+ " > "
4410
+ ]).flat(),
4389
4411
  banner.current
4390
4412
  ]
4391
4413
  }),
@@ -6696,6 +6718,15 @@ function SearchPanel({ focused, setFocused }) {
6696
6718
  });
6697
6719
  return products;
6698
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
+ };
6699
6730
  const getScopedPathInfo = (pathname, basePath, localeLangs) => {
6700
6731
  const pathParts = pathname.split('/').filter(Boolean);
6701
6732
  let startIndex = 0;
@@ -6720,7 +6751,7 @@ function SearchPanel({ focused, setFocused }) {
6720
6751
  scopeType: 'product',
6721
6752
  productName: secondSegment,
6722
6753
  scopePath: `/${secondSegment}`,
6723
- relatedProducts: null
6754
+ relatedProducts: getRelatedProductsForScope(secondSegment)
6724
6755
  };
6725
6756
  }
6726
6757
  const productName = normalizeProductName(firstSegment || '');
@@ -6728,7 +6759,7 @@ function SearchPanel({ focused, setFocused }) {
6728
6759
  scopeType: 'product',
6729
6760
  productName: productName,
6730
6761
  scopePath: `/${productName}`,
6731
- relatedProducts: null
6762
+ relatedProducts: getRelatedProductsForScope(productName)
6732
6763
  };
6733
6764
  return {
6734
6765
  scopeType: null,
@@ -6785,6 +6816,7 @@ function SearchPanel({ focused, setFocused }) {
6785
6816
  const searcher = await ensureSearcherReady();
6786
6817
  const query = searchInputRef.current?.value;
6787
6818
  if (query) {
6819
+ setIsSearching(true);
6788
6820
  const matched = await searcher.match(query);
6789
6821
  setSearchResult(matched || DEFAULT_RESULT);
6790
6822
  setIsSearching(false);
@@ -6938,11 +6970,11 @@ function SearchPanel({ focused, setFocused }) {
6938
6970
  }
6939
6971
 
6940
6972
  if (scope.scopeType === 'product') {
6941
- // Product page: only show results from this product
6942
- const matches = cleanPath.startsWith(scope.scopePath + '/') ||
6943
- cleanPath === scope.scopePath ||
6944
- cleanPath.startsWith(scope.scopePath + '.html');
6945
- 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'));
6946
6978
  }
6947
6979
 
6948
6980
  if (scope.scopeType === 'solution') {
@@ -6982,6 +7014,7 @@ function SearchPanel({ focused, setFocused }) {
6982
7014
  let newQuery = value;
6983
7015
  setQuery(newQuery);
6984
7016
  if (search && 'remote' === search.mode && search.searchLoading) setIsSearching(true);
7017
+ if (newQuery) setIsSearching(true);
6985
7018
  if (newQuery) {
6986
7019
  try {
6987
7020
  await ensureSearcherReady();
@@ -7008,7 +7041,7 @@ function SearchPanel({ focused, setFocused }) {
7008
7041
  if (defaultSearchResult) searchResult.push(...defaultSearchResult);
7009
7042
  if ('onSearch' in __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__) {
7010
7043
  const key = 'onSearch';
7011
- 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);
7012
7045
  if (customSearchResult) searchResult.push(...customSearchResult.map((item) => ({
7013
7046
  renderType: types_RenderType.Custom,
7014
7047
  ...item
@@ -7196,7 +7229,7 @@ function SearchPanel({ focused, setFocused }) {
7196
7229
  })
7197
7230
  ]
7198
7231
  }),
7199
- query && 'inited' === initStatus ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
7232
+ query && 'initial' !== initStatus ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
7200
7233
  className: `${Search_index_module.searchHits} rspress-scrollbar`,
7201
7234
  ref: searchResultRef,
7202
7235
  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.46",
4
+ "version": "0.7.48",
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.46",
25
- "@rspress-theme-anatole/shared": "0.7.46",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.48",
25
+ "@rspress-theme-anatole/shared": "0.7.48",
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",