@rimelight/ui 0.0.32 → 0.0.34

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 (402) hide show
  1. package/README.md +135 -8
  2. package/package.json +17 -20
  3. package/src/components/TableOfContents.astro +44 -43
  4. package/src/components/astro/RLA3dHover.astro +22 -18
  5. package/src/components/astro/RLAAlert.astro +93 -62
  6. package/src/components/astro/RLAApp.astro +22 -18
  7. package/src/components/astro/RLAAspectRatio.astro +27 -23
  8. package/src/components/astro/RLAAudio.astro +22 -18
  9. package/src/components/astro/RLAAvatar.astro +68 -56
  10. package/src/components/astro/RLAAvatarGroup.astro +23 -19
  11. package/src/components/astro/RLABadge.astro +34 -33
  12. package/src/components/astro/RLABanner.astro +22 -18
  13. package/src/components/astro/RLABreadcrumb.astro +48 -44
  14. package/src/components/astro/RLABrowserMockup.astro +22 -18
  15. package/src/components/astro/RLAButton.astro +141 -90
  16. package/src/components/astro/RLACalendar.astro +22 -18
  17. package/src/components/astro/RLACard.astro +78 -74
  18. package/src/components/astro/RLACarousel.astro +75 -71
  19. package/src/components/astro/RLAChangelog.astro +22 -18
  20. package/src/components/astro/RLAChart.astro +19 -34
  21. package/src/components/astro/RLAChat.astro +22 -18
  22. package/src/components/astro/RLAChatMessage.astro +22 -18
  23. package/src/components/astro/RLAChatMessages.astro +22 -18
  24. package/src/components/astro/RLAChatPalette.astro +22 -18
  25. package/src/components/astro/RLAChatPrompt.astro +22 -18
  26. package/src/components/astro/RLAChatPromptSubmit.astro +22 -18
  27. package/src/components/astro/RLAChatReasoning.astro +22 -18
  28. package/src/components/astro/RLAChatShimmer.astro +22 -18
  29. package/src/components/astro/RLAChatTool.astro +22 -18
  30. package/src/components/astro/RLAChip.astro +51 -20
  31. package/src/components/astro/RLAColorPicker.astro +22 -18
  32. package/src/components/astro/RLACommandPalette.astro +22 -18
  33. package/src/components/astro/RLACompare.astro +22 -18
  34. package/src/components/astro/RLAConfirm.astro +117 -86
  35. package/src/components/astro/RLAContainer.astro +22 -18
  36. package/src/components/astro/RLAContextMenu.astro +22 -18
  37. package/src/components/astro/RLADashboardGroup.astro +22 -18
  38. package/src/components/astro/RLADashboardNavbar.astro +22 -18
  39. package/src/components/astro/RLADashboardPanel.astro +22 -18
  40. package/src/components/astro/RLADashboardResizeHandle.astro +22 -18
  41. package/src/components/astro/RLADashboardSearch.astro +22 -18
  42. package/src/components/astro/RLADashboardSearchButton.astro +22 -18
  43. package/src/components/astro/RLADashboardSidebar.astro +22 -18
  44. package/src/components/astro/RLADashboardSidebarCollapse.astro +22 -18
  45. package/src/components/astro/RLADashboardSidebarToggle.astro +22 -18
  46. package/src/components/astro/RLADashboardToolbar.astro +22 -18
  47. package/src/components/astro/RLADock.astro +22 -18
  48. package/src/{plugins/starlightAddons/components/Gamepad.astro → components/astro/RLADocsGamepad.astro} +178 -180
  49. package/src/{plugins/starlightAddons/components/Keyboard.astro → components/astro/RLADocsKeyboard.astro} +1 -3
  50. package/src/{plugins/starlightAddons/PackageManagers.astro → components/astro/RLADocsPackageManagers.astro} +28 -14
  51. package/src/components/astro/RLADrawer.astro +78 -74
  52. package/src/components/astro/RLAEditor.astro +22 -18
  53. package/src/components/astro/RLAEmpty.astro +22 -18
  54. package/src/components/astro/RLAError.astro +22 -18
  55. package/src/components/astro/RLAFieldset.astro +22 -18
  56. package/src/components/astro/RLAFloatingAction.astro +22 -18
  57. package/src/components/astro/RLAFooter.astro +39 -35
  58. package/src/components/astro/RLAForm.astro +23 -19
  59. package/src/components/astro/RLAGallery.astro +22 -18
  60. package/src/components/astro/RLAGrid.astro +39 -0
  61. package/src/components/astro/RLAHead.astro +427 -180
  62. package/src/components/astro/RLAHeader.astro +12 -53
  63. package/src/components/astro/RLAHoverCard.astro +35 -31
  64. package/src/components/astro/RLAIcon.astro +31 -27
  65. package/src/components/astro/RLAImage.astro +251 -19
  66. package/src/components/astro/RLAInputDate.astro +22 -18
  67. package/src/components/astro/RLAInputNumber.astro +22 -18
  68. package/src/components/astro/RLAInputTags.astro +22 -18
  69. package/src/components/astro/RLAInputTime.astro +22 -18
  70. package/src/components/astro/RLAKbd.astro +32 -22
  71. package/src/components/astro/RLAKnob.astro +22 -18
  72. package/src/components/astro/RLALabel.astro +27 -23
  73. package/src/components/astro/RLALink.astro +13 -10
  74. package/src/components/astro/RLALinkGroup.astro +99 -18
  75. package/src/components/astro/RLAListbox.astro +22 -18
  76. package/src/components/astro/RLALocaleSelector.astro +136 -109
  77. package/src/components/astro/RLALogo.astro +90 -56
  78. package/src/components/astro/RLAMain.astro +15 -4
  79. package/src/components/astro/RLAMarquee.astro +43 -32
  80. package/src/components/astro/RLAMegamenu.astro +22 -18
  81. package/src/components/astro/RLAMeter.astro +22 -18
  82. package/src/components/astro/RLAModal.astro +99 -95
  83. package/src/components/astro/RLANavigationMenu.astro +326 -136
  84. package/src/components/astro/RLAPage.astro +22 -18
  85. package/src/components/astro/RLAPageAside.astro +22 -18
  86. package/src/components/astro/RLAPageBody.astro +22 -18
  87. package/src/components/astro/RLAPageHeader.astro +22 -18
  88. package/src/components/astro/RLAPageSection.astro +5 -1
  89. package/src/components/astro/RLAPagination.astro +96 -94
  90. package/src/components/astro/RLAPassword.astro +22 -18
  91. package/src/components/astro/RLAPhoneMockup.astro +22 -18
  92. package/src/components/astro/RLAPinInput.astro +23 -0
  93. package/src/components/astro/RLAPlaceholder.astro +45 -41
  94. package/src/components/astro/RLAPopover.astro +35 -31
  95. package/src/components/astro/RLAPost.astro +65 -19
  96. package/src/components/astro/RLAPricingPlan.astro +22 -18
  97. package/src/components/astro/RLAPricingTable.astro +22 -18
  98. package/src/components/astro/RLAProgress.astro +8 -2
  99. package/src/components/astro/RLAProse.astro +22 -18
  100. package/src/components/astro/RLAQrCode.astro +22 -18
  101. package/src/components/astro/RLARadioGroup.astro +22 -18
  102. package/src/components/astro/RLARating.astro +22 -18
  103. package/src/components/astro/RLASelect.astro +38 -24
  104. package/src/components/astro/RLASeparator.astro +78 -27
  105. package/src/components/astro/RLASidebar.astro +212 -135
  106. package/src/components/astro/RLASkeleton.astro +24 -20
  107. package/src/components/astro/RLASlideover.astro +141 -72
  108. package/src/components/astro/RLASlider.astro +14 -14
  109. package/src/components/astro/RLASpeedDial.astro +22 -18
  110. package/src/components/astro/RLASplitter.astro +14 -2
  111. package/src/components/astro/RLASpoiler.astro +22 -18
  112. package/src/components/astro/RLAStepper.astro +22 -18
  113. package/src/components/astro/RLASteps.astro +71 -0
  114. package/src/components/astro/RLAStickySurface.astro +38 -27
  115. package/src/components/astro/RLATableOfContents.astro +22 -18
  116. package/src/components/astro/RLATabs.astro +133 -92
  117. package/src/components/astro/RLAThemeSelector.astro +5 -1
  118. package/src/components/astro/RLATimeline.astro +22 -18
  119. package/src/components/astro/RLATooltip.astro +35 -31
  120. package/src/components/astro/RLATour.astro +22 -18
  121. package/src/components/astro/RLATree.astro +22 -18
  122. package/src/components/astro/RLAUser.astro +22 -18
  123. package/src/components/astro/RLAVideo.astro +200 -196
  124. package/src/components/astro/RLAWatermark.astro +22 -18
  125. package/src/components/astro/RLAWindowMockup.astro +22 -18
  126. package/src/components/vue/RLVCheckbox.vue +68 -0
  127. package/src/components/vue/RLVForm.vue +44 -0
  128. package/src/components/vue/RLVFormField.vue +58 -0
  129. package/src/components/vue/RLVInput.vue +93 -0
  130. package/src/components/vue/RLVPost.vue +63 -0
  131. package/src/components/vue/RLVPosts.vue +21 -0
  132. package/src/components/vue/RLVSection.vue +5 -4
  133. package/src/components/vue/RLVToast.vue +68 -0
  134. package/src/components/vue/RLVToaster.vue +29 -0
  135. package/src/composables/index.ts +2 -0
  136. package/src/composables/useHeaderStore.ts +13 -0
  137. package/src/composables/useScrollToTop.ts +7 -7
  138. package/src/composables/useToast.ts +43 -0
  139. package/src/config/index.ts +1 -0
  140. package/src/config/security.ts +220 -0
  141. package/src/env.d.ts +0 -13
  142. package/src/integrations/ui.ts +199 -208
  143. package/src/middleware/security.ts +75 -15
  144. package/src/plugins/index.ts +0 -3
  145. package/src/plugins/starlightDocsApi/index.ts +20 -13
  146. package/src/presets/defaults.ts +12 -0
  147. package/src/presets/index.ts +683 -537
  148. package/src/styles/index.css +0 -2
  149. package/src/themes/3d-hover.theme.ts +11 -8
  150. package/src/themes/accordion.theme.ts +11 -8
  151. package/src/themes/alert.theme.ts +96 -21
  152. package/src/themes/app.theme.ts +11 -8
  153. package/src/themes/aspect-ratio.theme.ts +10 -8
  154. package/src/themes/audio.theme.ts +11 -8
  155. package/src/themes/avatar-group.theme.ts +9 -7
  156. package/src/themes/avatar.theme.ts +79 -23
  157. package/src/themes/badge.theme.ts +119 -16
  158. package/src/themes/banner.theme.ts +11 -8
  159. package/src/themes/breadcrumb.theme.ts +14 -12
  160. package/src/themes/browser-mockup.theme.ts +11 -8
  161. package/src/themes/button.theme.ts +224 -195
  162. package/src/themes/calendar.theme.ts +11 -8
  163. package/src/themes/card.theme.ts +37 -29
  164. package/src/themes/carousel.theme.ts +30 -28
  165. package/src/themes/changelog.theme.ts +11 -8
  166. package/src/themes/chart.theme.ts +2 -1
  167. package/src/themes/chat-message.theme.ts +11 -8
  168. package/src/themes/chat-messages.theme.ts +11 -8
  169. package/src/themes/chat-palette.theme.ts +11 -8
  170. package/src/themes/chat-prompt-submit.theme.ts +11 -8
  171. package/src/themes/chat-prompt.theme.ts +11 -8
  172. package/src/themes/chat-reasoning.theme.ts +11 -8
  173. package/src/themes/chat-shimmer.theme.ts +11 -8
  174. package/src/themes/chat-tool.theme.ts +11 -8
  175. package/src/themes/chat.theme.ts +11 -8
  176. package/src/themes/checkbox.theme.ts +12 -10
  177. package/src/themes/chip.theme.ts +71 -13
  178. package/src/themes/color-picker.theme.ts +11 -8
  179. package/src/themes/command-palette.theme.ts +11 -8
  180. package/src/themes/compare.theme.ts +11 -8
  181. package/src/themes/confirm.theme.ts +43 -28
  182. package/src/themes/container.theme.ts +11 -8
  183. package/src/themes/context-menu.theme.ts +11 -8
  184. package/src/themes/dashboard-group.theme.ts +11 -8
  185. package/src/themes/dashboard-navbar.theme.ts +11 -8
  186. package/src/themes/dashboard-panel.theme.ts +11 -8
  187. package/src/themes/dashboard-resize-handle.theme.ts +11 -8
  188. package/src/themes/dashboard-search-button.theme.ts +11 -8
  189. package/src/themes/dashboard-search.theme.ts +11 -8
  190. package/src/themes/dashboard-sidebar-collapse.theme.ts +11 -8
  191. package/src/themes/dashboard-sidebar-toggle.theme.ts +11 -8
  192. package/src/themes/dashboard-sidebar.theme.ts +11 -8
  193. package/src/themes/dashboard-toolbar.theme.ts +11 -8
  194. package/src/themes/dock.theme.ts +11 -8
  195. package/src/themes/drawer.theme.ts +55 -38
  196. package/src/themes/dropdown-menu.theme.ts +4 -2
  197. package/src/themes/editor.theme.ts +11 -8
  198. package/src/themes/empty.theme.ts +11 -8
  199. package/src/themes/error.theme.ts +11 -8
  200. package/src/themes/field-group.theme.ts +2 -1
  201. package/src/themes/fieldset.theme.ts +11 -8
  202. package/src/themes/floating-action.theme.ts +11 -8
  203. package/src/themes/footer.theme.ts +26 -23
  204. package/src/themes/form.theme.ts +11 -8
  205. package/src/themes/gallery.theme.ts +11 -8
  206. package/src/themes/head.theme.ts +11 -8
  207. package/src/themes/header.theme.ts +38 -36
  208. package/src/themes/hover-card.theme.ts +25 -23
  209. package/src/themes/icon.theme.ts +20 -17
  210. package/src/themes/image.theme.ts +21 -8
  211. package/src/themes/input-date.theme.ts +11 -8
  212. package/src/themes/input-menu.theme.ts +11 -4
  213. package/src/themes/input-number.theme.ts +11 -8
  214. package/src/themes/input-tags.theme.ts +11 -8
  215. package/src/themes/input-time.theme.ts +11 -8
  216. package/src/themes/input.theme.ts +2 -1
  217. package/src/themes/kbd.theme.ts +91 -20
  218. package/src/themes/knob.theme.ts +11 -8
  219. package/src/themes/label.theme.ts +18 -16
  220. package/src/themes/link-group.theme.ts +30 -8
  221. package/src/themes/link.theme.ts +11 -8
  222. package/src/themes/listbox.theme.ts +11 -8
  223. package/src/themes/locale-selector.theme.ts +49 -50
  224. package/src/themes/logo.theme.ts +11 -8
  225. package/src/themes/main.theme.ts +13 -12
  226. package/src/themes/marquee.theme.ts +24 -22
  227. package/src/themes/megamenu.theme.ts +11 -8
  228. package/src/themes/meter.theme.ts +11 -8
  229. package/src/themes/modal.theme.ts +44 -32
  230. package/src/themes/navigation-menu.theme.ts +34 -9
  231. package/src/themes/page-aside.theme.ts +11 -8
  232. package/src/themes/page-body.theme.ts +11 -8
  233. package/src/themes/page-header.theme.ts +11 -8
  234. package/src/themes/page-section.theme.ts +173 -172
  235. package/src/themes/page.theme.ts +11 -8
  236. package/src/themes/pagination.theme.ts +24 -22
  237. package/src/themes/password.theme.ts +11 -8
  238. package/src/themes/phone-mockup.theme.ts +11 -8
  239. package/src/themes/pin-input.theme.ts +14 -0
  240. package/src/themes/placeholder.theme.ts +13 -10
  241. package/src/themes/popover.theme.ts +26 -24
  242. package/src/themes/post.theme.ts +31 -8
  243. package/src/themes/pricing-plan.theme.ts +11 -8
  244. package/src/themes/pricing-table.theme.ts +11 -8
  245. package/src/themes/progress.theme.ts +10 -9
  246. package/src/themes/prose.theme.ts +11 -8
  247. package/src/themes/qr-code.theme.ts +11 -8
  248. package/src/themes/quote.theme.ts +11 -8
  249. package/src/themes/radio-group.theme.ts +11 -8
  250. package/src/themes/rating.theme.ts +11 -8
  251. package/src/themes/scroll-area.theme.ts +4 -2
  252. package/src/themes/scroll-to-top.theme.ts +12 -10
  253. package/src/themes/select.theme.ts +4 -2
  254. package/src/themes/separator.theme.ts +143 -15
  255. package/src/themes/sidebar.theme.ts +9 -4
  256. package/src/themes/skeleton.theme.ts +17 -16
  257. package/src/themes/slideover.theme.ts +53 -37
  258. package/src/themes/slider.theme.ts +13 -11
  259. package/src/themes/speed-dial.theme.ts +11 -8
  260. package/src/themes/spinner.theme.ts +2 -3
  261. package/src/themes/splitter.theme.ts +2 -1
  262. package/src/themes/spoiler.theme.ts +11 -8
  263. package/src/themes/stepper.theme.ts +11 -8
  264. package/src/themes/sticky-surface.theme.ts +9 -7
  265. package/src/themes/switch.theme.ts +12 -10
  266. package/src/themes/table-of-contents.theme.ts +46 -8
  267. package/src/themes/tabs.theme.ts +14 -6
  268. package/src/themes/textarea.theme.ts +2 -1
  269. package/src/themes/theme-selector.theme.ts +15 -16
  270. package/src/themes/timeline.theme.ts +11 -8
  271. package/src/themes/toast.theme.ts +10 -4
  272. package/src/themes/tooltip.theme.ts +24 -23
  273. package/src/themes/tour.theme.ts +11 -8
  274. package/src/themes/tree.theme.ts +11 -8
  275. package/src/themes/user.theme.ts +11 -8
  276. package/src/themes/video.theme.ts +15 -12
  277. package/src/themes/watermark.theme.ts +11 -8
  278. package/src/themes/window-mockup.theme.ts +11 -8
  279. package/src/types/components/3d-hover.ts +1 -1
  280. package/src/types/components/alert.ts +2 -2
  281. package/src/types/components/app.ts +1 -1
  282. package/src/types/components/audio.ts +1 -1
  283. package/src/types/components/avatar-group.ts +11 -12
  284. package/src/types/components/avatar.ts +46 -21
  285. package/src/types/components/badge.ts +2 -2
  286. package/src/types/components/banner.ts +1 -1
  287. package/src/types/components/browser-mockup.ts +1 -1
  288. package/src/types/components/button.ts +7 -10
  289. package/src/types/components/calendar.ts +1 -1
  290. package/src/types/components/changelog.ts +1 -1
  291. package/src/types/components/chart.ts +2 -1
  292. package/src/types/components/chat-message.ts +1 -1
  293. package/src/types/components/chat-messages.ts +1 -1
  294. package/src/types/components/chat-palette.ts +1 -1
  295. package/src/types/components/chat-prompt-submit.ts +1 -1
  296. package/src/types/components/chat-prompt.ts +1 -1
  297. package/src/types/components/chat-reasoning.ts +1 -1
  298. package/src/types/components/chat-shimmer.ts +1 -1
  299. package/src/types/components/chat-tool.ts +1 -1
  300. package/src/types/components/chat.ts +1 -1
  301. package/src/types/components/checkbox.ts +2 -2
  302. package/src/types/components/chip.ts +1 -1
  303. package/src/types/components/collapsible.ts +2 -1
  304. package/src/types/components/color-picker.ts +1 -1
  305. package/src/types/components/command-palette.ts +1 -1
  306. package/src/types/components/compare.ts +1 -1
  307. package/src/types/components/container.ts +7 -1
  308. package/src/types/components/context-menu.ts +1 -1
  309. package/src/types/components/dashboard-group.ts +1 -1
  310. package/src/types/components/dashboard-navbar.ts +1 -1
  311. package/src/types/components/dashboard-panel.ts +1 -1
  312. package/src/types/components/dashboard-resize-handle.ts +1 -1
  313. package/src/types/components/dashboard-search-button.ts +1 -1
  314. package/src/types/components/dashboard-search.ts +1 -1
  315. package/src/types/components/dashboard-sidebar-collapse.ts +1 -1
  316. package/src/types/components/dashboard-sidebar-toggle.ts +1 -1
  317. package/src/types/components/dashboard-sidebar.ts +1 -1
  318. package/src/types/components/dashboard-toolbar.ts +1 -1
  319. package/src/types/components/dock.ts +1 -1
  320. package/src/types/components/dropdown-menu.ts +2 -1
  321. package/src/types/components/editor.ts +1 -1
  322. package/src/types/components/empty.ts +1 -1
  323. package/src/types/components/error.ts +1 -1
  324. package/src/types/components/fieldset.ts +1 -1
  325. package/src/types/components/file-upload.ts +2 -1
  326. package/src/types/components/floating-action.ts +1 -1
  327. package/src/types/components/form.ts +9 -1
  328. package/src/types/components/gallery.ts +1 -1
  329. package/src/types/components/icon.ts +0 -1
  330. package/src/types/components/image.ts +28 -7
  331. package/src/types/components/index.ts +134 -134
  332. package/src/types/components/input-date.ts +1 -1
  333. package/src/types/components/input-menu.ts +2 -2
  334. package/src/types/components/input-number.ts +1 -1
  335. package/src/types/components/input-pin.ts +26 -1
  336. package/src/types/components/input-tags.ts +1 -1
  337. package/src/types/components/input-time.ts +1 -1
  338. package/src/types/components/input.ts +2 -2
  339. package/src/types/components/knob.ts +1 -1
  340. package/src/types/components/link-group.ts +35 -1
  341. package/src/types/components/link.ts +4 -0
  342. package/src/types/components/listbox.ts +1 -1
  343. package/src/types/components/locale-selector.ts +33 -33
  344. package/src/types/components/logo.ts +5 -0
  345. package/src/types/components/main.ts +17 -17
  346. package/src/types/components/megamenu.ts +1 -1
  347. package/src/types/components/meter.ts +1 -1
  348. package/src/types/components/modal.ts +0 -1
  349. package/src/types/components/navigation-menu.ts +13 -8
  350. package/src/types/components/page-aside.ts +1 -1
  351. package/src/types/components/page-body.ts +1 -1
  352. package/src/types/components/page-header.ts +1 -1
  353. package/src/types/components/page.ts +1 -1
  354. package/src/types/components/password.ts +1 -1
  355. package/src/types/components/phone-mockup.ts +1 -1
  356. package/src/types/components/pin-input.ts +11 -0
  357. package/src/types/components/popover.ts +0 -1
  358. package/src/types/components/post.ts +25 -1
  359. package/src/types/components/pricing-plan.ts +1 -1
  360. package/src/types/components/pricing-table.ts +1 -1
  361. package/src/types/components/progress.ts +2 -3
  362. package/src/types/components/prose.ts +1 -1
  363. package/src/types/components/qr-code.ts +1 -1
  364. package/src/types/components/radio-group.ts +1 -1
  365. package/src/types/components/rating.ts +1 -1
  366. package/src/types/components/scroll-area.ts +0 -1
  367. package/src/types/components/scroll-to-top.ts +2 -2
  368. package/src/types/components/select.ts +2 -1
  369. package/src/types/components/separator.ts +0 -1
  370. package/src/types/components/sidebar.ts +53 -3
  371. package/src/types/components/slideover.ts +0 -1
  372. package/src/types/components/slider.ts +2 -2
  373. package/src/types/components/speed-dial.ts +1 -1
  374. package/src/types/components/spinner.ts +2 -3
  375. package/src/types/components/splitter.ts +0 -1
  376. package/src/types/components/spoiler.ts +1 -1
  377. package/src/types/components/stepper.ts +1 -1
  378. package/src/types/components/sticky-surface.ts +0 -1
  379. package/src/types/components/switch.ts +2 -3
  380. package/src/types/components/table-of-contents.ts +7 -1
  381. package/src/types/components/tabs.ts +2 -1
  382. package/src/types/components/textarea.ts +2 -1
  383. package/src/types/components/theme-selector.ts +15 -15
  384. package/src/types/components/timeline.ts +1 -1
  385. package/src/types/components/toast.ts +2 -1
  386. package/src/types/components/tooltip.ts +0 -1
  387. package/src/types/components/tour.ts +1 -1
  388. package/src/types/components/tree.ts +1 -1
  389. package/src/types/components/user.ts +1 -1
  390. package/src/types/components/watermark.ts +1 -1
  391. package/src/types/components/window-mockup.ts +1 -1
  392. package/src/types/theme.ts +10 -0
  393. package/src/utils/docs.ts +215 -0
  394. package/src/utils/headerStack.ts +12 -5
  395. package/src/utils/index.ts +1 -0
  396. package/src/components/astro/RLAInputPin.astro +0 -19
  397. package/src/integrations/vue-entrypoint.ts +0 -6
  398. package/src/nuxt.ts +0 -125
  399. package/src/plugins/starlightAddons/PageTitle.astro +0 -113
  400. package/src/plugins/starlightAddons/index.ts +0 -58
  401. package/src/plugins/starlightAddons/starlight.d.ts +0 -6
  402. package/src/themes/input-pin.theme.ts +0 -10
