@rspress-theme-anatole/theme-default 0.7.30 → 0.7.32

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
@@ -3900,6 +3900,13 @@ p {
3900
3900
  text-decoration: none;
3901
3901
  }
3902
3902
 
3903
+ .features-title {
3904
+ margin-bottom: 16px;
3905
+ font-size: 24px;
3906
+ font-weight: 700;
3907
+ color: #32363E;
3908
+ }
3909
+
3903
3910
  .features-tabs {
3904
3911
  display: flex;
3905
3912
  gap: 24px;
package/dist/bundle.js CHANGED
@@ -754,7 +754,7 @@ function SidebarGroup(props) {
754
754
  const transitionRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
755
755
  const innerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
756
756
  const initialRender = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(true);
757
- const initialState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)('collapsed' in item && item.collapsed);
757
+ const initialState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(!('collapsed' in item) || item.collapsed);
758
758
  const active = item.link && activeMatcher(item.link);
759
759
  const { collapsed, collapsible = true } = item;
760
760
  const isLocked = item.locked === true;
@@ -1086,6 +1086,7 @@ function Sidebar(props) {
1086
1086
  if ('items' in item) {
1087
1087
  item.items.forEach(traverse);
1088
1088
  if (match(item)) item.collapsed = false;
1089
+ else item.collapsed = true;
1089
1090
  }
1090
1091
  };
1091
1092
  const newSidebarData = rawSidebarData.filter(Boolean).flat();
@@ -1732,6 +1733,10 @@ function HomepageLayout(props) {
1732
1733
  frontmatter: frontmatter,
1733
1734
  routePath: routePath
1734
1735
  }),
1736
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageMoreTopics, {
1737
+ frontmatter: frontmatter,
1738
+ routePath: routePath
1739
+ }),
1735
1740
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageFeaturesTabs, {
1736
1741
  frontmatter: frontmatter,
1737
1742
  routePath: routePath
@@ -3141,6 +3146,11 @@ function HomeFeature({ frontmatter, routePath }) {
3141
3146
 
3142
3147
  function HomepageTopics({ frontmatter, routePath }) {
3143
3148
  const topics = frontmatter?.topics;
3149
+
3150
+ if (!topics || !topics.items || topics.items.length === 0) {
3151
+ return null;
3152
+ }
3153
+
3144
3154
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3145
3155
  className: "topics-container",
3146
3156
  children: [
@@ -3216,10 +3226,82 @@ function HomepageTopics({ frontmatter, routePath }) {
3216
3226
  });
3217
3227
  }
3218
3228
 
3229
+ function HomepageMoreTopics({ frontmatter, routePath }) {
3230
+ let moreTopicsList = frontmatter?.moreTopics;
3231
+
3232
+ if (!moreTopicsList) {
3233
+ return null;
3234
+ }
3235
+
3236
+ if (!Array.isArray(moreTopicsList)) {
3237
+ moreTopicsList = [moreTopicsList];
3238
+ }
3239
+
3240
+ if (moreTopicsList.length === 0) {
3241
+ return null;
3242
+ }
3243
+
3244
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3245
+ children: moreTopicsList.map((moreTopics, sectionIndex) => {
3246
+ if (!moreTopics.items || moreTopics.items.length === 0) {
3247
+ return null;
3248
+ }
3249
+
3250
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3251
+ className: "topics-container",
3252
+ children: [
3253
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3254
+ children: [
3255
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h2", {
3256
+ children: moreTopics.title ?? 'Topics',
3257
+ className: "topics-title"
3258
+ }),
3259
+ ],
3260
+ style: {
3261
+ display: 'flex',
3262
+ justifyContent: 'space-between',
3263
+ width: '100%',
3264
+ }
3265
+ }),
3266
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3267
+ className: "topics-grid",
3268
+ children: moreTopics.items.map((topicItem) => {
3269
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3270
+ className: "topics-card",
3271
+ children: [
3272
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3273
+ className: "topics-icon-wrapper",
3274
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3275
+ className: topicItem.icon + " topics-icon"
3276
+ })
3277
+ }),
3278
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3279
+ href: topicItem.link,
3280
+ className: "topics-link",
3281
+ children: topicItem.text
3282
+ }),
3283
+ topicItem.desc && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3284
+ className: "topics-desc",
3285
+ children: topicItem.desc
3286
+ })
3287
+ ]
3288
+ }, topicItem.text);
3289
+ })
3290
+ })
3291
+ ],
3292
+ className: "topics-div",
3293
+ }, moreTopics.title ?? sectionIndex);
3294
+ })
3295
+ });
3296
+ }
3219
3297
 
