@rspress/core 1.2.1 → 1.3.1

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 (158) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +56 -43
  3. package/dist/index.js.map +1 -1
  4. package/dist/loader.d.ts +1 -1
  5. package/dist/loader.js.map +1 -1
  6. package/dist/runtime/App.js +8 -4
  7. package/dist/runtime/clientEntry.js +7 -4
  8. package/dist/runtime/ssrEntry.js +2 -2
  9. package/package.json +19 -15
  10. package/runtime.ts +1 -1
  11. package/src/runtime/App.tsx +8 -4
  12. package/src/runtime/clientEntry.tsx +7 -4
  13. package/src/runtime/ssrEntry.tsx +2 -2
  14. package/theme.ts +2 -2
  15. package/dist/runtime/Content.d.ts +0 -6
  16. package/dist/runtime/Content.js +0 -33
  17. package/dist/runtime/NoSSR.d.ts +0 -4
  18. package/dist/runtime/NoSSR.js +0 -17
  19. package/dist/runtime/hooks.d.ts +0 -39
  20. package/dist/runtime/hooks.js +0 -54
  21. package/dist/runtime/index.d.ts +0 -6
  22. package/dist/runtime/index.js +0 -34
  23. package/dist/runtime/utils.d.ts +0 -8
  24. package/dist/runtime/utils.js +0 -45
  25. package/dist/theme/bundle.css +0 -2691
  26. package/dist/theme/bundle.d.ts +0 -176
  27. package/dist/theme/bundle.js +0 -4433
  28. package/dist/theme/bundle.js.map +0 -1
  29. package/dist/theme/index.js +0 -6
  30. package/src/runtime/Content.tsx +0 -43
  31. package/src/runtime/NoSSR.tsx +0 -16
  32. package/src/runtime/hooks.ts +0 -110
  33. package/src/runtime/index.ts +0 -17
  34. package/src/runtime/utils.ts +0 -46
  35. package/src/theme-default/assets/arrow-down.svg +0 -1
  36. package/src/theme-default/assets/arrow-right.svg +0 -1
  37. package/src/theme-default/assets/copy.svg +0 -1
  38. package/src/theme-default/assets/down.svg +0 -1
  39. package/src/theme-default/assets/github.svg +0 -1
  40. package/src/theme-default/assets/loading.svg +0 -1
  41. package/src/theme-default/assets/menu.svg +0 -1
  42. package/src/theme-default/assets/moon.svg +0 -3
  43. package/src/theme-default/assets/right.svg +0 -1
  44. package/src/theme-default/assets/small-menu.svg +0 -1
  45. package/src/theme-default/assets/success.svg +0 -1
  46. package/src/theme-default/assets/sun.svg +0 -11
  47. package/src/theme-default/assets/translator.svg +0 -1
  48. package/src/theme-default/components/Aside/index.css +0 -22
  49. package/src/theme-default/components/Aside/index.tsx +0 -75
  50. package/src/theme-default/components/BackDrop/index.module.scss +0 -14
  51. package/src/theme-default/components/BackDrop/index.tsx +0 -13
  52. package/src/theme-default/components/Button/index.module.scss +0 -68
  53. package/src/theme-default/components/Button/index.tsx +0 -40
  54. package/src/theme-default/components/DocFooter/index.module.scss +0 -60
  55. package/src/theme-default/components/DocFooter/index.tsx +0 -66
  56. package/src/theme-default/components/EditLink/index.module.scss +0 -11
  57. package/src/theme-default/components/EditLink/index.tsx +0 -18
  58. package/src/theme-default/components/HomeFeatures/index.module.scss +0 -50
  59. package/src/theme-default/components/HomeFeatures/index.tsx +0 -65
  60. package/src/theme-default/components/HomeFooter/index.tsx +0 -15
  61. package/src/theme-default/components/HomeHero/index.module.scss +0 -42
  62. package/src/theme-default/components/HomeHero/index.tsx +0 -75
  63. package/src/theme-default/components/Link/index.module.scss +0 -9
  64. package/src/theme-default/components/Link/index.tsx +0 -90
  65. package/src/theme-default/components/LocalSideBar/index.scss +0 -40
  66. package/src/theme-default/components/LocalSideBar/index.tsx +0 -39
  67. package/src/theme-default/components/Nav/NavBarTitle.tsx +0 -43
  68. package/src/theme-default/components/Nav/NavMenuGroup.tsx +0 -156
  69. package/src/theme-default/components/Nav/NavMenuSingleItem.tsx +0 -40
  70. package/src/theme-default/components/Nav/NavTranslations.tsx +0 -16
  71. package/src/theme-default/components/Nav/NavVersions.tsx +0 -16
  72. package/src/theme-default/components/Nav/index.module.scss +0 -115
  73. package/src/theme-default/components/Nav/index.tsx +0 -150
  74. package/src/theme-default/components/Nav/menuDataHooks.tsx +0 -75
  75. package/src/theme-default/components/NavHambmger/index.module.scss +0 -81
  76. package/src/theme-default/components/NavHambmger/index.tsx +0 -39
  77. package/src/theme-default/components/NavScreen/NavScreenMenuGroup.tsx +0 -95
  78. package/src/theme-default/components/NavScreen/index.module.scss +0 -88
  79. package/src/theme-default/components/NavScreen/index.tsx +0 -123
  80. package/src/theme-default/components/Overview/index.module.scss +0 -154
  81. package/src/theme-default/components/Overview/index.tsx +0 -136
  82. package/src/theme-default/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  83. package/src/theme-default/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  84. package/src/theme-default/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  85. package/src/theme-default/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  86. package/src/theme-default/components/PackageManagerTabs/index.scss +0 -5
  87. package/src/theme-default/components/PackageManagerTabs/index.tsx +0 -110
  88. package/src/theme-default/components/Search/NoSearchResult.tsx +0 -13
  89. package/src/theme-default/components/Search/SearchPanel.tsx +0 -340
  90. package/src/theme-default/components/Search/SuggestItem.tsx +0 -135
  91. package/src/theme-default/components/Search/assets/close.svg +0 -1
  92. package/src/theme-default/components/Search/assets/file.svg +0 -1
  93. package/src/theme-default/components/Search/assets/header.svg +0 -1
  94. package/src/theme-default/components/Search/assets/jump.svg +0 -1
  95. package/src/theme-default/components/Search/assets/loading.svg +0 -1
  96. package/src/theme-default/components/Search/assets/search.svg +0 -1
  97. package/src/theme-default/components/Search/assets/title.svg +0 -1
  98. package/src/theme-default/components/Search/empty.svg +0 -4
  99. package/src/theme-default/components/Search/index.module.scss +0 -236
  100. package/src/theme-default/components/Search/index.tsx +0 -39
  101. package/src/theme-default/components/Search/logic/Provider.ts +0 -35
  102. package/src/theme-default/components/Search/logic/providers/LocalProvider.ts +0 -102
  103. package/src/theme-default/components/Search/logic/providers/RemoteProvider.ts +0 -40
  104. package/src/theme-default/components/Search/logic/search.ts +0 -341
  105. package/src/theme-default/components/Search/logic/util.test.ts +0 -21
  106. package/src/theme-default/components/Search/logic/util.ts +0 -127
  107. package/src/theme-default/components/Sidebar/SidebarGroup.tsx +0 -180
  108. package/src/theme-default/components/Sidebar/SidebarItem.tsx +0 -61
  109. package/src/theme-default/components/Sidebar/index.module.scss +0 -142
  110. package/src/theme-default/components/Sidebar/index.tsx +0 -156
  111. package/src/theme-default/components/SocialLinks/HiddenLinks.tsx +0 -30
  112. package/src/theme-default/components/SocialLinks/LinkContent.tsx +0 -90
  113. package/src/theme-default/components/SocialLinks/ShownLinks.tsx +0 -32
  114. package/src/theme-default/components/SocialLinks/index.module.scss +0 -18
  115. package/src/theme-default/components/SocialLinks/index.tsx +0 -36
  116. package/src/theme-default/components/SocialLinks/presetIcons.tsx +0 -165
  117. package/src/theme-default/components/SwitchAppearance/index.module.scss +0 -15
  118. package/src/theme-default/components/SwitchAppearance/index.tsx +0 -35
  119. package/src/theme-default/components/Tabs/index.module.scss +0 -46
  120. package/src/theme-default/components/Tabs/index.tsx +0 -123
  121. package/src/theme-default/components/Tag/index.tsx +0 -18
  122. package/src/theme-default/components/Toc/index.css +0 -18
  123. package/src/theme-default/components/Toc/index.tsx +0 -42
  124. package/src/theme-default/index.ts +0 -26
  125. package/src/theme-default/layout/DocLayout/docComponents/code.tsx +0 -112
  126. package/src/theme-default/layout/DocLayout/docComponents/hr.tsx +0 -10
  127. package/src/theme-default/layout/DocLayout/docComponents/index.module.scss +0 -69
  128. package/src/theme-default/layout/DocLayout/docComponents/index.tsx +0 -33
  129. package/src/theme-default/layout/DocLayout/docComponents/link.tsx +0 -22
  130. package/src/theme-default/layout/DocLayout/docComponents/list.tsx +0 -13
  131. package/src/theme-default/layout/DocLayout/docComponents/paragraph.tsx +0 -19
  132. package/src/theme-default/layout/DocLayout/docComponents/pre.tsx +0 -37
  133. package/src/theme-default/layout/DocLayout/docComponents/prisim-theme.ts +0 -73
  134. package/src/theme-default/layout/DocLayout/docComponents/table.tsx +0 -37
  135. package/src/theme-default/layout/DocLayout/docComponents/title.tsx +0 -40
  136. package/src/theme-default/layout/DocLayout/index.module.scss +0 -138
  137. package/src/theme-default/layout/DocLayout/index.tsx +0 -125
  138. package/src/theme-default/layout/HomeLayout/index.css +0 -18
  139. package/src/theme-default/layout/HomeLayout/index.tsx +0 -39
  140. package/src/theme-default/layout/Layout/index.tsx +0 -176
  141. package/src/theme-default/layout/NotFountLayout/index.tsx +0 -40
  142. package/src/theme-default/logic/TabDataContext.ts +0 -14
  143. package/src/theme-default/logic/index.ts +0 -8
  144. package/src/theme-default/logic/sideEffects.ts +0 -174
  145. package/src/theme-default/logic/useAppearance.ts +0 -57
  146. package/src/theme-default/logic/useEditLink.ts +0 -33
  147. package/src/theme-default/logic/useHiddenNav.ts +0 -58
  148. package/src/theme-default/logic/useLocaleSiteData.ts +0 -26
  149. package/src/theme-default/logic/useNav.ts +0 -36
  150. package/src/theme-default/logic/usePathUtils.ts +0 -73
  151. package/src/theme-default/logic/usePrevNextPage.ts +0 -40
  152. package/src/theme-default/logic/useSidebarData.ts +0 -73
  153. package/src/theme-default/logic/utils.ts +0 -38
  154. package/src/theme-default/styles/base.css +0 -102
  155. package/src/theme-default/styles/code.css +0 -177
  156. package/src/theme-default/styles/index.ts +0 -7
  157. package/src/theme-default/styles/scrollbar.css +0 -28
  158. package/src/theme-default/styles/vars.css +0 -81
