@rspress-theme-anatole/theme-default 0.7.29 → 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 +135 -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
@@ -1775,6 +1779,10 @@ function GettingStartLayout(props) {
1775
1779
  frontmatter: frontmatter,
1776
1780
  routePath: routePath
1777
1781
  }),
1782
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageFeaturesTabs, {
1783
+ frontmatter: frontmatter,
1784
+ routePath: routePath
1785
+ }),
1778
1786
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(PopularTopicsSection, {
1779
1787
  frontmatter: frontmatter,
1780
1788
  routePath: routePath
@@ -3137,6 +3145,11 @@ function HomeFeature({ frontmatter, routePath }) {
3137
3145
 
3138
3146
  function HomepageTopics({ frontmatter, routePath }) {
3139
3147
  const topics = frontmatter?.topics;
3148
+
3149
+ if (!topics || !topics.items || topics.items.length === 0) {
3150
+ return null;
3151
+ }
3152
+
3140
3153
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3141
3154
  className: "topics-container",
3142
3155
  children: [
@@ -3212,10 +3225,82 @@ function HomepageTopics({ frontmatter, routePath }) {
3212
3225
  });
3213
3226
  }
3214
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
+ }
3215
3296
 
3216
3297
  function HomepageFeatures({ frontmatter, routePath }) {
3217
3298
  const features = frontmatter?.features;
3218
3299
 
3300
+ if(!features){
3301
+ return;
3302
+ }
3303
+
3219
3304
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3220
3305
  children: [
3221
3306
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3354,7 +3439,7 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3354
3439
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0);
3355
3440
  const featureTab = frontmatter?.featureTabs;
3356
3441
 
3357
- 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", {
3358
3443
  className: "features-div",
3359
3444
  children: [
3360
3445
  //Tabs
@@ -3370,7 +3455,7 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3370
3455
  }),
3371
3456
 
3372
3457
  // Tab content
3373
- featureTab.tabs[activeTab].rows?.length > 0 ?
3458
+ featureTab.tabs[activeTab] && featureTab.tabs[activeTab].rows?.length > 0 ?
3374
3459
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3375
3460
  children: (featureTab.tabs[activeTab].rows || []).map((featuresRow) => {
3376
3461
  return featuresRow.items?.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
@@ -3427,9 +3512,16 @@ function HomepageFeaturesTabs({ frontmatter, routePath }) {
3427
3512
  function HomepageFaqs({ frontmatter, routePath }) {
3428
3513
  const tabs = frontmatter?.faqTabs || [];
3429
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;
3430
3517
 
3431
3518
  const activeFaqs = tabs.find(tab => tab.title === activeTab);
3432
3519
 
3520
+ const handleTabClick = (title) => {
3521
+ setActiveTab(title);
3522
+ setIsExpanded(false);
3523
+ };
3524
+
3433
3525
  const renderFaqItem = (faqItem) => {
3434
3526
  // If item has a link, render as a clickable link row (same style as FAQ question)
3435
3527
  if (faqItem.link) {
@@ -3495,6 +3587,11 @@ function HomepageFaqs({ frontmatter, routePath }) {
3495
3587
  }, faqItem.question);
3496
3588
  };
3497
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
+
3498
3595
  return tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3499
3596
  className: "faqs-div",
3500
3597
  children: [
@@ -3504,21 +3601,51 @@ function HomepageFaqs({ frontmatter, routePath }) {
3504
3601
  children: tabs.map((tab) =>
3505
3602
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3506
3603
  className: activeTab === tab.title ? "faqs-tab active" : "faqs-tab",
3507
- onClick: () => setActiveTab(tab.title),
3604
+ onClick: () => handleTabClick(tab.title),
3508
3605
  children: tab.title
3509
3606
  }, tab.title)
3510
3607
  )
3511
3608
  }),
3512
3609
  // Content FAQ
3513
3610
  activeFaqs ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3514
- children: activeFaqs.items.map((faqItem) => renderFaqItem(faqItem)),
3611
+ children: visibleFaqs.map((faqItem) => renderFaqItem(faqItem)),
3515
3612
  className: "faqs-box"
3516
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,
3517
3644
  ],
3518
3645
  style: {
3519
- width: '100%',
3520
- padding: '72px 40px 0 40px',
3521
- }
3646
+ width: '100%',
3647
+ padding: '72px 40px 0 40px',
3648
+ }
3522
3649
  }) : null;
3523
3650
  }
3524
3651
 
@@ -7229,4 +7356,4 @@ async function exportContentToPDF() {
7229
7356
  });
7230
7357
  }
7231
7358
 
7232
- 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.29",
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.29",
25
- "@rspress-theme-anatole/shared": "0.7.29",
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",