@rspress-theme-anatole/theme-default 0.1.2 → 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.
package/dist/bundle.css CHANGED
@@ -3507,14 +3507,4 @@ p {
3507
3507
 
3508
3508
  .rspress-nav {
3509
3509
  border-bottom: 1px solid var(--Colors-Neutral-3, #D2D5DA);
3510
- }
3511
-
3512
- footer {
3513
- background-color: #32363E;
3514
- height: 60px;
3515
- }
3516
-
3517
- .footer-link {
3518
- display: flex;
3519
- gap: 20px;
3520
3510
  }
package/dist/bundle.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE__mdx_js_react_0d3abecb__ from "@mdx-js/react";
3
- import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress-theme-anatole/runtime";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__ from "@rspress/runtime";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__theme_75e53063__ from "@theme";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE_github_slugger_8e9a17cb__ from "github-slugger";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
@@ -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)();
@@ -1184,7 +1215,7 @@ function HomeLayout(props) {
1184
1215
  className: "relative",
1185
1216
  style: {
1186
1217
  minHeight: 'calc(100vh - var(--rp-nav-height))',
1187
- paddingBottom: '80px'
1218
+ // paddingBottom: '80px'
1188
1219
  },
1189
1220
  children: [
1190
1221
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
@@ -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
@@ -2483,27 +2523,65 @@ function HomeFeature({ frontmatter, routePath }) {
2483
2523
 
2484
2524
  function HomeFooter() {
2485
2525
  const { siteData } = (0, __WEBPACK_EXTERNAL_MODULE__rspress_runtime_0abd3046__.usePageData)();
2486
- const { message } = siteData.themeConfig.footer || {};
2526
+ const { group, message, links, social } = siteData.themeConfig.footer || {};
2487
2527
  if (!message) return null;
2488
2528
  return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("footer", {
2489
- className: "absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",
2490
- children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
2491
- className: "m-auto w-full text-center",
2492
- children: [
2493
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
2494
- className: "font-medium text-sm text-text-2",
2495
- dangerouslySetInnerHTML: {
2496
- __html: message
2497
- }
2498
- }),
2499
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
2500
- className: "font-medium text-sm text-text-2",
2501
- dangerouslySetInnerHTML: {
2502
- __html: message
2503
- }
2504
- }),
2505
- ]
2506
- })
2529
+ children: [
2530
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2531
+ dangerouslySetInnerHTML: {
2532
+ __html: group.map((groupItem) => { return `<a href="${groupItem.link}" class="">${groupItem.text}</a>` }).join("")
2533
+ },
2534
+ style: {
2535
+ gap: "20px",
2536
+ display: "flex",
2537
+ fontWeight: "600",
2538
+ }
2539
+ }),
2540
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2541
+ dangerouslySetInnerHTML: {
2542
+ __html: links.map((link) => { return `<a href="${link.link}" class="">${link.text}</a>` }).join("")
2543
+ },
2544
+ style: {
2545
+ gap: "20px",
2546
+ display: "flex",
2547
+ fontWeight: "600",
2548
+
2549
+ }
2550
+ }),
2551
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2552
+ dangerouslySetInnerHTML: {
2553
+ __html: message
2554
+ },
2555
+ style: {
2556
+ display: "flex",
2557
+ fontWeight: "400",
2558
+
2559
+ }
2560
+ }),
2561
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
2562
+ dangerouslySetInnerHTML: {
2563
+ __html: social.map((socialItem) => { return `<a href="${socialItem.link}" class="">${socialItem.text}</a>` }).join("")
2564
+ },
2565
+ style: {
2566
+ gap: "20px",
2567
+ display: "flex",
2568
+ fontWeight: "400",
2569
+ lineHeight: "18px",
2570
+ }
2571
+ }),
2572
+ ],
2573
+ style: {
2574
+ height: "60px",
2575
+ background: "#32363E",
2576
+ color: "var(--Colors-White, #fff)",
2577
+ fontSize: "14px",
2578
+ display: "flex",
2579
+ justifyContent: "space-between",
2580
+ alignItems: "center",
2581
+ letterSpacing: "-1%",
2582
+ padding: "0 40px",
2583
+ borderTop: "1px solid #7E8695",
2584
+ }
2507
2585
  });
2508
2586
  }
2509
2587
 