@@ -0,0 +1,215 @@
1
+ import type { DocsConfig, BadgeConfig } from "../types"
2
+
3
+ export function defineDocsConfig(config: DocsConfig): DocsConfig {
4
+ return config
5
+ }
6
+
7
+ /**
8
+ * Strip a leading numeric sort prefix from a filename id, e.g. "01.getting-started" →
9
+ * "getting-started"
10
+ */
11
+ function stripNumericPrefix(id: string): string {
12
+ return id.replace(/^(\d+\.)+/, "")
13
+ }
14
+
15
+ /**
16
+ * Extract a numeric sort key from a doc id for numeric-prefix sorting
17
+ */
18
+ function numericPrefixOrder(id: string): number {
19
+ const segment = id.split("/").pop() ?? id
20
+ const m = segment.match(/^(\d+)\./)
21
+ return m ? parseInt(m[1], 10) : Infinity
22
+ }
23
+
24
+ export interface ResolvedSidebarItem {
25
+ label: string
26
+ href?: string
27
+ icon?: string
28
+ badge?: string | BadgeConfig
29
+ active?: boolean
30
+ children?: ResolvedSidebarItem[]
31
+ collapsed?: boolean
32
+ }
33
+
34
+ export interface ResolvedScope {
35
+ id: string
36
+ label: string
37
+ href: string
38
+ icon?: string
39
+ active?: boolean
40
+ }
41
+
42
+ export async function getDocsSidebar(
43
+ config: DocsConfig,
44
+ locale: string,
45
+ currentPath: string,
46
+ getCollection: (name: string) => Promise<any[]>
47
+ ): Promise<{
48
+ items: ResolvedSidebarItem[]
49
+ scopes: ResolvedScope[]
50
+ activeScope?: ResolvedScope
51
+ }> {
52
+ const docs = await getCollection("docs")
53
+ const normPath = currentPath.replace(/\/$/, "").toLowerCase()
54
+ const docsBase = `/${locale}/docs`
55
+
56
+ const sidebarScopes: import("../types").SidebarScope[] = Array.isArray(config.sidebar)
57
+ ? config.sidebar.filter(
58
+ (item): item is import("../types").SidebarScope => "id" in item || "scopes" in item
59
+ )
60
+ : (config.sidebar as any)?.scopes || []
61
+
62
+ const scopes: ResolvedScope[] = sidebarScopes.map((scope) => {
63
+ const id = scope.id || scope.label
64
+ let href = scope.href || ""
65
+ if (!href && scope.items && scope.items.length > 0) {
66
+ href = scope.items[0].href || ""
67
+ }
68
+ return {
69
+ id,
70
+ label: scope.label,
71
+ href: href.replace("{locale}", locale),
72
+ icon: scope.icon
73
+ }
74
+ })
75
+
76
+ function isDocInItems(
77
+ items: import("../types").SidebarItem[],
78
+ docId: string | undefined,
79
+ href: string
80
+ ): boolean {
81
+ for (const item of items) {
82
+ if (item.href && item.href.toLowerCase().replace(/\/$/, "") === href) return true
83
+ if (item.autogenerate && docId) {
84
+ const dir = item.autogenerate.directory.replace(/\/$/, "")
85
+ if (dir === "") {
86
+ if (!docId.includes("/")) return true
87
+ } else if (docId.startsWith(dir + "/") || docId === dir) {
88
+ return true
89
+ }
90
+ }
91
+ const childItems = item.children || item.items
92
+ if (childItems && isDocInItems(childItems, docId, href)) return true
93
+ }
94
+ return false
95
+ }
96
+
97
+ // Find active scope — most-specific prefix match, fallback to scanning scope items
98
+ let activeScope = scopes.find((s) => normPath === s.href.replace(/\/$/, "").toLowerCase())
99
+ if (!activeScope) {
100
+ const currentDoc = docs.find((d) => `${docsBase}/${d.id}`.toLowerCase() === normPath)
101
+ const scopeMatch = sidebarScopes.find((s) => {
102
+ return isDocInItems(s.items || [], currentDoc?.id, normPath)
103
+ })
104
+
105
+ if (scopeMatch) {
106
+ const matchId = scopeMatch.id || scopeMatch.label
107
+ activeScope = scopes.find((s) => s.id === matchId)
108
+ }
109
+ }
110
+ if (!activeScope) {
111
+ activeScope = [...scopes]
112
+ .toSorted((a, b) => b.href.length - a.href.length)
113
+ .find((s) => normPath.startsWith(s.href.toLowerCase()))
114
+ }
115
+ if (activeScope) activeScope.active = true
116
+
117
+ const sidebarConfig = sidebarScopes.find(
118
+ (item) => activeScope && (item.id === activeScope.id || item.label === activeScope.id)
119
+ )
120
+
121
+ const items = sidebarConfig?.items || []
122
+
123
+ async function resolveItem(item: import("../types").SidebarItem): Promise<ResolvedSidebarItem[]> {
124
+ if (item.autogenerate) {
125
+ const dir = item.autogenerate.directory
126
+ // Match docs whose id starts with the directory
127
+ const prefix = dir.replace(/\/$/, "")
128
+ const filteredDocs = docs.filter((d) => {
129
+ if (d.data.sidebar?.hidden === true) return false
130
+ if (prefix === "") return !d.id.includes("/")
131
+ return d.id.startsWith(prefix + "/") || d.id === prefix
132
+ })
133
+
134
+ filteredDocs.sort((a, b) => {
135
+ // 1. Frontmatter `order` takes priority
136
+ const aOrder = a.data.sidebar?.order ?? a.data.order ?? numericPrefixOrder(a.id)
137
+ const bOrder = b.data.sidebar?.order ?? b.data.order ?? numericPrefixOrder(b.id)
138
+ if (aOrder !== bOrder) return aOrder - bOrder
139
+ // 2. Fall back to alphabetical by stripped label
140
+ const aLabel = a.data.sidebar?.label ?? a.data.title
141
+ const bLabel = b.data.sidebar?.label ?? b.data.title
142
+ return stripNumericPrefix(aLabel).localeCompare(stripNumericPrefix(bLabel))
143
+ })
144
+
145
+ return filteredDocs.map((doc) => {
146
+ const href = `${docsBase}/${doc.id}/`
147
+ const badge =
148
+ doc.data.sidebar?.badge ?? (doc.data.badge as string | BadgeConfig | undefined)
149
+ return {
150
+ label: doc.data.sidebar?.label ?? doc.data.title,
151
+ href,
152
+ badge,
153
+ active: normPath === href.replace(/\/$/, "").toLowerCase()
154
+ }
155
+ })
156
+ }
157
+
158
+ const resolved: ResolvedSidebarItem = {
159
+ label: item.label,
160
+ href: item.href ? item.href.replace("{locale}", locale) : undefined,
161
+ icon: item.icon,
162
+ badge: item.badge,
163
+ collapsed: item.collapsed
164
+ }
165
+
166
+ if (resolved.href) {
167
+ resolved.active = normPath === resolved.href.replace(/\/$/, "").toLowerCase()
168
+ }
169
+
170
+ const childItems = item.children || item.items
171
+ if (childItems) {
172
+ const children: ResolvedSidebarItem[] = []
173
+ for (const child of childItems) {
174
+ children.push(...(await resolveItem(child)))
175
+ }
176
+ resolved.children = children
177
+ if (!resolved.active) {
178
+ resolved.active = children.some((c) => c.active)
179
+ }
180
+ }
181
+
182
+ return [resolved]
183
+ }
184
+
185
+ const resolvedItems: ResolvedSidebarItem[] = []
186
+ for (const item of items) {
187
+ resolvedItems.push(...(await resolveItem(item)))
188
+ }
189
+
190
+ return { items: resolvedItems, scopes, activeScope }
191
+ }
192
+
193
+ export function getSurroundItems(sidebar: ResolvedSidebarItem[], currentPath: string) {
194
+ const flatItems: { label: string; href: string }[] = []
195
+
196
+ function flatten(items: ResolvedSidebarItem[]) {
197
+ for (const item of items) {
198
+ if (item.href) flatItems.push({ label: item.label, href: item.href })
199
+ if (item.children) flatten(item.children)
200
+ }
201
+ }
202
+
203
+ flatten(sidebar)
204
+
205
+ const normPath = currentPath.replace(/\/$/, "").toLowerCase()
206
+ const currentIndex = flatItems.findIndex(
207
+ (item) => item.href.replace(/\/$/, "").toLowerCase() === normPath
208
+ )
209
+
210
+ return {
211
+ prev: currentIndex > 0 ? flatItems[currentIndex - 1] : null,
212
+ next:
213
+ currentIndex >= 0 && currentIndex < flatItems.length - 1 ? flatItems[currentIndex + 1] : null
214
+ }
215
+ }
@@ -19,6 +19,12 @@ export interface HeaderStackManager {
19
19
  update: () => void
20
20
  }
