@rspress-theme-anatole/theme-default 0.1.3 → 0.1.4

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 +107 -3
  2. package/package.json +1 -1
package/dist/bundle.js CHANGED
@@ -1177,6 +1177,37 @@ function DocLayout(props) {
1177
1177
  ]
1178
1178
  });
1179
1179
  }
1180
+ function HomepageLayout(props) {
1181
+ const { page: { frontmatter, routePath } } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
1182
+
1183
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
1184
+ className: "relative",
1185
+ style: {
1186
+ minHeight: 'calc(100vh - var(--rp-nav-height))',
1187
+ },
1188
+ children: [
1189
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
1190
+ className: "pb-12",
1191
+ children: [
1192
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageTopSearch, {
1193
+ frontmatter: frontmatter,
1194
+ routePath: routePath
1195
+ }),
1196
+ // (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomeHero, {
1197
+ // frontmatter: frontmatter,
1198
+ // routePath: routePath
1199
+ // }),
1200
+ // (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomeFeature, {
1201
+ // frontmatter: frontmatter,
1202
+ // routePath: routePath
1203
+ // }),
1204
+ ]
1205
+ }),
1206
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomeFooter, {})
1207
+ ]
1208
+ });
1209
+ }
1210
+
1180
1211
  function HomeLayout(props) {
1181
1212
  const { beforeHero, afterHero, beforeFeatures, afterFeatures } = props;
1182
1213
  const { page: { frontmatter, routePath } } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
@@ -1208,6 +1239,7 @@ function HomeLayout(props) {
1208
1239
  ]
1209
1240
  });
1210
1241
  }
1242
+
1211
1243
  function useRedirect4FirstVisit() {
1212
1244
  const { siteData, page } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
1213
1245
  const defaultLang = siteData.lang || '';
@@ -1326,7 +1358,11 @@ const Layout = (props) => {
1326
1358
  useRedirect4FirstVisit();
1327
1359
  let title = frontmatter.title ?? articleTitle;
1328
1360
  const mainTitle = siteData.title || localesData.title || '';
1329
- title = title && 'doc' === pageType ? concatTitle(title, frontmatter.titleSuffix || mainTitle) : 'home' === pageType ? concatTitle(mainTitle, frontmatter.titleSuffix) : '404' === pageType ? concatTitle('404', mainTitle) : mainTitle;
1361
+ title = title &&
1362
+ 'doc' === pageType ? concatTitle(title, frontmatter.titleSuffix || mainTitle) :
1363
+ 'home' === pageType ? concatTitle(mainTitle, frontmatter.titleSuffix) :
1364
+ 'homepage' === pageType ? concatTitle(mainTitle, frontmatter.titleSuffix) :
1365
+ '404' === pageType ? concatTitle('404', mainTitle) : mainTitle;
1330
1366
  const description = frontmatter?.description || siteData.description || localesData.description;
1331
1367
  const uiSwitch = {
1332
1368
  ...useUISwitch(),
@@ -1334,6 +1370,10 @@ const Layout = (props) => {
1334
1370
  };
1335
1371
  const getContentLayout = () => {
1336
1372
  switch (pageType) {
1373
+ case 'homepage':
1374
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageLayout, {
1375
+ ...homeProps
1376
+ });
1337
1377
  case 'home':
1338
1378
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__["default"].HomeLayout, {
1339
1379
  ...homeProps
@@ -2540,7 +2580,7 @@ function HomeFooter() {
2540
2580
  alignItems: "center",
2541
2581
  letterSpacing: "-1%",
2542
2582
  padding: "0 40px",
2543
- borderTop: "1px solid #7E8695",
2583
+ borderTop: "1px solid #7E8695",
2544
2584
  }
2545
2585
  });
2546
2586
  }
@@ -2556,6 +2596,70 @@ const DEFAULT_HERO = {
2556
2596
  actions: [],
2557
2597
  image: void 0
2558
2598
  };
2599
+
2600
+ function HomepageTopSearch({ frontmatter, routePath }) {
2601
+ const hero = frontmatter?.hero || DEFAULT_HERO;
2602
+ const hasImage = void 0 !== hero.image;
2603
+ const textMaxWidth = hasImage ? 'sm:max-w-xl' : 'sm:max-w-4xl';
2604
+ const multiHeroText = hero.text ? hero.text.toString().split(/\n/g).filter((text) => '' !== text) : [];
2605
+ const imageSrc = 'string' == typeof hero.image?.src ? {
2606
+ light: hero.image.src,
2607
+ dark: hero.image.src
2608
+ } : hero.image?.src || {
2609
+ light: '',
2610
+ dark: ''
2611
+ };
2612
+
2613
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
2614
+ children: [
2615
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
2616
+ children: [
2617
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
2618
+ children: [
2619
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h1", {
2620
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
2621
+ style: {
2622
+ lineHeight: '1.3'
2623
+ },
2624
+ children: renderHtmlOrText(hero.name)
2625
+ })
2626
+ }),
2627
+ 0 !== multiHeroText.length && multiHeroText.map((heroText) => (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2628
+ style: {
2629
+ lineHeight: '1.2'
2630
+ },
2631
+ children: renderHtmlOrText(heroText)
2632
+ }, heroText)),
2633
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2634
+ children: renderHtmlOrText(hero.tagline)
2635
+ }),
2636
+ hero.actions?.length && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
2637
+ children: hero.actions.map((action) => {
2638
+ const link = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.isExternalUrl)(action.link) ? action.link : (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.normalizeHrefInRuntime)((0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.withBase)(action.link, routePath));
2639
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
2640
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__theme_75e53063__.Button, {
2641
+ type: "a",
2642
+ href: link,
2643
+ text: renderHtmlOrText(action.text),
2644
+ theme: action.theme,
2645
+ })
2646
+ }, link);
2647
+ })
2648
+ })
2649
+ ]
2650
+ }),
2651
+ ]
2652
+ })
2653
+ ],
2654
+ style: {
2655
+ height: "400px",
2656
+ backgroundColor: "green",
2657
+ backgroundImage: `url(${(0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.normalizeImagePath)(imageSrc.light)})`,
2658
+ backgroundSize: "cover",
2659
+ }
2660
+ });
2661
+ }
2662
+
2559
2663
  function HomeHero({ frontmatter, routePath }) {
2560
2664
  const hero = frontmatter?.hero || DEFAULT_HERO;
2561
2665
  const hasImage = void 0 !== hero.image;
@@ -4960,4 +5064,4 @@ const src_rslib_entry_ = {
4960
5064
  HomeLayout: HomeLayout,
4961
5065
  setup: setup
4962
5066
  };
4963
- export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeHero, HomeLayout, 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 };
5067
+ export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeHero, HomeLayout, HomepageLayout, 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.1.3",
4
+ "version": "0.1.4",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",