3220
3298
  function HomepageFeatures({ frontmatter, routePath }) {
3221
3299
  const features = frontmatter?.features;
3222
3300
 
3301
+ if(!features){
3302
+ return;
3303
+ }
3304
+
3223
3305
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3224
3306
  children: [
3225
3307
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3358,9 +3440,14 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3358
3440
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0);
3359
3441
  const featureTab = frontmatter?.featureTabs;
3360
3442
 
3361
- return featureTab ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3443
+ return featureTab && featureTab.tabs && featureTab.tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3362
3444
  className: "features-div",
3363
3445
  children: [
3446
+ featureTab.title && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h2", {
3447
+ className: "features-title",
3448
+ children: featureTab.title
3449
+ }),
3450
+
3364
3451
  //Tabs
3365
3452
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3366
3453
  className: "features-tabs",
@@ -3374,7 +3461,7 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3374
3461
  }),
3375
3462
 
3376
3463
  // Tab content
3377
- featureTab.tabs[activeTab].rows?.length > 0 ?
3464
+ featureTab.tabs[activeTab] && featureTab.tabs[activeTab].rows?.length > 0 ?
3378
3465
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3379
3466
  children: (featureTab.tabs[activeTab].rows || []).map((featuresRow) => {
3380
3467
  return featuresRow.items?.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3431,9 +3518,16 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3431
3518
  function HomepageFaqs({ frontmatter, routePath }) {
3432
3519
  const tabs = frontmatter?.faqTabs || [];
3433
3520
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(tabs[0]?.title || '');
3521
+ const [isExpanded, setIsExpanded] = __WEBPACK_EXTERNAL_MODULE_react__.useState(false);
3522
+ const DEFAULT_VISIBLE_COUNT = 5;
3434
3523
 
3435
3524
  const activeFaqs = tabs.find(tab => tab.title === activeTab);
3436
3525
 
3526
+ const handleTabClick = (title) => {
3527
+ setActiveTab(title);
3528
+ setIsExpanded(false);
3529
+ };
3530
+
3437
3531
  const renderFaqItem = (faqItem) => {
3438
3532
  // If item has a link, render as a clickable link row (same style as FAQ question)
3439
3533
  if (faqItem.link) {
@@ -3499,6 +3593,11 @@ function HomepageFaqs({ frontmatter, routePath }) {
3499
3593
  }, faqItem.question);
3500
3594
  };
3501
3595
 
3596
+ const visibleFaqs = activeFaqs
3597
+ ? (isExpanded ? activeFaqs.items : activeFaqs.items.slice(0, DEFAULT_VISIBLE_COUNT))
3598
+ : [];
3599
+ const hasMoreItems = activeFaqs && activeFaqs.items.length > DEFAULT_VISIBLE_COUNT;
3600
+
3502
3601
  return tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3503
3602
  className: "faqs-div",
3504
3603
  children: [
@@ -3508,21 +3607,51 @@ function HomepageFaqs({ frontmatter, routePath }) {
3508
3607
  children: tabs.map((tab) =>
3509
3608
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3510
3609
  className: activeTab === tab.title ? "faqs-tab active" : "faqs-tab",
3511
- onClick: () => setActiveTab(tab.title),
3610
+ onClick: () => handleTabClick(tab.title),
3512
3611
  children: tab.title
3513
3612
  }, tab.title)
3514
3613
  )
3515
3614
  }),
3516
3615
  // Content FAQ
3517
3616
  activeFaqs ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3518
- children: activeFaqs.items.map((faqItem) => renderFaqItem(faqItem)),
3617
+ children: visibleFaqs.map((faqItem) => renderFaqItem(faqItem)),
3519
3618
  className: "faqs-box"
3520
3619
  }) : null,