@@ -2518,6 +2596,70 @@ const DEFAULT_HERO = {
2518
2596
  actions: [],
2519
2597
  image: void 0
2520
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
+
2521
2663
  function HomeHero({ frontmatter, routePath }) {
2522
2664
  const hero = frontmatter?.hero || DEFAULT_HERO;
2523
2665
  const hasImage = void 0 !== hero.image;
@@ -4922,4 +5064,4 @@ const src_rslib_entry_ = {
4922
5064
  HomeLayout: HomeLayout,
4923
5065
  setup: setup
4924
5066
  };
4925
- 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.2",
4
+ "version": "0.1.4",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -32,8 +32,8 @@
32
32
  "react-dom": "^18.3.1",
33
33
  "react-helmet-async": "^1.3.0",
34
34
  "react-syntax-highlighter": "^15.6.1",
35
- "@rspress-theme-anatole/runtime": "0.1.2",
36
- "@rspress-theme-anatole/shared": "0.1.2"
35
+ "@rspress/runtime": "1.43.8",
36
+ "@rspress-theme-anatole/shared": "0.1.3"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@microsoft/api-extractor": "^7.49.2",
package/package1.json DELETED
@@ -1,89 +0,0 @@
1
- {
2
- "name": "rspress-theme-anatole/theme-default",
3
- "version": "0.0.10",
4
- "description": "Anatole theme for Rspress",
5
- "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/web-infra-dev/rspress",
9
- "directory": "packages/theme-default"
10
- },
11
- "license": "MIT",
12
- "sideEffects": [
13
- "*.css",
14
- "*.less",
15
- "*.sass",
16
- "*.scss",
17
- "**/virtual-global-styles.js",
18
- "virtual-global-styles",
19
- "./src/styles/index.ts",
20
- "./dist/index.js"
21
- ],
22
- "type": "module",
23
- "imports": {
24
- "#theme/*": "./src/*"
25
- },
26
- "exports": {
27
- ".": {
28
- "types": "./dist/bundle.d.ts",
29
- "default": "./dist/index.js"
30
- },
31
- "./node/*": "./dist/node/*",
32
- "./package.json": "./package.json",
33
- "./bundle.css": "./dist/bundle.css"
34
- },
35
- "main": "./dist/index.js",
36
- "types": "./dist/bundle.d.ts",
37
- "files": [
38
- "dist"
39
- ],
40
- "dependencies": {
41
- "@mdx-js/react": "2.3.0",
42
- "body-scroll-lock": "4.0.0-beta.0",
43
- "copy-to-clipboard": "^3.3.3",
44
- "flexsearch": "0.7.43",
45
- "github-slugger": "^2.0.0",
46
- "htmr": "^1.0.2",
47
- "lodash-es": "^4.17.21",
48
- "nprogress": "^0.2.0",
49
- "react": "^18.3.1",
50
- "react-dom": "^18.3.1",
51
- "react-helmet-async": "^1.3.0",
52
- "react-syntax-highlighter": "^15.6.1",
53
- "@rspress-theme-anatole/runtime": "0.1.0",
54
- "@rspress-theme-anatole/shared": "0.1.0"
55
- },
56
- "devDependencies": {
57
- "@microsoft/api-extractor": "^7.49.2",
58
- "@modern-js/tsconfig": "2.64.0",
59
- "@rsbuild/plugin-react": "~1.1.0",
60
- "@rsbuild/plugin-sass": "~1.2.0",
61
- "@rsbuild/plugin-svgr": "^1.0.6",
62
- "@rslib/core": "0.5.2",
63
- "@types/body-scroll-lock": "^3.1.2",
64
- "@types/hast": "^2.3.10",
65
- "@types/jest": "~29.5.14",
66
- "@types/lodash-es": "^4.17.12",
67
- "@types/mdast": "^3.0.15",
68
- "@types/nprogress": "^0.2.3",
69
- "@types/react": "^18.3.18",
70
- "@types/react-dom": "^18.3.5",
71
- "@types/react-syntax-highlighter": "^15.5.13",
72
- "gray-matter": "4.0.3",
73
- "tailwindcss": "^3.4.17",
74
- "typescript": "^5.5.3"
75
- },
76
- "engines": {
77
- "node": ">=14.17.6"
78
- },
79
- "publishConfig": {
80
- "access": "public",
81
- "provenance": true,
82
- "registry": "https://registry.npmjs.org/"
83
- },
84
- "scripts": {
85
- "build": "rslib build",
86
- "dev": "rslib build -w",
87
- "reset": "rimraf ./**/node_modules"
88
- }
89
- }