21
21
 
22
+ declare global {
23
+ interface Window {
24
+ RLHeaderStack?: HeaderStackManager
25
+ }
26
+ }
27
+
22
28
  /**
23
29
  * Initializes and returns a global vanilla JS header stack manager. This ensures Vue and Astro
24
30
  * components share the exact same layer state and can dynamically push each other up/down when
@@ -35,9 +41,8 @@ export function getHeaderStack(): HeaderStackManager {
35
41
  }
36
42
  }
37
43
 
38
- const win = window as any
39
- if (!win.RLHeaderStack) {
40
- win.RLHeaderStack = {
44
+ if (!window.RLHeaderStack) {
45
+ window.RLHeaderStack = {
41
46
  layers: [] as HeaderLayer[],
42
47
  register(
43
48
  id: string,
@@ -80,9 +85,11 @@ export function getHeaderStack(): HeaderStackManager {
80
85
  currentTop += layer.naturalHeight
81
86
  }
82
87
  }
83
- document.documentElement.style.setProperty("--rl-total-header-height", `${currentTop}px`)
88
+ if (currentTop > 0) {
89
+ document.documentElement.style.setProperty("--rl-total-header-height", `${currentTop}px`)
90
+ }
84
91
  }
85
92
  }
86
93
  }
87
- return win.RLHeaderStack
94
+ return window.RLHeaderStack
88
95
  }
@@ -1,4 +1,5 @@
1
1
  export * from "./defineTheme"
2
2
  export * from "./resolveClasses"
3
3
  export * from "./useUi.ts"
4
+ export * from "./docs"
4
5
  export * from "./embed"
@@ -1,19 +0,0 @@
1
- ---
2
- import { scv } from "css-variants"
3
- import { useUi, resolveClasses } from "../../utils"
4
- import type { InputPinProps } from "../../types"
5
- import inputPinThemeDefault from "../../themes/input-pin.theme"
6
-
7
- const inputPin = scv(inputPinThemeDefault)
8
-
9
- const {
10
- ui: uiProp,
11
- class: className,
12
- ...rest
13
- } = Astro.props as InputPinProps
14
-
15
- const classes = resolveClasses(inputPin, {}, useUi("inputPin", uiProp), className);
16
- ---
17
- <div class={classes.root} data-slot="root" {...rest}>
18
- <slot />
19
- </div>
@@ -1,6 +0,0 @@
1
- import type { App } from "vue"
2
- import ui from "@nuxt/ui/vue-plugin"
3
-
4
- export default (app: App) => {
5
- app.use(ui)
6
- }
package/src/nuxt.ts DELETED
@@ -1,125 +0,0 @@
1
- // Components
2
- export { default as Accordion } from "@nuxt/ui/components/Accordion.vue"
3
- export { default as Alert } from "@nuxt/ui/components/Alert.vue"
4
- export { default as App } from "@nuxt/ui/components/App.vue"
5
- export { default as AuthForm } from "@nuxt/ui/components/AuthForm.vue"
6
- export { default as Avatar } from "@nuxt/ui/components/Avatar.vue"
7
- export { default as AvatarGroup } from "@nuxt/ui/components/AvatarGroup.vue"
8
- export { default as Badge } from "@nuxt/ui/components/Badge.vue"
9
- export { default as Banner } from "@nuxt/ui/components/Banner.vue"
10
- export { default as BlogPost } from "@nuxt/ui/components/BlogPost.vue"
11
- export { default as BlogPosts } from "@nuxt/ui/components/BlogPosts.vue"
12
- export { default as Breadcrumb } from "@nuxt/ui/components/Breadcrumb.vue"
13
- export { default as Button } from "@nuxt/ui/components/Button.vue"
14
- export { default as Calendar } from "@nuxt/ui/components/Calendar.vue"
15
- export { default as Card } from "@nuxt/ui/components/Card.vue"
16
- export { default as Carousel } from "@nuxt/ui/components/Carousel.vue"
17
- export { default as ChangelogVersion } from "@nuxt/ui/components/ChangelogVersion.vue"
18
- export { default as ChangelogVersions } from "@nuxt/ui/components/ChangelogVersions.vue"
19
- export { default as ChatMessage } from "@nuxt/ui/components/ChatMessage.vue"
20
- export { default as ChatMessages } from "@nuxt/ui/components/ChatMessages.vue"
21
- export { default as ChatPalette } from "@nuxt/ui/components/ChatPalette.vue"
22
- export { default as ChatPrompt } from "@nuxt/ui/components/ChatPrompt.vue"
23
- export { default as ChatPromptSubmit } from "@nuxt/ui/components/ChatPromptSubmit.vue"
24
- export { default as ChatReasoning } from "@nuxt/ui/components/ChatReasoning.vue"
25
- export { default as ChatShimmer } from "@nuxt/ui/components/ChatShimmer.vue"
26
- export { default as ChatTool } from "@nuxt/ui/components/ChatTool.vue"
27
- export { default as Checkbox } from "@nuxt/ui/components/Checkbox.vue"
28
- export { default as CheckboxGroup } from "@nuxt/ui/components/CheckboxGroup.vue"
29
- export { default as Chip } from "@nuxt/ui/components/Chip.vue"
30
- export { default as Collapsible } from "@nuxt/ui/components/Collapsible.vue"
31
- export { default as ColorPicker } from "@nuxt/ui/components/ColorPicker.vue"
32
- export { default as CommandPalette } from "@nuxt/ui/components/CommandPalette.vue"
33
- export { default as Container } from "@nuxt/ui/components/Container.vue"
34
- export { default as ContextMenu } from "@nuxt/ui/components/ContextMenu.vue"
35
- export { default as DashboardGroup } from "@nuxt/ui/components/DashboardGroup.vue"
36
- export { default as DashboardNavbar } from "@nuxt/ui/components/DashboardNavbar.vue"
37
- export { default as DashboardPanel } from "@nuxt/ui/components/DashboardPanel.vue"
38
- export { default as DashboardResizeHandle } from "@nuxt/ui/components/DashboardResizeHandle.vue"
39
- export { default as DashboardSearch } from "@nuxt/ui/components/DashboardSearch.vue"
40
- export { default as DashboardSearchButton } from "@nuxt/ui/components/DashboardSearchButton.vue"
41
- export { default as DashboardSidebar } from "@nuxt/ui/components/DashboardSidebar.vue"
42
- export { default as DashboardSidebarCollapse } from "@nuxt/ui/components/DashboardSidebarCollapse.vue"
43
- export { default as DashboardSidebarToggle } from "@nuxt/ui/components/DashboardSidebarToggle.vue"
44
- export { default as DashboardToolbar } from "@nuxt/ui/components/DashboardToolbar.vue"
45
- export { default as Drawer } from "@nuxt/ui/components/Drawer.vue"
46
- export { default as DropdownMenu } from "@nuxt/ui/components/DropdownMenu.vue"
47
- export { default as Editor } from "@nuxt/ui/components/Editor.vue"
48
- export { default as EditorDragHandle } from "@nuxt/ui/components/EditorDragHandle.vue"
49
- export { default as EditorEmojiMenu } from "@nuxt/ui/components/EditorEmojiMenu.vue"
50
- export { default as EditorMentionMenu } from "@nuxt/ui/components/EditorMentionMenu.vue"
51
- export { default as EditorSuggestionMenu } from "@nuxt/ui/components/EditorSuggestionMenu.vue"
52
- export { default as EditorToolbar } from "@nuxt/ui/components/EditorToolbar.vue"
53
- export { default as Empty } from "@nuxt/ui/components/Empty.vue"
54
- export { default as Error } from "@nuxt/ui/components/Error.vue"
55
- export { default as FieldGroup } from "@nuxt/ui/components/FieldGroup.vue"
56
- export { default as FileUpload } from "@nuxt/ui/components/FileUpload.vue"
57
- export { default as Footer } from "@nuxt/ui/components/Footer.vue"
58
- export { default as FooterColumns } from "@nuxt/ui/components/FooterColumns.vue"
59
- export { default as Form } from "@nuxt/ui/components/Form.vue"
60
- export { default as FormField } from "@nuxt/ui/components/FormField.vue"
61
- export { default as Header } from "@nuxt/ui/components/Header.vue"
62
- export { default as Icon } from "@nuxt/ui/components/Icon.vue"
63
- export { default as Input } from "@nuxt/ui/components/Input.vue"
64
- export { default as InputDate } from "@nuxt/ui/components/InputDate.vue"
65
- export { default as InputMenu } from "@nuxt/ui/components/InputMenu.vue"
66
- export { default as InputNumber } from "@nuxt/ui/components/InputNumber.vue"
67
- export { default as InputTags } from "@nuxt/ui/components/InputTags.vue"
68
- export { default as InputTime } from "@nuxt/ui/components/InputTime.vue"
69
- export { default as Kbd } from "@nuxt/ui/components/Kbd.vue"
70
- export { default as Link } from "@nuxt/ui/components/Link.vue"
71
- export { default as Main } from "@nuxt/ui/components/Main.vue"
72
- export { default as Marquee } from "@nuxt/ui/components/Marquee.vue"
73
- export { default as Modal } from "@nuxt/ui/components/Modal.vue"
74
- export { default as NavigationMenu } from "@nuxt/ui/components/NavigationMenu.vue"
75
- export { default as Page } from "@nuxt/ui/components/Page.vue"
76
- export { default as PageAnchors } from "@nuxt/ui/components/PageAnchors.vue"
77
- export { default as PageAside } from "@nuxt/ui/components/PageAside.vue"
78
- export { default as PageBody } from "@nuxt/ui/components/PageBody.vue"
79
- export { default as PageCard } from "@nuxt/ui/components/PageCard.vue"
80
- export { default as PageColumns } from "@nuxt/ui/components/PageColumns.vue"
81
- export { default as PageCTA } from "@nuxt/ui/components/PageCTA.vue"
82
- export { default as PageFeature } from "@nuxt/ui/components/PageFeature.vue"
83
- export { default as PageGrid } from "@nuxt/ui/components/PageGrid.vue"
84
- export { default as PageHeader } from "@nuxt/ui/components/PageHeader.vue"
85
- export { default as PageHero } from "@nuxt/ui/components/PageHero.vue"
86
- export { default as PageLinks } from "@nuxt/ui/components/PageLinks.vue"
87
- export { default as PageList } from "@nuxt/ui/components/PageList.vue"
88
- export { default as PageLogos } from "@nuxt/ui/components/PageLogos.vue"
89
- export { default as PageSection } from "@nuxt/ui/components/PageSection.vue"
90
- export { default as Pagination } from "@nuxt/ui/components/Pagination.vue"
91
- export { default as PinInput } from "@nuxt/ui/components/PinInput.vue"
92
- export { default as Popover } from "@nuxt/ui/components/Popover.vue"
93
- export { default as PricingPlan } from "@nuxt/ui/components/PricingPlan.vue"
94
- export { default as PricingPlans } from "@nuxt/ui/components/PricingPlans.vue"
95
- export { default as PricingTable } from "@nuxt/ui/components/PricingTable.vue"
96
- export { default as Progress } from "@nuxt/ui/components/Progress.vue"
97
- export { default as RadioGroup } from "@nuxt/ui/components/RadioGroup.vue"
98
- export { default as ScrollArea } from "@nuxt/ui/components/ScrollArea.vue"
99
- export { default as Select } from "@nuxt/ui/components/Select.vue"
100
- export { default as SelectMenu } from "@nuxt/ui/components/SelectMenu.vue"
101
- export { default as Separator } from "@nuxt/ui/components/Separator.vue"
102
- export { default as Sidebar } from "@nuxt/ui/components/Sidebar.vue"
103
- export { default as Skeleton } from "@nuxt/ui/components/Skeleton.vue"
104
- export { default as Slideover } from "@nuxt/ui/components/Slideover.vue"
105
- export { default as Slider } from "@nuxt/ui/components/Slider.vue"
106
- export { default as Stepper } from "@nuxt/ui/components/Stepper.vue"
107
- export { default as Switch } from "@nuxt/ui/components/Switch.vue"
108
- export { default as Table } from "@nuxt/ui/components/Table.vue"
109
- export { default as Tabs } from "@nuxt/ui/components/Tabs.vue"
110
- export { default as Textarea } from "@nuxt/ui/components/Textarea.vue"
111
- export { default as Timeline } from "@nuxt/ui/components/Timeline.vue"
112
- export { default as Toast } from "@nuxt/ui/components/Toast.vue"
113
- export { default as Toaster } from "@nuxt/ui/components/Toaster.vue"
114
- export { default as Tooltip } from "@nuxt/ui/components/Tooltip.vue"
115
- export { default as Tree } from "@nuxt/ui/components/Tree.vue"
116
- export { default as User } from "@nuxt/ui/components/User.vue"
117
- export { default as ColorModeAvatar } from "@nuxt/ui/components/color-mode/ColorModeAvatar.vue"
118
- export { default as ColorModeButton } from "@nuxt/ui/components/color-mode/ColorModeButton.vue"
119
- export { default as ColorModeImage } from "@nuxt/ui/components/color-mode/ColorModeImage.vue"
120
- export { default as ColorModeSelect } from "@nuxt/ui/components/color-mode/ColorModeSelect.vue"
121
- export { default as ColorModeSwitch } from "@nuxt/ui/components/color-mode/ColorModeSwitch.vue"
122
- export { default as LocaleSelect } from "@nuxt/ui/components/locale/LocaleSelect.vue"
123
-
124
- // Explicitly allowed composables
125
- export * from "@nuxt/ui/composables/defineShortcuts"
@@ -1,113 +0,0 @@
1
- ---
2
- import DefaultPageTitle from "@astrojs/starlight/components/PageTitle.astro";
3
- import config from "virtual:rimelight-starlight-addons-config";
4
-
5
- const { copy = true, share = true } = config ?? {};
6
- ---
7
-
8
- <DefaultPageTitle />
9
- {(copy || share) && (
10
- <div class="rl-addons">
11
- {copy && (
12
- <button class="rl-addon-btn" id="rl-copy-markdown" title="Copy Markdown">
13
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
14
- </button>
15
- )}
16
- {share && (
17
- <button class="rl-addon-btn" id="rl-share" title="Share">
18
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" x2="15.42" y1="13.51" y2="17.49"/><line x1="15.41" x2="8.59" y1="6.51" y2="10.49"/></svg>
19
- </button>
20
- )}
21
- </div>
22
- )}
23
-
24
- <style>
25
- .rl-addons {
26
- display: flex;
27
- gap: 0.5rem;
28
- align-items: center;
29
- }
30
-
31
- .rl-addon-btn {
32
- background-color: var(--sl-color-gray-6);
33
- color: var(--sl-color-white);
34
- border: 1px solid var(--sl-color-gray-5);
35
- padding: 0.5rem;
36
- border-radius: 0.25rem;
37
- cursor: pointer;
38
- display: flex;
39
- align-items: center;
40
- justify-content: center;
41
- transition: background-color 0.2s ease;
42
- height: 2rem;
43
- width: 2rem;
44
- }
45
-
46
- .rl-addon-btn:hover {
47
- background-color: var(--sl-color-gray-5);
48
- }
49
-
50
- .rl-addon-btn:disabled {
51
- opacity: 0.7;
52
- cursor: not-allowed;
53
- }
54
- </style>
55
-
56
- <script>
57
- import TurndownService from "turndown";
58
- import { gfm } from "turndown-plugin-gfm";
59
-
60
- const turndown = new TurndownService({
61
- headingStyle: "atx",
62
- codeBlockStyle: "fenced",
63
- bulletListMarker: "-",
64
- });
65
- turndown.use(gfm);
66
-
67
- const copyBtn = document.getElementById("rl-copy-markdown") as HTMLButtonElement | null;
68
- const shareBtn = document.getElementById("rl-share");
69
-
70
- if (copyBtn) {
71
- copyBtn.addEventListener("click", async () => {
72
- try {
73
- copyBtn.disabled = true;
74
- const contentEl = document.querySelector("main .sl-markdown-content");
75
- if (!contentEl) {
76
- throw new Error("Content not found");
77
- }
78
- const clone = contentEl.cloneNode(true) as Element;
79
- clone.querySelectorAll("script, style, noscript, .sl-anchor-link, [data-pagefind-ignore]").forEach((el: Element) => el.remove());
80
- const markdown = turndown.turndown(clone as HTMLElement);
81
- await navigator.clipboard.writeText(markdown);
82
- copyBtn.classList.add("copied");
83
- setTimeout(() => copyBtn.classList.remove("copied"), 2000);
84
- } catch (err) {
85
- console.error("Failed to copy:", err);
86
- } finally {
87
- copyBtn.disabled = false;
88
- }
89
- });
90
- }
91
-
92
- const typedShareBtn = shareBtn as HTMLButtonElement | null;
93
- if (typedShareBtn) {
94
- typedShareBtn.addEventListener("click", async () => {
95
- if (navigator.share) {
96
- try {
97
- await navigator.share({ title: document.title, url: window.location.href });
98
- } catch (err) {
99
- const error = err as { name?: string };
100
- if (error.name !== "AbortError") {
101
- console.error("Share failed:", err);
102
- }
103
- }
104
- } else {
105
- try {
106
- await navigator.clipboard.writeText(window.location.href);
107
- } catch (err) {
108
- console.error("Failed to copy link:", err);
109
- }
110
- }
111
- });
112
- }
113
- </script>
@@ -1,58 +0,0 @@
1
- import type { StarlightPlugin } from "@astrojs/starlight/types"
2
- import virtual from "vite-plugin-virtual"
3
- import path from "node:path"
4
- import { fileURLToPath } from "node:url"
5
-
6
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
-
8
- export interface StarlightAddonsConfig {
9
- copy?: boolean
10
- share?: boolean
11
- }
12
-
13
- export default function starlightAddons(userConfig?: StarlightAddonsConfig): StarlightPlugin {
14
- // 1. Setup default and merged config for Addons
15
- const defaultAddonConfig: StarlightAddonsConfig = {
16
- copy: true,
17
- share: true
18
- }
19
-
20
- const addonConfig = { ...defaultAddonConfig, ...userConfig }
21
-
22
- return {
23
- name: "rimelight-ui-starlight-addons",
24
- hooks: {
25
- "config:setup"({ addIntegration, updateConfig, logger }) {
26
- // --- Addons Logic ---
27
- if (!addonConfig.copy && !addonConfig.share) {
28
- logger.warn("StarlightAddons: No features enabled.")
29
- }
30
-
31
- updateConfig({
32
- components: {
33
- // This will merge with the Sidebar override if both exist
34
- PageTitle: path.join(__dirname, "PageTitle.astro")
35
- }
36
- })
37
-
38
- // --- Unified Integration ---
39
- addIntegration({
40
- name: "rimelight-ui-starlight-addons-integration",
41
- hooks: {
42
- "astro:config:setup": ({ updateConfig: updateAstroConfig }) => {
43
- updateAstroConfig({
44
- vite: {
45
- plugins: [
46
- virtual({
47
- "virtual:rimelight-starlight-addons-config": `export default ${JSON.stringify(addonConfig)}`
48
- })
49
- ]
50
- }
51
- } as Record<string, unknown>)
52
- }
53
- }
54
- })
55
- }
56
- }
57
- }
58
- }
@@ -1,6 +0,0 @@
1
- declare module "virtual:starlight/user-config" {
2
- import type { StarlightConfig } from "@astrojs/starlight/types"
3
- const Config: StarlightConfig
4
-
5
- export default Config
6
- }
@@ -1,10 +0,0 @@
1
- import { defineTheme } from "../utils/defineTheme"
2
-
3
- export default defineTheme({
4
- slots: ["root"],
5
- base: {
6
- root: ""
7
- },
8
- variants: {},
9
- defaultVariants: {}
10
- })