3620
+ // Show more / Show less button (outside the white box)
3621
+ hasMoreItems ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3622
+ className: "faqs-show-more",
3623
+ style: {
3624
+ textAlign: 'center',
3625
+ padding: '16px 0',
3626
+ cursor: 'pointer',
3627
+ },
3628
+ onClick: (e) => {
3629
+ e.preventDefault();
3630
+ setIsExpanded(!isExpanded);
3631
+ },
3632
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3633
+ style: {
3634
+ color: '#333',
3635
+ fontWeight: 500,
3636
+ fontSize: '14px',
3637
+ display: 'inline-flex',
3638
+ alignItems: 'center',
3639
+ gap: '6px',
3640
+ },
3641
+ children: [
3642
+ isExpanded ? "Show less" : "Show more",
3643
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3644
+ className: isExpanded ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down",
3645
+ style: { fontSize: '20px' }
3646
+ })
3647
+ ]
3648
+ })
3649
+ }) : null,
3521
3650
  ],
3522
3651
  style: {
3523
- width: '100%',
3524
- padding: '72px 40px 0 40px',
3525
- }
3652
+ width: '100%',
3653
+ padding: '72px 40px 0 40px',
3654
+ }
3526
3655
  }) : null;
3527
3656
  }
3528
3657
 
@@ -7233,4 +7362,4 @@ async function exportContentToPDF() {
7233
7362
  });
7234
7363
  }
7235
7364
 
7236
- export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeLayout, HomepageLayout, GettingStartLayout, RequestArticleLayout, HomepageTopSearch, IntroBanner, HomepageTopics, HomepageFeatures, HomepageFeaturesTabs, PopularTopicsSection, WhatsNew, HomepageFaqs, LastUpdated, Layout, Link, LinkCard, Nav, NotFoundLayout, Overview, PackageManagerTabs, PrevNextPage, types_RenderType as RenderType, ScrollToTop, Search, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SwitchAppearance, Tab, Tabs, Tag, Toc, bindingAsideScroll, src_rslib_entry_ as default, getCustomMDXComponent, isMobileDevice, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, scrollToTarget, setup, useEditLink, useEnableNav, useFullTextSearch, useHiddenNav, useLocaleSiteData, usePathUtils, usePrevNextPage, useRedirect4FirstVisit, useSidebarData, useThemeState };
7365
+ export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeLayout, HomepageLayout, GettingStartLayout, RequestArticleLayout, HomepageTopSearch, IntroBanner, HomepageTopics, HomepageMoreTopics as HomepageAnotherTopics, HomepageFeatures, HomepageFeaturesTabs, PopularTopicsSection, WhatsNew, HomepageFaqs, LastUpdated, Layout, Link, LinkCard, Nav, NotFoundLayout, Overview, PackageManagerTabs, PrevNextPage, types_RenderType as RenderType, ScrollToTop, Search, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SwitchAppearance, Tab, Tabs, Tag, Toc, bindingAsideScroll, src_rslib_entry_ as default, getCustomMDXComponent, isMobileDevice, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, scrollToTarget, setup, useEditLink, useEnableNav, useFullTextSearch, useHiddenNav, useLocaleSiteData, usePathUtils, usePrevNextPage, useRedirect4FirstVisit, useSidebarData, useThemeState };
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.30",
4
+ "version": "0.7.32",
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.30",
25
- "@rspress-theme-anatole/shared": "0.7.30",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.32",
25
+ "@rspress-theme-anatole/shared": "0.7.32",
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",