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

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.
Files changed (2) hide show
  1. package/dist/bundle.js +131 -8
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -1732,6 +1732,10 @@ function HomepageLayout(props) {
1732
1732
  frontmatter: frontmatter,
1733
1733
  routePath: routePath
1734
1734
  }),
1735
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageMoreTopics, {
1736
+ frontmatter: frontmatter,
1737
+ routePath: routePath
1738
+ }),
1735
1739
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageFeaturesTabs, {
1736
1740
  frontmatter: frontmatter,
1737
1741
  routePath: routePath
@@ -3141,6 +3145,11 @@ function HomeFeature({ frontmatter, routePath }) {
3141
3145
 
3142
3146
  function HomepageTopics({ frontmatter, routePath }) {
3143
3147
  const topics = frontmatter?.topics;
3148
+
3149
+ if (!topics || !topics.items || topics.items.length === 0) {
3150
+ return null;
3151
+ }
3152
+
3144
3153
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3145
3154
  className: "topics-container",
3146
3155
  children: [
@@ -3216,10 +3225,82 @@ function HomepageTopics({ frontmatter, routePath }) {
3216
3225
  });
3217
3226
  }
3218
3227
 
3228
+ function HomepageMoreTopics({ frontmatter, routePath }) {
3229
+ let moreTopicsList = frontmatter?.moreTopics;
3230
+
3231
+ if (!moreTopicsList) {
3232
+ return null;
3233
+ }
3234
+
3235
+ if (!Array.isArray(moreTopicsList)) {
3236
+ moreTopicsList = [moreTopicsList];
3237
+ }
3238
+
3239
+ if (moreTopicsList.length === 0) {
3240
+ return null;
3241
+ }
3242
+
3243
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3244
+ children: moreTopicsList.map((moreTopics, sectionIndex) => {
3245
+ if (!moreTopics.items || moreTopics.items.length === 0) {
3246
+ return null;
3247
+ }
3248
+
3249
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3250
+ className: "topics-container",
3251
+ children: [
3252
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3253
+ children: [
3254
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h2", {
3255
+ children: moreTopics.title ?? 'Topics',
3256
+ className: "topics-title"
3257
+ }),
3258
+ ],
3259
+ style: {
3260
+ display: 'flex',
3261
+ justifyContent: 'space-between',
3262
+ width: '100%',
3263
+ }
3264
+ }),
3265
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3266
+ className: "topics-grid",
3267
+ children: moreTopics.items.map((topicItem) => {
3268
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3269
+ className: "topics-card",
3270
+ children: [
3271
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3272
+ className: "topics-icon-wrapper",
3273
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3274
+ className: topicItem.icon + " topics-icon"
3275
+ })
3276
+ }),
3277
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3278
+ href: topicItem.link,
3279
+ className: "topics-link",
3280
+ children: topicItem.text
3281
+ }),
3282
+ topicItem.desc && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3283
+ className: "topics-desc",
3284
+ children: topicItem.desc
3285
+ })
3286
+ ]
3287
+ }, topicItem.text);
3288
+ })
3289
+ })
3290
+ ],
3291
+ className: "topics-div",
3292
+ }, moreTopics.title ?? sectionIndex);
3293
+ })
3294
+ });
3295
+ }
3219
3296
 
3220
3297
  function HomepageFeatures({ frontmatter, routePath }) {
3221
3298
  const features = frontmatter?.features;
3222
3299
 
3300
+ if(!features){
3301
+ return;
3302
+ }
3303
+
3223
3304
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3224
3305
  children: [
3225
3306
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3358,7 +3439,7 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3358
3439
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0);
3359
3440
  const featureTab = frontmatter?.featureTabs;
3360
3441
 
3361
- return featureTab ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3442
+ return featureTab && featureTab.tabs && featureTab.tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3362
3443
  className: "features-div",
3363
3444
  children: [
3364
3445
  //Tabs
@@ -3374,7 +3455,7 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3374
3455
  }),
3375
3456
 
3376
3457
  // Tab content
