@rspress-theme-anatole/theme-default 0.7.34 → 0.7.36

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/bundle.css CHANGED
@@ -3674,6 +3674,14 @@ p {
3674
3674
  border: 1px solid var(--Colors-Neutral-3, #D2D5DA);
3675
3675
  justify-content: space-between;
3676
3676
  height: 100%;
3677
+ transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
3678
+ cursor: pointer;
3679
+ }
3680
+
3681
+ .topics-item:hover {
3682
+ transform: translateY(-4px);
3683
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
3684
+ border-color: #b0b5bd;
3677
3685
  }
3678
3686
 
3679
3687
  .topics-item-text {
@@ -3929,6 +3937,37 @@ p {
3929
3937
  border-bottom: 2px solid #e60023;
3930
3938
  }
3931
3939
 
3940
+ /* Pills variant */
3941
+ .features-tabs--pills {
3942
+ border-bottom: none;
3943
+ gap: 8px;
3944
+ flex-wrap: wrap;
3945
+ }
3946
+
3947
+ .features-tab--pill {
3948
+ border: 1px solid #d1d5db !important;
3949
+ border-radius: 9999px !important;
3950
+ padding: 6px 16px !important;
3951
+ font-size: 14px !important;
3952
+ font-weight: 500 !important;
3953
+ color: #4b5563 !important;
3954
+ background: #fff !important;
3955
+ transition: all 0.15s ease;
3956
+ white-space: nowrap;
3957
+ }
3958
+
3959
+ .features-tab--pill:hover {
3960
+ border-color: #9ca3af !important;
3961
+ color: #1f2937 !important;
3962
+ }
3963
+
3964
+ .features-tab--pill.active {
3965
+ background: #1f2937 !important;
3966
+ color: #fff !important;
3967
+ border-color: #1f2937 !important;
3968
+ border-bottom: none !important;
3969
+ }
3970
+
3932
3971
  .request-article-section {
3933
3972
  display: flex;
3934
3973
  justify-content: center;
package/dist/bundle.js CHANGED
@@ -3346,8 +3346,9 @@ function HomepageFeatures({ frontmatter, routePath }) {
3346
3346
  children: (features.rows || []).map((featuresRow) => {
3347
3347
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3348
3348
  children: (featuresRow.items || []).map((featureItem) => {
3349
- return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3349
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3350
3350
  className: "topics-item",
3351
+ href: featureItem.link,
3351
3352
  children: [
3352
3353
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3353
3354
  children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
@@ -3465,6 +3466,8 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3465
3466
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0);
3466
3467
  const featureTab = frontmatter?.featureTabs;
3467
3468
 
3469
+ const isPills = featureTab?.variant === 'pills';
3470
+
3468
3471
  return featureTab && featureTab.tabs && featureTab.tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3469
3472
  className: "features-div",
3470
3473
  children: [
@@ -3475,10 +3478,10 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3475
3478
 
3476
3479
  //Tabs
3477
3480
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3478
- className: "features-tabs",
3481
+ className: "features-tabs" + (isPills ? " features-tabs--pills" : ""),
3479
3482
  children: (featureTab.tabs || []).map((tab, idx) =>
3480
3483
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("button", {
3481
- className: "features-tab" + (idx === activeTab ? " active" : ""),
3484
+ className: "features-tab" + (isPills ? " features-tab--pill" : "") + (idx === activeTab ? " active" : ""),
3482
3485
  onClick: () => setActiveTab(idx),
3483
3486
  children: tab.name
3484
3487
  }, tab.name)
@@ -3499,8 +3502,9 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3499
3502
  alignItems: 'stretch',
3500
3503
  },
3501
3504
  children: (featuresRow.items || []).map((featureItem) =>
3502
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3505
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3503
3506
  className: "topics-item",
3507
+ href: featureItem.link,
3504
3508
  children: [
3505
3509
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3506
3510
  className: "features-item-icon-div",
@@ -6738,6 +6742,9 @@ function SearchPanel({ focused, setFocused }) {
6738
6742
  version,
6739
6743
  versionedSearch
6740
6744
  ]);
6745
+ const DEFAULT_SEARCH_LIMIT = 7;
6746
+ const SCOPED_SEARCH_LIMIT = 50;
6747
+ const SCOPED_SEARCH_RETRY_LIMIT = 100;
6741
6748
  const filterResultsByScope = (results, scope, basePath, currentLang) => {
6742
6749
  if (!scope || !scope.scopeType) {
6743
6750
  return results;
@@ -6801,6 +6808,11 @@ function SearchPanel({ focused, setFocused }) {
6801
6808
  };
6802
6809
  });
6803
6810
  };
6811
+ const hasSearchResults = (results) => results.some((resultGroup) => (resultGroup?.result?.length ?? 0) > 0);
6812
+ const getScopedSearchLimit = (scope, retry = false) => {
6813
+ if (!scope?.scopeType) return DEFAULT_SEARCH_LIMIT;
6814
+ return retry ? SCOPED_SEARCH_RETRY_LIMIT : SCOPED_SEARCH_LIMIT;
6815
+ };
6804
6816
  const handleQueryChangedImpl = async (value) => {
6805
6817
  let newQuery = value;
6806
6818
  setQuery(newQuery);
@@ -6818,7 +6830,16 @@ function SearchPanel({ focused, setFocused }) {
6818
6830
  const transformedQuery = await __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__[key](newQuery);
6819
6831
  if (transformedQuery) newQuery = transformedQuery;
6820
6832
  }
6821
- const defaultSearchResult = await pageSearcherRef.current?.match(newQuery);
6833
+ let defaultSearchResult = await pageSearcherRef.current?.match(newQuery, getScopedSearchLimit(searchScope));
6834
+ let filteredDefaultSearchResult = filterResultsByScope(
6835
+ defaultSearchResult || DEFAULT_RESULT,
6836
+ searchScope,
6837
+ base,
6838
+ lang
6839
+ );
6840
+ if (searchScope?.scopeType && !hasSearchResults(filteredDefaultSearchResult)) {
6841
+ defaultSearchResult = await pageSearcherRef.current?.match(newQuery, getScopedSearchLimit(searchScope, true));
6842
+ }
6822
6843
  if (defaultSearchResult) searchResult.push(...defaultSearchResult);
6823
6844
  if ('onSearch' in __WEBPACK_EXTERNAL_MODULE_virtual_search_hooks_9d01d01f__) {
6824
6845
  const key = 'onSearch';
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.34",
4
+ "version": "0.7.36",
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.34",
25
- "@rspress-theme-anatole/shared": "0.7.34",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.36",
25
+ "@rspress-theme-anatole/shared": "0.7.36",
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",