@@ -1,165 +0,0 @@
1
- export default {
2
- discord: (
3
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
4
- <title>Discord</title>
5
- <path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
6
- </svg>
7
- ),
8
- facebook: (
9
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
10
- <title>Facebook</title>
11
- <path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
12
- </svg>
13
- ),
14
- github: (
15
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
16
- <title>GitHub</title>
17
- <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
18
- </svg>
19
- ),
20
- gitlab: (
21
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
22
- <title>GitLab</title>
23
- <path
24
- fill="currentColor"
25
- d="m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"
26
- ></path>
27
- </svg>
28
- ),
29
- instagram: (
30
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
31
- <title>Instagram</title>
32
- <path d="M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z" />
33
- </svg>
34
- ),
35
- linkedin: (
36
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
37
- <title>LinkedIn</title>
38
- <path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
39
- </svg>
40
- ),
41
- slack: (
42
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
43
- <title>Slack</title>
44
- <path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z" />
45
- </svg>
46
- ),
47
- twitter: (
48
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
49
- <title>Twitter</title>
50
- <path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z" />
51
- </svg>
52
- ),
53
- youtube: (
54
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
55
- <title>YouTube</title>
56
- <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
57
- </svg>
58
- ),
59
- juejin: (
60
- <svg
61
- className="icon"
62
- viewBox="0 0 1024 1024"
63
- version="1.1"
64
- xmlns="http://www.w3.org/2000/svg"
65
- data-spm-anchor-id="a313x.7781069.0.i5"
66
- >
67
- <path
68
- d="M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z"
69
- data-spm-anchor-id="a313x.7781069.0.i2"
70
- ></path>
71
- <path
72
- d="M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z"
73
- data-spm-anchor-id="a313x.7781069.0.i3"
74
- ></path>
75
- </svg>
76
- ),
77
- qq: (
78
- <svg
79
- xmlns="http://www.w3.org/2000/svg"
80
- aria-hidden="true"
81
- role="img"
82
- className="iconify iconify--ri"
83
- preserveAspectRatio="xMidYMid meet"
84
- viewBox="0 0 24 24"
85
- >
86
- <path
87
- fill="currentColor"
88
- d="M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"
89
- ></path>
90
- </svg>
91
- ),
92
- wechat: (
93
- <svg
94
- xmlns="http://www.w3.org/2000/svg"
95
- aria-hidden="true"
96
- role="img"
97
- className="iconify iconify--ri"
98
- preserveAspectRatio="xMidYMid meet"
99
- viewBox="0 0 24 24"
100
- >
101
- <path
102
- fill="currentColor"
103
- d="M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"
104
- ></path>
105
- </svg>
106
- ),
107
- weibo: (
108
- <svg
109
- xmlns="http://www.w3.org/2000/svg"
110
- aria-hidden="true"
111
- role="img"
112
- className="iconify iconify--ri"
113
- preserveAspectRatio="xMidYMid meet"
114
- viewBox="0 0 24 24"
115
- >
116
- <path
117
- fill="currentColor"
118
- d="M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"
119
- ></path>
120
- </svg>
121
- ),
122
- zhihu: (
123
- <svg
124
- xmlns="http://www.w3.org/2000/svg"
125
- aria-hidden="true"
126
- role="img"
127
- className="iconify iconify--ri"
128
- preserveAspectRatio="xMidYMid meet"
129
- viewBox="0 0 24 24"
130
- >
131
- <path
132
- fill="currentColor"
133
- d="m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"
134
- ></path>
135
- </svg>
136
- ),
137
- bilibili: (
138
- <svg
139
- xmlns="http://www.w3.org/2000/svg"
140
- aria-hidden="true"
141
- role="img"
142
- className="iconify iconify--ri"
143
- preserveAspectRatio="xMidYMid meet"
144
- viewBox="0 0 24 24"
145
- >
146
- <path
147
- fill="currentColor"
148
- d="M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"
149
- ></path>
150
- </svg>
151
- ),
152
- lark: (
153
- <svg
154
- xmlns="http://www.w3.org/2000/svg"
155
- width="48"
156
- height="48"
157
- viewBox="0 0 48 48"
158
- >
159
- <g fillRule="evenodd" clipRule="evenodd">
160
- <path d="M41.0716 5.99409L3.31071 16.5187L12.3856 25.8126L20.7998 25.9594L30.4827 16.5187C30.2266 15.9943 30.0985 15.5552 30.0985 15.2013C30.0985 14.4074 30.4104 13.7786 30.8947 13.333C31.7241 12.57 32.7222 12.4558 33.8889 12.9905L41.0716 5.99409Z" />
161
- <path d="M42.1021 6.72842L31.5775 44.4893L22.2836 35.4144L22.1367 27.0002L31.5115 17.4816C32.0195 17.8454 32.5743 18.0105 33.1759 17.9769C34.0784 17.9264 34.6614 17.3813 34.9349 17.0602C35.2083 16.7392 35.5293 16.2051 35.5025 15.4113C35.4847 14.8821 35.3109 14.3941 34.9812 13.9472L42.1021 6.72842Z" />
162
- </g>
163
- </svg>
164
- ),
165
- };
@@ -1,15 +0,0 @@
1
- .sun {
2
- opacity: 1;
3
- }
4
-
5
- .moon {
6
- opacity: 0;
7
- }
8
-
9
- :global(.dark) .sun {
10
- opacity: 0;
11
- }
12
-
13
- :global(.dark) .moon {
14
- opacity: 1;
15
- }
@@ -1,35 +0,0 @@
1
- import { useContext, useEffect } from 'react';
2
- import SunSvg from '../../assets/sun.svg';
3
- import MoonSvg from '../../assets/moon.svg';
4
- import { getToggle, isDarkMode } from '../../logic/useAppearance';
5
- import { ThemeContext } from '@/runtime';
6
-
7
- export function SwitchAppearance({ onClick }: { onClick?: () => void }) {
8
- const { theme, setTheme } = useContext(ThemeContext);
9
- const toggleAppearance = getToggle();
10
-
11
- useEffect(() => {
12
- if (isDarkMode()) {
13
- setTheme('dark');
14
- }
15
- }, []);
16
-
17
- return (
18
- <div
19
- onClick={() => {
20
- setTheme(theme === 'dark' ? 'light' : 'dark');
21
- toggleAppearance();
22
- onClick?.();
23
- }}
24
- className="md:mr-2 rspress-nav-appearance"
25
- >
26
- <div className="p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300">
27
- {theme === 'light' ? (
28
- <SunSvg width="18" height="18" fill="currentColor" />
29
- ) : (
30
- <MoonSvg width="18" height="18" fill="currentColor" />
31
- )}
32
- </div>
33
- </div>
34
- );
35
- }
@@ -1,46 +0,0 @@
1
- .container {
2
- background-color: var(--rp-code-block-bg);
3
- contain: content;
4
- border-radius: 16px;
5
-
6
- :global(div[class*='language-']) {
7
- margin: 6px 0;
8
- code {
9
- background-color: var(--rp-c-bg);
10
- }
11
- }
12
- }
13
-
14
- .tab-list {
15
- padding-left: 8px;
16
- padding-top: 4px;
17
- display: flex;
18
- min-width: 100%;
19
- background-color: var(--rp-code-title-bg);
20
- }
21
-
22
- .tab {
23
- color: var(--rp-c-text-2);
24
- border-bottom: 1px solid transparent;
25
- box-sizing: border-box;
26
- margin-right: 10px;
27
- padding: 6px 12px;
28
- margin-bottom: -1px;
29
- user-select: none;
30
- transition: all 0.2s ease-in-out;
31
- cursor: pointer;
32
- }
33
-
34
- .tab:last-child {
35
- margin-right: 0;
36
- }
37
-
38
- .not-selected:hover {
39
- color: var(--rp-c-text-1);
40
- border-color: var(--rp-c-gray);
41
- }
42
-
43
- .selected {
44
- color: var(--rp-c-brand-dark);
45
- border-color: var(--rp-c-brand-dark);
46
- }
@@ -1,123 +0,0 @@
1
- import {
2
- ComponentPropsWithRef,
3
- ReactElement,
4
- ReactNode,
5
- useContext,
6
- useState,
7
- } from 'react';
8
- import { TabDataContext } from '../../logic/TabDataContext';
9
- import styles from './index.module.scss';
10
-
11
- type TabItem = {
12
- value?: string;
13
- label?: string | ReactNode;
14
- disabled?: boolean;
15
- };
16
-
17
- interface TabsProps {
18
- values: ReactNode[] | ReadonlyArray<ReactNode> | TabItem[];
19
- defaultValue?: string;
20
- onChange?: (index: number) => void;
21
- children: ReactNode;
22
- groupId?: string;
23
- tabContainerClassName?: string;
24
- tabPosition?: 'left' | 'center';
25
- }
26
-
27
- function isTabItem(item: unknown): item is TabItem {
28
- if (item && typeof item === 'object' && 'label' in item) {
29
- return true;
30
- }
31
- return false;
32
- }
33
-
34
- const renderTab = (item: ReactNode | TabItem) => {
35
- if (isTabItem(item)) {
36
- return item.label || item.value;
37
- }
38
- return item;
39
- };
40
-
41
- export function Tabs(props: TabsProps): ReactElement {
42
- const {
43
- values,
44
- defaultValue,
45
- onChange,
46
- children,
47
- groupId,
48
- tabPosition = 'left',
49
- tabContainerClassName,
50
- } = props;
51
- let tabValues = values || [];
52
- if (tabValues.length === 0) {
53
- tabValues = (children as ReactElement[]).map(child => ({
54
- label: child.props?.label,
55
- value: child.props?.value || child.props?.label,
56
- }));
57
- }
58
- const { tabData, setTabData } = useContext(TabDataContext);
59
- let defaultIndex = 0;
60
- const needSync = groupId && tabData[groupId] !== undefined;
61
- if (needSync) {
62
- defaultIndex = tabData[groupId];
63
- } else if (defaultValue) {
64
- defaultIndex = tabValues.findIndex(item => {
65
- if (typeof item === 'string') {
66
- return item === defaultValue;
67
- } else if (item && typeof item === 'object' && 'value' in item) {
68
- return item.value === defaultValue;
69
- }
70
- return false;
71
- });
72
- }
73
- const [activeIndex, setActiveIndex] = useState(defaultIndex);
74
-
75
- return (
76
- <div className={styles.container}>
77
- <div className={tabContainerClassName}>
78
- {tabValues.length ? (
79
- <div
80
- className={styles.tabList}
81
- style={{
82
- justifyContent:
83
- tabPosition === 'center' ? 'center' : 'flex-start',
84
- }}
85
- >
86
- {tabValues.map((item, index) => {
87
- return (
88
- <div
89
- // eslint-disable-next-line react/no-array-index-key
90
- key={index}
91
- className={`${styles.tab} ${
92
- activeIndex === index ? styles.selected : styles.notSelected
93
- }`}
94
- onClick={() => {
95
- onChange?.(index);
96
- setActiveIndex(index);
97
- if (groupId) {
98
- setTabData({ ...tabData, [groupId]: index });
99
- }
100
- }}
101
- >
102
- {renderTab(item)}
103
- </div>
104
- );
105
- })}
106
- </div>
107
- ) : null}
108
- </div>
109
- <div>{children[activeIndex]}</div>
110
- </div>
111
- );
112
- }
113
-
114
- export function Tab({
115
- children,
116
- ...props
117
- }: ComponentPropsWithRef<'div'>): ReactElement {
118
- return (
119
- <div {...props} className="rounded px-2">
120
- {children}
121
- </div>
122
- );
123
- }
@@ -1,18 +0,0 @@
1
- export const Tag = ({ tag }: { tag?: string }) => {
2
- if (!tag) {
3
- return null;
4
- }
5
- const isSvgTagString = tag.trim().startsWith('<svg');
6
-
7
- if (isSvgTagString) {
8
- return (
9
- <div
10
- // eslint-disable-next-line react/no-danger
11
- dangerouslySetInnerHTML={{ __html: tag }}
12
- style={{ width: 20, marginRight: 4 }}
13
- ></div>
14
- );
15
- } else {
16
- return <img src={tag} />;
17
- }
18
- };
@@ -1,18 +0,0 @@
1
- .toc-link {
2
- padding-bottom: 1px;
3
- }
4
-
5
- .toc-link-text {
6
- padding: 4px 12px;
7
- white-space: nowrap;
8
- overflow: hidden;
9
- text-overflow: ellipsis;
10
- transition: all 0.2s ease-in-out;
11
- border-radius: 10px 0 0 10px;
12
- font-size: 16px;
13
- line-height: 1.75rem;
14
- }
15
-
16
- .toc-link-text:hover {
17
- background-color: var(--rp-c-bg-mute);
18
- }
@@ -1,42 +0,0 @@
1
- import { Header } from '@rspress/shared';
2
- import { usePageData } from '@/runtime';
3
- import { scrollToTarget } from '@/theme-default';
4
- import './index.css';
5
-
6
- const TocItem = (header: Header) => {
7
- return (
8
- <li key={header.id} className={'py-1'}>
9
- <a
10
- href={`#${header.id}`}
11
- className={
12
- 'toc-link transition-all duration-300 hover:text-text-1 text-text-2 block underline underline-offset-2'
13
- }
14
- style={{
15
- marginLeft: header.depth * 12,
16
- }}
17
- onClick={e => {
18
- e.preventDefault();
19
- window.location.hash = header.id;
20
- const target = document.getElementById(header.id);
21
- if (target) {
22
- scrollToTarget(target, false);
23
- }
24
- }}
25
- >
26
- <span className={'toc-link-text block'}>{header.text}</span>
27
- </a>
28
- </li>
29
- );
30
- };
31
-
32
- export function Toc() {
33
- const { page } = usePageData();
34
-
35
- return (
36
- <ul>
37
- {page.toc.map(item => (
38
- <TocItem key={item.id} {...item} />
39
- ))}
40
- </ul>
41
- );
42
- }
@@ -1,26 +0,0 @@
1
- import { NotFoundLayout } from './layout/NotFountLayout';
2
- import { Layout } from './layout/Layout';
3
- import { HomeLayout } from './layout/HomeLayout';
4
- import { setup } from './logic';
5
-
6
- export { Nav } from './components/Nav';
7
- export { Search, SearchPanel } from './components/Search';
8
- export { Tab, Tabs } from './components/Tabs';
9
- export { Button } from './components/Button';
10
- export { Link } from './components/Link';
11
- export { HomeFooter } from './components/HomeFooter';
12
- export { Toc } from './components/Toc';
13
- export { PackageManagerTabs } from './components/PackageManagerTabs';
14
-
15
- export default {
16
- Layout,
17
- NotFoundLayout,
18
- HomeLayout,
19
- setup,
20
- };
21
-
22
- export { getCustomMDXComponent } from './layout/DocLayout/docComponents';
23
-
24
- export * from './logic';
25
-
26
- export { Layout, NotFoundLayout, HomeLayout };
@@ -1,112 +0,0 @@
1
- import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';
2
- import languagesInfo from 'virtual-prism-languages';
3
- import copy from 'copy-to-clipboard';
4
- import { useRef } from 'react';
5
- import style from './prisim-theme';
6
- import { usePageData } from '@/runtime';
7
-
8
- let registered = false;
9
- const timeoutIdMap: Map<HTMLElement, NodeJS.Timeout> = new Map();
10
-
11
- export interface CodeProps {
12
- children: string;
13
- className?: string;
14
- meta?: string;
15
- }
16
-
17
- function registerLanguages() {
18
- Object.keys(languagesInfo).forEach(key => {
19
- SyntaxHighlighter.registerLanguage(key, languagesInfo[key]);
20
- });
21
- registered = true;
22
- }
23
-
24
- export function Code(props: CodeProps) {
25
- const copyButtonRef = useRef<HTMLButtonElement>(null);
26
- const { siteData } = usePageData();
27
- const { showLineNumbers } = siteData.markdown;
28
- if (!registered) {
29
- registerLanguages();
30
- }
31
- const { className, meta } = props;
32
- const language = className?.replace(/language-/, '');
33
- if (!language) {
34
- return <code {...props}></code>;
35
- }
36
- let children: string;
37
- if (typeof props.children === 'string') {
38
- children = props.children.trim();
39
- } else if (Array.isArray(props.children)) {
40
- children = (props.children[0] as string).trim();
41
- } else {
42
- children = '';
43
- }
44
- let highlightMeta = '';
45
- let highlightLines: number[] = [];
46
- if (meta) {
47
- const highlightReg = /{[\d,-]*}/i;
48
- highlightMeta = highlightReg.exec(meta)?.[0] || '';
49
- if (highlightMeta) {
50
- highlightLines = highlightMeta
51
- .replace(/[{}]/g, '')
52
- .split(',')
53
- .map(item => {
54
- const [start, end] = item.split('-');
55
- if (end) {
56
- return Array.from(
57
- { length: Number(end) - Number(start) + 1 },
58
- (_, i) => i + Number(start),
59
- );
60
- }
61
- return Number(start);
62
- })
63
- .flat();
64
- }
65
- }
66
-
67
- const copyCode = () => {
68
- const isCopied = copy(children);
69
- const el = copyButtonRef.current;
70
-
71
- if (isCopied && el) {
72
- el.classList.add('copied');
73
- clearTimeout(timeoutIdMap.get(el));
74
- const timeoutId = setTimeout(() => {
75
- el.classList.remove('copied');
76
- el.blur();
77
- timeoutIdMap.delete(el);
78
- }, 2000);
79
- timeoutIdMap.set(el, timeoutId);
80
- }
81
- };
82
-
83
- return (
84
- <>
85
- <SyntaxHighlighter
86
- language={language}
87
- style={style}
88
- wrapLines={true}
89
- className="code"
90
- customStyle={{ backgroundColor: 'inherit' }}
91
- // Notice: if the highlight line is specified, the line number must be displayed
92
- showLineNumbers={showLineNumbers || highlightLines.length > 0}
93
- lineProps={lineNumber => {
94
- const isHighlighted = highlightLines.includes(lineNumber);
95
- return {
96
- className: isHighlighted ? 'line highlighted' : '',
97
- style: {
98
- backgroundColor: isHighlighted
99
- ? 'var(--rp-code-line-highlight-color)'
100
- : '',
101
- display: 'block',
102
- padding: '0 1.25rem',
103
- },
104
- };
105
- }}
106
- >
107
- {children}
108
- </SyntaxHighlighter>
109
- <button className="copy" onClick={copyCode} ref={copyButtonRef}></button>
110
- </>
111
- );
112
- }
@@ -1,10 +0,0 @@
1
- import { ComponentProps } from 'react';
2
-
3
- export const Hr = (props: ComponentProps<'hr'>) => {
4
- return (
5
- <hr
6
- {...props}
7
- className="my-12 border-t bordder-solid border-divider-light"
8
- />
9
- );
10
- };