3377
- featureTab.tabs[activeTab].rows?.length > 0 ?
3458
+ featureTab.tabs[activeTab] && featureTab.tabs[activeTab].rows?.length > 0 ?
3378
3459
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3379
3460
  children: (featureTab.tabs[activeTab].rows || []).map((featuresRow) => {
3380
3461
  return featuresRow.items?.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3431,9 +3512,16 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3431
3512
  function HomepageFaqs({ frontmatter, routePath }) {
3432
3513
  const tabs = frontmatter?.faqTabs || [];
3433
3514
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(tabs[0]?.title || '');
3515
+ const [isExpanded, setIsExpanded] = __WEBPACK_EXTERNAL_MODULE_react__.useState(false);
3516
+ const DEFAULT_VISIBLE_COUNT = 5;
3434
3517
 
3435
3518
  const activeFaqs = tabs.find(tab => tab.title === activeTab);
3436
3519
 
3520
+ const handleTabClick = (title) => {
3521
+ setActiveTab(title);
3522
+ setIsExpanded(false);
3523
+ };
3524
+
3437
3525
  const renderFaqItem = (faqItem) => {
3438
3526
  // If item has a link, render as a clickable link row (same style as FAQ question)
3439
3527
  if (faqItem.link) {
@@ -3499,6 +3587,11 @@ function HomepageFaqs({ frontmatter, routePath }) {
3499
3587
  }, faqItem.question);
3500
3588
  };
3501
3589
 
3590
+ const visibleFaqs = activeFaqs
3591
+ ? (isExpanded ? activeFaqs.items : activeFaqs.items.slice(0, DEFAULT_VISIBLE_COUNT))
3592
+ : [];
3593
+ const hasMoreItems = activeFaqs && activeFaqs.items.length > DEFAULT_VISIBLE_COUNT;
3594
+
3502
3595
  return tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3503
3596
  className: "faqs-div",
3504
3597
  children: [
@@ -3508,21 +3601,51 @@ function HomepageFaqs({ frontmatter, routePath }) {
3508
3601
  children: tabs.map((tab) =>
3509
3602
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3510
3603
  className: activeTab === tab.title ? "faqs-tab active" : "faqs-tab",
3511
- onClick: () => setActiveTab(tab.title),
3604
+ onClick: () => handleTabClick(tab.title),
3512
3605
  children: tab.title
3513
3606
  }, tab.title)
3514
3607
  )
3515
3608
  }),
3516
3609
  // Content FAQ
3517
3610
  activeFaqs ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3518
- children: activeFaqs.items.map((faqItem) => renderFaqItem(faqItem)),
3611
+ children: visibleFaqs.map((faqItem) => renderFaqItem(faqItem)),
3519
3612
  className: "faqs-box"
3520
3613
  }) : null,
3614
+ // Show more / Show less button (outside the white box)
3615
+ hasMoreItems ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3616
+ className: "faqs-show-more",
3617
+ style: {
3618
+ textAlign: 'center',
3619
+ padding: '16px 0',
3620
+ cursor: 'pointer',
3621
+ },
3622
+ onClick: (e) => {
3623
+ e.preventDefault();
3624
+ setIsExpanded(!isExpanded);
3625
+ },
3626
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3627
+ style: {
3628
+ color: '#333',
3629
+ fontWeight: 500,
3630
+ fontSize: '14px',
3631
+ display: 'inline-flex',
3632
+ alignItems: 'center',
3633
+ gap: '6px',
3634
+ },
3635
+ children: [
3636
+ isExpanded ? "Show less" : "Show more",
3637
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3638
+ className: isExpanded ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down",
3639
+ style: { fontSize: '20px' }
3640
+ })
3641
+ ]
3642
+ })
3643
+ }) : null,
3521
3644
  ],
3522
3645
  style: {
3523
- width: '100%',
3524
- padding: '72px 40px 0 40px',
3525
- }
3646
+ width: '100%',
3647
+ padding: '72px 40px 0 40px',
3648
+ }
3526
3649
  }) : null;
3527
3650
  }
3528
3651
 
@@ -7233,4 +7356,4 @@ async function exportContentToPDF() {
7233
7356
  });
7234
7357
  }
7235
7358
 
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 };
7359
+ 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.31",
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.31",
25
+ "@rspress-theme-anatole/shared": "0.7.31",
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",