@rimelight/ui 0.0.33 → 0.0.35

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 (389) hide show
  1. package/README.md +158 -157
  2. package/package.json +100 -105
  3. package/src/components/astro/RLAAccordion.astro +94 -18
  4. package/src/components/astro/RLAAspectRatio.astro +2 -2
  5. package/src/components/astro/RLAAvatar.astro +135 -68
  6. package/src/components/astro/RLABadge.astro +4 -2
  7. package/src/components/astro/RLABanner.astro +138 -23
  8. package/src/components/astro/RLABreadcrumb.astro +13 -0
  9. package/src/components/astro/RLAButton.astro +145 -139
  10. package/src/components/astro/RLACallout.astro +112 -0
  11. package/src/components/astro/RLACard.astro +6 -5
  12. package/src/components/astro/RLACarousel.astro +104 -75
  13. package/src/components/astro/RLAChart.astro +23 -35
  14. package/src/components/astro/RLAChip.astro +11 -5
  15. package/src/components/astro/RLACollapsible.astro +4 -1
  16. package/src/components/astro/RLAColorArea.astro +432 -0
  17. package/src/components/astro/RLAColorField.astro +300 -0
  18. package/src/components/astro/RLAColorSlider.astro +413 -0
  19. package/src/components/astro/RLAConfirm.astro +13 -11
  20. package/src/components/astro/RLACopyMarkdown.astro +78 -0
  21. package/src/components/astro/RLADate.astro +30 -0
  22. package/src/components/astro/RLADrawer.astro +50 -3
  23. package/src/components/astro/RLADropdownMenu.astro +78 -51
  24. package/src/components/astro/RLAFieldGroup.astro +4 -1
  25. package/src/components/astro/RLAFileUpload.astro +114 -100
  26. package/src/components/astro/RLAFooter.astro +2 -1
  27. package/src/components/astro/RLAFormField.astro +10 -6
  28. package/src/components/astro/RLAGrid.astro +31 -39
  29. package/src/components/astro/RLAHead.astro +528 -197
  30. package/src/components/astro/RLAHeader.astro +67 -59
  31. package/src/components/astro/RLAImage.astro +274 -209
  32. package/src/components/astro/RLAInput.astro +14 -9
  33. package/src/components/astro/RLAInputMenu.astro +119 -83
  34. package/src/components/astro/RLAKbd.astro +5 -5
  35. package/src/components/astro/RLALayoutGrid.astro +395 -0
  36. package/src/components/astro/RLALink.astro +44 -23
  37. package/src/components/astro/RLALinkGroup.astro +99 -37
  38. package/src/components/astro/RLALocaleSelector.astro +130 -113
  39. package/src/components/astro/RLALogo.astro +117 -90
  40. package/src/components/astro/RLAMain.astro +8 -3
  41. package/src/components/astro/RLAMarquee.astro +9 -2
  42. package/src/components/astro/RLAModal.astro +48 -18
  43. package/src/components/astro/RLANavigationMenu.astro +381 -137
  44. package/src/components/astro/{RLADocsPackageManagers.astro → RLAPackageManagers.astro} +81 -87
  45. package/src/components/astro/RLAPageSection.astro +4 -2
  46. package/src/components/astro/RLAPagination.astro +2 -4
  47. package/src/components/astro/RLAPopover.astro +4 -3
  48. package/src/components/astro/RLAPost.astro +11 -2
  49. package/src/components/astro/RLAProgress.astro +8 -2
  50. package/src/components/astro/RLAScrollArea.astro +4 -1
  51. package/src/components/astro/RLAScrollToTop.astro +200 -172
  52. package/src/components/astro/RLASearch.astro +282 -0
  53. package/src/components/astro/RLASelect.astro +101 -64
  54. package/src/components/astro/RLASeparator.astro +11 -6
  55. package/src/components/astro/RLAShare.astro +60 -0
  56. package/src/components/astro/RLAShortcuts.astro +429 -0
  57. package/src/components/astro/RLASidebar.astro +158 -212
  58. package/src/components/astro/RLASlideover.astro +99 -4
  59. package/src/components/astro/RLASlider.astro +14 -14
  60. package/src/components/astro/RLASplitter.astro +207 -142
  61. package/src/components/astro/RLASteps.astro +118 -71
  62. package/src/components/astro/RLAStickySurface.astro +9 -2
  63. package/src/components/astro/RLASurround.astro +39 -0
  64. package/src/components/astro/RLATable.astro +4 -1
  65. package/src/components/astro/RLATableOfContents.astro +109 -23
  66. package/src/components/astro/RLATabs.astro +147 -133
  67. package/src/components/astro/RLATextarea.astro +4 -1
  68. package/src/components/astro/RLAThemeSelector.astro +105 -76
  69. package/src/components/astro/RLAToast.astro +35 -21
  70. package/src/components/vue/RLVBanner.vue +230 -0
  71. package/src/components/vue/RLVButton.vue +3 -2
  72. package/src/components/vue/RLVCheckbox.vue +70 -68
  73. package/src/components/vue/RLVFooter.vue +3 -2
  74. package/src/components/vue/RLVForm.vue +44 -44
  75. package/src/components/vue/RLVFormField.vue +58 -58
  76. package/src/components/vue/RLVHeader.vue +3 -2
  77. package/src/components/vue/RLVIcon.vue +4 -2
  78. package/src/components/vue/RLVInput.vue +94 -93
  79. package/src/components/vue/RLVLogo.vue +25 -3
  80. package/src/components/vue/RLVPlaceholder.vue +3 -2
  81. package/src/components/vue/RLVPost.vue +69 -63
  82. package/src/components/vue/RLVPosts.vue +21 -21
  83. package/src/components/vue/RLVProgress.vue +60 -0
  84. package/src/components/vue/RLVScrollToTop.vue +65 -52
  85. package/src/components/vue/RLVSection.vue +14 -13
  86. package/src/components/vue/RLVToast.vue +81 -68
  87. package/src/components/vue/RLVToaster.vue +29 -29
  88. package/src/composables/index.ts +4 -3
  89. package/src/composables/useHeaderStore.ts +14 -14
  90. package/src/composables/useScrollToTop.ts +62 -62
  91. package/src/composables/useShortcuts.ts +11 -0
  92. package/src/composables/useToast.ts +43 -42
  93. package/src/config/index.ts +1 -0
  94. package/src/config/security.ts +227 -0
  95. package/src/config/site.config.ts +1 -0
  96. package/src/docs/components/ApiChangelog.astro +147 -0
  97. package/src/{plugins/starlightDocsApi → docs}/components/ApiEmits.astro +4 -4
  98. package/src/{plugins/starlightDocsApi → docs}/components/ApiProps.astro +4 -4
  99. package/src/{plugins/starlightDocsApi → docs}/components/ApiSlots.astro +4 -4
  100. package/src/docs/components/ApiTheme.astro +100 -0
  101. package/src/docs/extractAll.ts +94 -0
  102. package/src/docs/extractors/extractAstro.ts +69 -0
  103. package/src/docs/extractors/extractTheme.ts +56 -0
  104. package/src/{plugins/starlightDocsApi/extract-vue.ts → docs/extractors/extractVue.ts} +164 -15
  105. package/src/{plugins/starlightDocsApi → docs}/utils.ts +1 -2
  106. package/src/env.d.ts +0 -12
  107. package/src/integrations/ui.ts +215 -199
  108. package/src/middleware/security.ts +145 -29
  109. package/src/presets/defaults.ts +297 -297
  110. package/src/presets/index.ts +508 -637
  111. package/src/styles/index.css +158 -160
  112. package/src/themes/3d-hover.theme.ts +13 -13
  113. package/src/themes/accordion.theme.ts +39 -13
  114. package/src/themes/app.theme.ts +13 -13
  115. package/src/themes/aspect-ratio.theme.ts +1 -1
  116. package/src/themes/audio.theme.ts +13 -13
  117. package/src/themes/avatar-group.theme.ts +1 -1
  118. package/src/themes/avatar.theme.ts +84 -84
  119. package/src/themes/badge.theme.ts +168 -163
  120. package/src/themes/banner.theme.ts +49 -13
  121. package/src/themes/breadcrumb.theme.ts +1 -1
  122. package/src/themes/browser-mockup.theme.ts +13 -13
  123. package/src/themes/button.theme.ts +223 -202
  124. package/src/themes/calendar.theme.ts +13 -13
  125. package/src/themes/{alert.theme.ts → callout.theme.ts} +104 -125
  126. package/src/themes/card.theme.ts +50 -42
  127. package/src/themes/carousel.theme.ts +1 -1
  128. package/src/themes/chart.theme.ts +22 -22
  129. package/src/themes/chat-message.theme.ts +13 -13
  130. package/src/themes/chat-messages.theme.ts +13 -13
  131. package/src/themes/chat-palette.theme.ts +13 -13
  132. package/src/themes/chat-prompt-submit.theme.ts +13 -13
  133. package/src/themes/chat-prompt.theme.ts +13 -13
  134. package/src/themes/chat-reasoning.theme.ts +13 -13
  135. package/src/themes/chat-shimmer.theme.ts +13 -13
  136. package/src/themes/chat-tool.theme.ts +13 -13
  137. package/src/themes/chat.theme.ts +13 -13
  138. package/src/themes/checkbox.theme.ts +49 -50
  139. package/src/themes/chip.theme.ts +73 -74
  140. package/src/themes/color-area.theme.ts +33 -0
  141. package/src/themes/color-field.theme.ts +32 -0
  142. package/src/themes/color-picker.theme.ts +13 -13
  143. package/src/themes/color-slider.theme.ts +34 -0
  144. package/src/themes/command-palette.theme.ts +13 -13
  145. package/src/themes/compare.theme.ts +13 -13
  146. package/src/themes/confirm.theme.ts +48 -48
  147. package/src/themes/container.theme.ts +13 -13
  148. package/src/themes/context-menu.theme.ts +13 -13
  149. package/src/themes/dashboard-group.theme.ts +13 -13
  150. package/src/themes/dashboard-navbar.theme.ts +13 -13
  151. package/src/themes/dashboard-panel.theme.ts +13 -13
  152. package/src/themes/dashboard-resize-handle.theme.ts +13 -13
  153. package/src/themes/dashboard-search-button.theme.ts +13 -13
  154. package/src/themes/dashboard-search.theme.ts +13 -13
  155. package/src/themes/dashboard-sidebar-collapse.theme.ts +13 -13
  156. package/src/themes/dashboard-sidebar-toggle.theme.ts +13 -13
  157. package/src/themes/dashboard-sidebar.theme.ts +13 -13
  158. package/src/themes/dashboard-toolbar.theme.ts +13 -13
  159. package/src/themes/dock.theme.ts +13 -13
  160. package/src/themes/drawer.theme.ts +61 -61
  161. package/src/themes/dropdown-menu.theme.ts +29 -29
  162. package/src/themes/editor.theme.ts +13 -13
  163. package/src/themes/empty.theme.ts +13 -13
  164. package/src/themes/error.theme.ts +13 -13
  165. package/src/themes/field-group.theme.ts +24 -24
  166. package/src/themes/fieldset.theme.ts +13 -13
  167. package/src/themes/floating-action.theme.ts +13 -13
  168. package/src/themes/footer.theme.ts +30 -30
  169. package/src/themes/form.theme.ts +13 -13
  170. package/src/themes/gallery.theme.ts +13 -13
  171. package/src/themes/grid.theme.ts +38 -0
  172. package/src/themes/head.theme.ts +13 -13
  173. package/src/themes/header.theme.ts +46 -46
  174. package/src/themes/hover-card.theme.ts +1 -1
  175. package/src/themes/icon.theme.ts +23 -23
  176. package/src/themes/image.theme.ts +33 -19
  177. package/src/themes/input-date.theme.ts +13 -13
  178. package/src/themes/input-menu.theme.ts +35 -35
  179. package/src/themes/input-number.theme.ts +13 -13
  180. package/src/themes/input-tags.theme.ts +13 -13
  181. package/src/themes/input-time.theme.ts +13 -13
  182. package/src/themes/input.theme.ts +48 -42
  183. package/src/themes/kbd.theme.ts +94 -89
  184. package/src/themes/knob.theme.ts +13 -13
  185. package/src/themes/label.theme.ts +1 -1
  186. package/src/themes/layout-grid.theme.ts +16 -0
  187. package/src/themes/link-group.theme.ts +28 -32
  188. package/src/themes/link.theme.ts +13 -13
  189. package/src/themes/listbox.theme.ts +13 -13
  190. package/src/themes/locale-selector.theme.ts +49 -49
  191. package/src/themes/logo.theme.ts +13 -13
  192. package/src/themes/main.theme.ts +13 -13
  193. package/src/themes/marquee.theme.ts +1 -1
  194. package/src/themes/meter.theme.ts +13 -13
  195. package/src/themes/modal.theme.ts +1 -1
  196. package/src/themes/navigation-menu.theme.ts +44 -27
  197. package/src/themes/page-aside.theme.ts +13 -13
  198. package/src/themes/page-body.theme.ts +13 -13
  199. package/src/themes/page-header.theme.ts +13 -13
  200. package/src/themes/page-section.theme.ts +189 -187
  201. package/src/themes/page.theme.ts +13 -13
  202. package/src/themes/pagination.theme.ts +1 -1
  203. package/src/themes/password.theme.ts +13 -13
  204. package/src/themes/phone-mockup.theme.ts +13 -13
  205. package/src/themes/pin-input.theme.ts +1 -1
  206. package/src/themes/placeholder.theme.ts +15 -15
  207. package/src/themes/popover.theme.ts +1 -1
  208. package/src/themes/post.theme.ts +53 -33
  209. package/src/themes/pricing-plan.theme.ts +13 -13
  210. package/src/themes/pricing-table.theme.ts +13 -13
  211. package/src/themes/progress.theme.ts +37 -38
  212. package/src/themes/prose.theme.ts +13 -13
  213. package/src/themes/qr-code.theme.ts +13 -13
  214. package/src/themes/quote.theme.ts +13 -13
  215. package/src/themes/radio-group.theme.ts +13 -13
  216. package/src/themes/rating.theme.ts +13 -13
  217. package/src/themes/scroll-area.theme.ts +26 -26
  218. package/src/themes/scroll-to-top.theme.ts +51 -52
  219. package/src/themes/search.theme.ts +64 -0
  220. package/src/themes/select.theme.ts +29 -29
  221. package/src/themes/separator.theme.ts +147 -147
  222. package/src/themes/sidebar.theme.ts +38 -38
  223. package/src/themes/skeleton.theme.ts +21 -21
  224. package/src/themes/slideover.theme.ts +5 -5
  225. package/src/themes/slider.theme.ts +35 -36
  226. package/src/themes/speed-dial.theme.ts +13 -13
  227. package/src/themes/spinner.theme.ts +33 -34
  228. package/src/themes/splitter.theme.ts +23 -23
  229. package/src/themes/spoiler.theme.ts +13 -13
  230. package/src/themes/stepper.theme.ts +13 -13
  231. package/src/themes/{megamenu.theme.ts → steps.theme.ts} +13 -13
  232. package/src/themes/sticky-surface.theme.ts +1 -1
  233. package/src/themes/switch.theme.ts +66 -67
  234. package/src/themes/table-of-contents.theme.ts +67 -48
  235. package/src/themes/tabs.theme.ts +52 -52
  236. package/src/themes/textarea.theme.ts +27 -27
  237. package/src/themes/theme-selector.theme.ts +15 -15
  238. package/src/themes/timeline.theme.ts +18 -13
  239. package/src/themes/toast.theme.ts +31 -31
  240. package/src/themes/tooltip.theme.ts +28 -28
  241. package/src/themes/tour.theme.ts +13 -13
  242. package/src/themes/tree.theme.ts +13 -13
  243. package/src/themes/user.theme.ts +13 -13
  244. package/src/themes/video.theme.ts +17 -17
  245. package/src/themes/watermark.theme.ts +13 -13
  246. package/src/themes/window-mockup.theme.ts +13 -13
  247. package/src/types/components/3d-hover.ts +11 -11
  248. package/src/types/components/accordion.ts +35 -2
  249. package/src/types/components/app.ts +11 -11
  250. package/src/types/components/audio.ts +11 -11
  251. package/src/types/components/avatar-group.ts +11 -11
  252. package/src/types/components/avatar.ts +76 -60
  253. package/src/types/components/badge.ts +2 -2
  254. package/src/types/components/banner.ts +53 -11
  255. package/src/types/components/browser-mockup.ts +11 -11
  256. package/src/types/components/button.ts +73 -81
  257. package/src/types/components/calendar.ts +11 -11
  258. package/src/types/components/{alert.ts → callout.ts} +8 -8
  259. package/src/types/components/changelog.ts +11 -11
  260. package/src/types/components/chart.ts +2 -1
  261. package/src/types/components/chat-message.ts +11 -11
  262. package/src/types/components/chat-messages.ts +11 -11
  263. package/src/types/components/chat-palette.ts +11 -11
  264. package/src/types/components/chat-prompt-submit.ts +11 -11
  265. package/src/types/components/chat-prompt.ts +11 -11
  266. package/src/types/components/chat-reasoning.ts +11 -11
  267. package/src/types/components/chat-shimmer.ts +11 -11
  268. package/src/types/components/chat-tool.ts +11 -11
  269. package/src/types/components/chat.ts +11 -11
  270. package/src/types/components/checkbox.ts +2 -2
  271. package/src/types/components/chip.ts +17 -17
  272. package/src/types/components/collapsible.ts +2 -1
  273. package/src/types/components/color-area.ts +19 -0
  274. package/src/types/components/color-field.ts +21 -0
  275. package/src/types/components/color-picker.ts +11 -11
  276. package/src/types/components/color-slider.ts +20 -0
  277. package/src/types/components/command-palette.ts +11 -11
  278. package/src/types/components/compare.ts +11 -11
  279. package/src/types/components/container.ts +17 -17
  280. package/src/types/components/context-menu.ts +11 -11
  281. package/src/types/components/dashboard-group.ts +11 -11
  282. package/src/types/components/dashboard-navbar.ts +11 -11
  283. package/src/types/components/dashboard-panel.ts +11 -11
  284. package/src/types/components/dashboard-resize-handle.ts +11 -11
  285. package/src/types/components/dashboard-search-button.ts +11 -11
  286. package/src/types/components/dashboard-search.ts +11 -11
  287. package/src/types/components/dashboard-sidebar-collapse.ts +11 -11
  288. package/src/types/components/dashboard-sidebar-toggle.ts +11 -11
  289. package/src/types/components/dashboard-sidebar.ts +11 -11
  290. package/src/types/components/dashboard-toolbar.ts +11 -11
  291. package/src/types/components/dock.ts +11 -11
  292. package/src/types/components/dropdown-menu.ts +2 -1
  293. package/src/types/components/editor.ts +11 -11
  294. package/src/types/components/empty.ts +11 -11
  295. package/src/types/components/error.ts +11 -11
  296. package/src/types/components/fieldset.ts +11 -11
  297. package/src/types/components/file-upload.ts +2 -1
  298. package/src/types/components/floating-action.ts +11 -11
  299. package/src/types/components/form.ts +19 -19
  300. package/src/types/components/gallery.ts +11 -11
  301. package/src/types/components/grid.ts +23 -0
  302. package/src/types/components/icon.ts +19 -19
  303. package/src/types/components/image.ts +32 -28
  304. package/src/types/components/input-date.ts +11 -11
  305. package/src/types/components/input-menu.ts +44 -43
  306. package/src/types/components/input-number.ts +11 -11
  307. package/src/types/components/input-pin.ts +36 -35
  308. package/src/types/components/input-tags.ts +11 -11
  309. package/src/types/components/input-time.ts +11 -11
  310. package/src/types/components/input.ts +6 -2
  311. package/src/types/components/knob.ts +11 -11
  312. package/src/types/components/layout-grid.ts +145 -0
  313. package/src/types/components/link-group.ts +47 -23
  314. package/src/types/components/link.ts +19 -0
  315. package/src/types/components/listbox.ts +11 -11
  316. package/src/types/components/locale-selector.ts +33 -33
  317. package/src/types/components/logo.ts +32 -31
  318. package/src/types/components/main.ts +17 -17
  319. package/src/types/components/meter.ts +11 -11
  320. package/src/types/components/modal.ts +39 -39
  321. package/src/types/components/navigation-menu.ts +59 -54
  322. package/src/types/components/page-aside.ts +11 -11
  323. package/src/types/components/page-body.ts +11 -11
  324. package/src/types/components/page-header.ts +11 -11
  325. package/src/types/components/page.ts +11 -11
  326. package/src/types/components/password.ts +11 -11
  327. package/src/types/components/phone-mockup.ts +5 -5
  328. package/src/types/components/pin-input.ts +11 -11
  329. package/src/types/components/popover.ts +23 -23
  330. package/src/types/components/post.ts +47 -35
  331. package/src/types/components/pricing-plan.ts +11 -11
  332. package/src/types/components/pricing-table.ts +11 -11
  333. package/src/types/components/progress.ts +33 -33
  334. package/src/types/components/prose.ts +11 -11
  335. package/src/types/components/qr-code.ts +11 -11
  336. package/src/types/components/radio-group.ts +11 -11
  337. package/src/types/components/rating.ts +11 -11
  338. package/src/types/components/scroll-area.ts +23 -23
  339. package/src/types/components/scroll-to-top.ts +2 -2
  340. package/src/types/components/search.ts +29 -0
  341. package/src/types/components/select.ts +2 -1
  342. package/src/types/components/separator.ts +19 -19
  343. package/src/types/components/sidebar.ts +83 -72
  344. package/src/types/components/slideover.ts +31 -31
  345. package/src/types/components/slider.ts +2 -2
  346. package/src/types/components/speed-dial.ts +11 -11
  347. package/src/types/components/spinner.ts +25 -25
  348. package/src/types/components/splitter.ts +19 -19
  349. package/src/types/components/spoiler.ts +11 -11
  350. package/src/types/components/stepper.ts +11 -11
  351. package/src/types/components/{megamenu.ts → steps.ts} +17 -11
  352. package/src/types/components/sticky-surface.ts +19 -19
  353. package/src/types/components/switch.ts +41 -41
  354. package/src/types/components/table-of-contents.ts +39 -17
  355. package/src/types/components/tabs.ts +2 -1
  356. package/src/types/components/textarea.ts +2 -1
  357. package/src/types/components/theme-selector.ts +15 -15
  358. package/src/types/components/timeline.ts +11 -11
  359. package/src/types/components/toast.ts +6 -1
  360. package/src/types/components/tooltip.ts +23 -23
  361. package/src/types/components/tour.ts +11 -11
  362. package/src/types/components/tree.ts +11 -11
  363. package/src/types/components/user.ts +11 -11
  364. package/src/types/components/watermark.ts +11 -11
  365. package/src/types/components/window-mockup.ts +11 -11
  366. package/src/types/docs.ts +40 -0
  367. package/src/types/index.ts +151 -1
  368. package/src/types/theme.ts +11 -1
  369. package/src/utils/color.ts +165 -0
  370. package/src/utils/docs.ts +365 -189
  371. package/src/utils/headerStack.ts +115 -95
  372. package/src/utils/index.ts +7 -5
  373. package/src/utils/shortcuts.ts +322 -0
  374. package/src/components/TableOfContents.astro +0 -107
  375. package/src/components/astro/RLAAlert.astro +0 -93
  376. package/src/components/astro/RLABlogPost.astro +0 -7
  377. package/src/components/astro/RLABlogPosts.astro +0 -9
  378. package/src/components/astro/RLAChangelog.astro +0 -23
  379. package/src/components/astro/RLAMegamenu.astro +0 -23
  380. package/src/components/astro/RLAPosts.astro +0 -23
  381. package/src/plugins/index.ts +0 -2
  382. package/src/plugins/starlightDocsApi/components/ApiTheme.astro +0 -27
  383. package/src/plugins/starlightDocsApi/index.ts +0 -272
  384. package/src/styles/prism.css +0 -42
  385. package/src/themes/changelog.theme.ts +0 -13
  386. package/src/themes/posts.theme.ts +0 -13
  387. package/src/types/components/index.ts +0 -135
  388. package/src/types/components/posts.ts +0 -11
  389. /package/src/{plugins/starlightDocsApi → docs}/types.ts +0 -0
@@ -1,95 +1,115 @@
1
- export interface HeaderLayer {
2
- id: string
3
- order: number
4
- naturalHeight: number
5
- isVisible: boolean
6
- el: HTMLElement | null
7
- }
8
-
9
- export interface HeaderStackManager {
10
- layers: HeaderLayer[]
11
- register: (
12
- id: string,
13
- order: number,
14
- naturalHeight: number,
15
- isVisible: boolean,
16
- el: HTMLElement | null
17
- ) => void
18
- unregister: (id: string) => void
19
- update: () => void
20
- }
21
-
22
- declare global {
23
- interface Window {
24
- RLHeaderStack?: HeaderStackManager
25
- }
26
- }
27
-
28
- /**
29
- * Initializes and returns a global vanilla JS header stack manager. This ensures Vue and Astro
30
- * components share the exact same layer state and can dynamically push each other up/down when
31
- * hiding on scroll.
32
- */
33
- export function getHeaderStack(): HeaderStackManager {
34
- if (typeof window === "undefined") {
35
- // SSR stub
36
- return {
37
- layers: [],
38
- register() {},
39
- unregister() {},
40
- update() {}
41
- }
42
- }
43
-
44
- if (!window.RLHeaderStack) {
45
- window.RLHeaderStack = {
46
- layers: [] as HeaderLayer[],
47
- register(
48
- id: string,
49
- order: number,
50
- naturalHeight: number,
51
- isVisible: boolean,
52
- el: HTMLElement | null
53
- ) {
54
- let layer = this.layers.find((l: HeaderLayer) => l.id === id)
55
- if (!layer) {
56
- layer = { id, order, naturalHeight, isVisible, el }
57
- this.layers.push(layer)
58
- this.layers.sort((a: HeaderLayer, b: HeaderLayer) => a.order - b.order)
59
- } else {
60
- layer.naturalHeight = naturalHeight
61
- layer.isVisible = isVisible
62
- layer.el = el
63
- }
64
- this.update()
65
- },
66
- unregister(id: string) {
67
- this.layers = this.layers.filter((l: HeaderLayer) => l.id !== id)
68
- this.update()
69
- },
70
- update() {
71
- let currentTop = 0
72
- for (const layer of this.layers) {
73
- if (layer.el) {
74
- // If hidden, slide it up out of view (or exactly to its negative height so it's ready to slide down)
75
- const topPx = layer.isVisible ? `${currentTop}px` : `-${layer.naturalHeight}px`
76
- layer.el.style.top = topPx
77
- layer.el.style.opacity = layer.isVisible ? "1" : "0"
78
- layer.el.style.pointerEvents = layer.isVisible ? "auto" : "none"
79
- layer.el.style.setProperty(
80
- "--rl-header-bottom",
81
- `calc(${topPx} + ${layer.naturalHeight}px)`
82
- )
83
- }
84
- if (layer.isVisible) {
85
- currentTop += layer.naturalHeight
86
- }
87
- }
88
- if (currentTop > 0) {
89
- document.documentElement.style.setProperty("--rl-total-header-height", `${currentTop}px`)
90
- }
91
- }
92
- }
93
- }
94
- return window.RLHeaderStack
95
- }
1
+ export interface HeaderLayer {
2
+ id: string
3
+ type: "banner" | "header"
4
+ order: number
5
+ naturalHeight: number
6
+ isVisible: boolean
7
+ el: HTMLElement | null
8
+ }
9
+
10
+ export interface HeaderStackManager {
11
+ layers: HeaderLayer[]
12
+ register: (
13
+ id: string,
14
+ order: number,
15
+ naturalHeight: number,
16
+ isVisible: boolean,
17
+ el: HTMLElement | null,
18
+ type?: "banner" | "header"
19
+ ) => void
20
+ unregister: (id: string) => void
21
+ update: () => void
22
+ }
23
+
24
+ declare global {
25
+ interface Window {
26
+ RLHeaderStack?: HeaderStackManager
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Initializes and returns a global vanilla JS header stack manager. This ensures Vue and Astro
32
+ * components share the exact same layer state and can dynamically push each other up/down when
33
+ * hiding on scroll.
34
+ */
35
+ export function getHeaderStack(): HeaderStackManager {
36
+ if (typeof window === "undefined") {
37
+ // SSR stub
38
+ return {
39
+ layers: [],
40
+ register() {},
41
+ unregister() {},
42
+ update() {}
43
+ }
44
+ }
45
+
46
+ if (!window.RLHeaderStack) {
47
+ window.RLHeaderStack = {
48
+ layers: [] as HeaderLayer[],
49
+ register(
50
+ id: string,
51
+ order: number,
52
+ naturalHeight: number,
53
+ isVisible: boolean,
54
+ el: HTMLElement | null,
55
+ type: "banner" | "header" = "header"
56
+ ) {
57
+ if (el && !el.isConnected) return
58
+ let layer = this.layers.find((l: HeaderLayer) => l.id === id)
59
+ if (!layer) {
60
+ layer = { id, type, order, naturalHeight, isVisible, el }
61
+ this.layers.push(layer)
62
+ this.layers.sort((a: HeaderLayer, b: HeaderLayer) => {
63
+ if (a.type !== b.type) return a.type === "banner" ? -1 : 1
64
+ return a.order - b.order
65
+ })
66
+ } else {
67
+ layer.naturalHeight = naturalHeight
68
+ layer.isVisible = isVisible
69
+ layer.el = el
70
+ }
71
+ this.update()
72
+ },
73
+ unregister(id: string) {
74
+ const layer = this.layers.find((l: HeaderLayer) => l.id === id)
75
+ if (layer && layer.el) {
76
+ const el = layer.el as HTMLElement & {
77
+ rlScrollListener?: () => void
78
+ rlResizeObserver?: ResizeObserver
79
+ }
80
+ if (el.rlScrollListener) {
81
+ window.removeEventListener("scroll", el.rlScrollListener)
82
+ }
83
+ if (el.rlResizeObserver) {
84
+ el.rlResizeObserver.disconnect()
85
+ }
86
+ }
87
+ this.layers = this.layers.filter((l: HeaderLayer) => l.id !== id)
88
+ this.update()
89
+ },
90
+ update() {
91
+ let currentTop = 0
92
+ for (const layer of this.layers) {
93
+ if (layer.el) {
94
+ // If hidden, slide it up out of view (or exactly to its negative height so it's ready to slide down)
95
+ const topPx = layer.isVisible ? `${currentTop}px` : `-${layer.naturalHeight}px`
96
+ layer.el.style.top = topPx
97
+ layer.el.style.opacity = layer.isVisible ? "1" : "0"
98
+ layer.el.style.pointerEvents = layer.isVisible ? "auto" : "none"
99
+ layer.el.style.setProperty(
100
+ "--rl-header-bottom",
101
+ `calc(${topPx} + ${layer.naturalHeight}px)`
102
+ )
103
+ }
104
+ if (layer.isVisible) {
105
+ currentTop += layer.naturalHeight
106
+ }
107
+ }
108
+ if (currentTop > 0) {
109
+ document.documentElement.style.setProperty("--rl-total-header-height", `${currentTop}px`)
110
+ }
111
+ }
112
+ }
113
+ }
114
+ return window.RLHeaderStack
115
+ }
@@ -1,5 +1,7 @@
1
- export * from "./defineTheme"
2
- export * from "./resolveClasses"
3
- export * from "./useUi.ts"
4
- export * from "./docs"
5
- export * from "./embed"
1
+ export * from "./defineTheme"
2
+ export * from "./resolveClasses"
3
+ export * from "./useUi.ts"
4
+ export * from "./docs"
5
+ export * from "./embed"
6
+ export * from "./shortcuts"
7
+ export * from "./color"
@@ -0,0 +1,322 @@
1
+ import { atom } from "nanostores"
2
+
3
+ export type Handler = (e: KeyboardEvent) => void
4
+
5
+ export interface ShortcutConfig {
6
+ handler: Handler
7
+ usingInput?: boolean | string
8
+ label?: string
9
+ description?: string
10
+ category?: string
11
+ order?: number
12
+ }
13
+
14
+ export interface ShortcutsConfig {
15
+ [key: string]: ShortcutConfig | Handler | false | null | undefined
16
+ }
17
+
18
+ export interface ShortcutsOptions {
19
+ chainDelay?: number
20
+ }
21
+
22
+ interface Shortcut {
23
+ key: string
24
+ handler: Handler
25
+ chained: boolean
26
+ ctrlKey: boolean
27
+ metaKey: boolean
28
+ shiftKey: boolean
29
+ altKey: boolean
30
+ usingInput?: boolean | string
31
+ }
32
+
33
+ export interface RegisteredShortcut {
34
+ id: string
35
+ keys: string[]
36
+ label?: string
37
+ description?: string
38
+ category?: string
39
+ order?: number
40
+ }
41
+
42
+ // OS detection
43
+ const macOS =
44
+ typeof window !== "undefined" &&
45
+ typeof navigator !== "undefined" &&
46
+ /Macintosh;/.test(navigator.userAgent)
47
+
48
+ // Modifiers map for human-readable display
49
+ const kbdKeysMap: Record<string, string> = {
50
+ meta: macOS ? "⌘" : "Ctrl",
51
+ command: macOS ? "⌘" : "Ctrl",
52
+ ctrl: macOS ? "Ctrl" : "Ctrl",
53
+ control: macOS ? "Ctrl" : "Ctrl",
54
+ alt: macOS ? "⌥" : "Alt",
55
+ option: macOS ? "⌥" : "Alt",
56
+ shift: macOS ? "⇧" : "Shift",
57
+ enter: "↵",
58
+ delete: "⌦",
59
+ backspace: "⌫",
60
+ escape: "Esc",
61
+ tab: "⇥",
62
+ space: "Space",
63
+ arrowup: "↑",
64
+ arrowdown: "↓",
65
+ arrowleft: "←",
66
+ arrowright: "→"
67
+ }
68
+
69
+ // Convert a combination string (e.g. meta_alt_t) into platform-specific readable key symbol arrays
70
+ export function formatShortcutKeys(keyStr: string): string[] {
71
+ const separator = keyStr.includes("-") ? "-" : "_"
72
+ const parts = keyStr.split(separator)
73
+ return parts.map((part) => {
74
+ const lower = part.toLowerCase()
75
+ if (kbdKeysMap[lower] !== undefined) {
76
+ return kbdKeysMap[lower]
77
+ }
78
+ if (lower.length === 1) {
79
+ return lower.toUpperCase()
80
+ }
81
+ return part.charAt(0).toUpperCase() + part.slice(1)
82
+ })
83
+ }
84
+
85
+ // Reactive store containing all currently registered shortcuts on the page
86
+ export const activeShortcutsStore = atom<RegisteredShortcut[]>([])
87
+
88
+ // Simple key to code conversion for layout/translation independence under Alt
89
+ function convertKeyToCode(key: string): string {
90
+ if (/^[a-z]$/i.test(key)) {
91
+ return `Key${key.toUpperCase()}`
92
+ }
93
+ if (/^\d$/.test(key)) {
94
+ return `Digit${key}`
95
+ }
96
+ if (/^f\d+$/i.test(key)) {
97
+ return key.toUpperCase()
98
+ }
99
+ const specialKeys: Record<string, string> = {
100
+ space: "Space",
101
+ enter: "Enter",
102
+ escape: "Escape",
103
+ tab: "Tab",
104
+ backspace: "Backspace",
105
+ delete: "Delete",
106
+ arrowup: "ArrowUp",
107
+ arrowdown: "ArrowDown",
108
+ arrowleft: "ArrowLeft",
109
+ arrowright: "ArrowRight"
110
+ }
111
+ return specialKeys[key.toLowerCase()] || key
112
+ }
113
+
114
+ // Input tag checking
115
+ function isUsingInput(activeElement: Element | null): boolean | string {
116
+ if (!activeElement) return false
117
+ const tagName = activeElement.tagName
118
+ const contentEditable = activeElement.getAttribute("contenteditable")
119
+ const isInput =
120
+ tagName === "INPUT" ||
121
+ tagName === "TEXTAREA" ||
122
+ contentEditable === "true" ||
123
+ contentEditable === "plaintext-only"
124
+ if (isInput) {
125
+ return activeElement.getAttribute("name") || true
126
+ }
127
+ return false
128
+ }
129
+
130
+ export function defineShortcuts(
131
+ config: ShortcutsConfig,
132
+ options: ShortcutsOptions = {}
133
+ ): () => void {
134
+ if (typeof window === "undefined") {
135
+ return () => {}
136
+ }
137
+
138
+ const chainDelay = options.chainDelay ?? 800
139
+ const chainedInputs: string[] = []
140
+ let debounceTimer: any = null
141
+
142
+ const clearChainedInput = () => {
143
+ chainedInputs.length = 0
144
+ }
145
+
146
+ // Pre-parse the shortcuts configuration
147
+ const parsedShortcuts: Shortcut[] = Object.entries(config)
148
+ .map(([key, shortcutConfig]) => {
149
+ if (!shortcutConfig) return null
150
+
151
+ let handler: Handler
152
+ let usingInput: boolean | string = false
153
+
154
+ if (typeof shortcutConfig === "function") {
155
+ handler = shortcutConfig
156
+ } else {
157
+ handler = shortcutConfig.handler
158
+ usingInput = shortcutConfig.usingInput ?? false
159
+ }
160
+
161
+ if (!handler) return null
162
+
163
+ const chained = key.includes("-") && key !== "-" && !key.includes("_")
164
+ let baseKey = ""
165
+ let ctrlKey = false
166
+ let metaKey = false
167
+ let shiftKey = false
168
+ let altKey = false
169
+
170
+ if (chained) {
171
+ baseKey = key.toLowerCase()
172
+ } else {
173
+ const parts = key.toLowerCase().split("_")
174
+ baseKey = parts
175
+ .filter((p) => !["meta", "command", "ctrl", "shift", "alt", "option"].includes(p))
176
+ .join("_")
177
+ ctrlKey = parts.includes("ctrl")
178
+ metaKey = parts.includes("meta") || parts.includes("command")
179
+ shiftKey = parts.includes("shift")
180
+ altKey = parts.includes("alt") || parts.includes("option")
181
+
182
+ // Normalize Cmd/Ctrl for non-macOS
183
+ if (!macOS && metaKey && !ctrlKey) {
184
+ metaKey = false
185
+ ctrlKey = true
186
+ }
187
+ }
188
+
189
+ return {
190
+ key: baseKey,
191
+ handler,
192
+ chained,
193
+ ctrlKey,
194
+ metaKey,
195
+ shiftKey,
196
+ altKey,
197
+ usingInput
198
+ } as Shortcut
199
+ })
200
+ .filter((item): item is Shortcut => item != null)
201
+
202
+ // Register documented shortcuts to the store
203
+ const itemsToRegister: RegisteredShortcut[] = Object.entries(config).flatMap(
204
+ ([key, shortcutConfig]) => {
205
+ if (!shortcutConfig || typeof shortcutConfig !== "object") return []
206
+
207
+ const { label, description, category, order } = shortcutConfig
208
+ if (!label && !description) return [] // only register documented shortcuts
209
+
210
+ const item: RegisteredShortcut = {
211
+ id: `${key}-${Math.random().toString(36).slice(2, 7)}`,
212
+ keys: formatShortcutKeys(key),
213
+ category: category || "system"
214
+ }
215
+ if (label) item.label = label
216
+ if (description) item.description = description
217
+ if (order !== undefined) item.order = order
218
+ return [item]
219
+ }
220
+ )
221
+
222
+ if (itemsToRegister.length > 0) {
223
+ activeShortcutsStore.set([...activeShortcutsStore.get(), ...itemsToRegister])
224
+ }
225
+
226
+ const onKeyDown = (e: KeyboardEvent) => {
227
+ if (!e.key) return
228
+
229
+ const activeEl = document.activeElement
230
+ const currentlyUsingInput = isUsingInput(activeEl)
231
+
232
+ // Helper to check if a shortcut is enabled given current focus state
233
+ const isShortcutEnabled = (shortcut: Shortcut) => {
234
+ if (!shortcut.usingInput) {
235
+ return !currentlyUsingInput
236
+ }
237
+ if (typeof shortcut.usingInput === "string") {
238
+ return currentlyUsingInput === shortcut.usingInput
239
+ }
240
+ return true
241
+ }
242
+
243
+ // Handle chained shortcuts
244
+ chainedInputs.push(e.key.toLowerCase())
245
+ clearTimeout(debounceTimer)
246
+
247
+ if (chainedInputs.length >= 2) {
248
+ const chainedKey = chainedInputs.slice(-2).join("-")
249
+ const matchedChained = parsedShortcuts.find((s) => s.chained && s.key === chainedKey)
250
+ if (matchedChained && isShortcutEnabled(matchedChained)) {
251
+ e.preventDefault()
252
+ matchedChained.handler(e)
253
+ clearChainedInput()
254
+ return
255
+ }
256
+ }
257
+
258
+ // Handle standard shortcuts
259
+ for (const shortcut of parsedShortcuts) {
260
+ if (shortcut.chained) continue
261
+
262
+ if (e.ctrlKey !== shortcut.ctrlKey) continue
263
+ if (e.metaKey !== shortcut.metaKey) continue
264
+ if (e.altKey !== shortcut.altKey) continue
265
+
266
+ // Match by code when Alt modifier is active to avoid key translation issues
267
+ const useCode = shortcut.altKey && e.altKey
268
+ if (useCode) {
269
+ if (e.code !== convertKeyToCode(shortcut.key)) continue
270
+ } else {
271
+ const pressedKey = e.key.toLowerCase()
272
+ if (pressedKey !== shortcut.key) continue
273
+ }
274
+
275
+ // Shift modifier check:
276
+ // If the shortcut explicitly specifies shiftKey: true, then e.shiftKey must be true.
277
+ // If the shortcut does NOT specify shiftKey: true, but e.shiftKey is true:
278
+ // - If the base key is a letter (e.g. 'k'), then we do NOT match (because it's Shift+K, not K).
279
+ // - If the base key is a shiftable control key (like 'arrowleft'), we do NOT match.
280
+ // - For other keys (like '?', '/', etc.), we allow it to match even if e.shiftKey is true.
281
+ const alphabetKey = /^[a-z]$/i.test(shortcut.key)
282
+ const shiftableKeys = [
283
+ "arrowleft",
284
+ "arrowright",
285
+ "arrowup",
286
+ "arrowdown",
287
+ "tab",
288
+ "escape",
289
+ "enter",
290
+ "backspace"
291
+ ]
292
+ const shiftableKey = shiftableKeys.includes(shortcut.key)
293
+
294
+ if (shortcut.shiftKey && !e.shiftKey) continue
295
+ if (!shortcut.shiftKey && e.shiftKey && (alphabetKey || shiftableKey)) continue
296
+
297
+ if (isShortcutEnabled(shortcut)) {
298
+ e.preventDefault()
299
+ shortcut.handler(e)
300
+ clearChainedInput()
301
+ return
302
+ }
303
+ }
304
+
305
+ debounceTimer = setTimeout(clearChainedInput, chainDelay)
306
+ }
307
+
308
+ window.addEventListener("keydown", onKeyDown)
309
+
310
+ return () => {
311
+ window.removeEventListener("keydown", onKeyDown)
312
+ clearTimeout(debounceTimer)
313
+
314
+ // Unregister items from the active store
315
+ if (itemsToRegister.length > 0) {
316
+ const idsToRemove = new Set(itemsToRegister.map((item) => item.id))
317
+ activeShortcutsStore.set(
318
+ activeShortcutsStore.get().filter((item) => !idsToRemove.has(item.id))
319
+ )
320
+ }
321
+ }
322
+ }
@@ -1,107 +0,0 @@
1
- ---
2
- export interface TableOfContentsHeading {
3
- depth: number;
4
- slug: string;
5
- text: string;
6
- }
7
-
8
- export interface TableOfContentsConfig {
9
- minHeadingLevel?: number;
10
- maxHeadingLevel?: number;
11
- }
12
-
13
- export interface TableOfContentsProps {
14
- headings: TableOfContentsHeading[];
15
- /** false = hide entirely, object = heading level bounds */
16
- tableOfContents?: false | TableOfContentsConfig;
17
- /** @deprecated use tableOfContents.maxHeadingLevel instead */
18
- levels?: 1 | 2 | 3;
19
- }
20
-
21
- type Props = TableOfContentsProps;
22
-
23
- const { headings, tableOfContents, levels = 2 } = Astro.props as Props;
24
-
25
- if (tableOfContents === false) {
26
- // Render nothing — parent should also skip rendering this component,
27
- // but guard here as a safety net.
28
- }
29
-
30
- const minLevel = (tableOfContents !== false && tableOfContents?.minHeadingLevel) ?? 2;
31
- const maxLevel = (tableOfContents !== false && tableOfContents?.maxHeadingLevel) ?? levels;
32
-
33
- const filteredHeadings = tableOfContents !== false
34
- ? headings.filter(h => h.depth >= minLevel && h.depth <= maxLevel)
35
- : [];
36
- ---
37
-
38
- {tableOfContents !== false && filteredHeadings.length > 0 && (
39
- <div class="border-border rounded-xs border p-3xs text-sm leading-tight">
40
- <h4 class="text-xl font-medium">On this page</h4>
41
- <ul class="mt-2xl flex flex-col gap-3xs">
42
- {filteredHeadings.map(heading => (
43
- <li
44
- class:list={{
45
- "pl-3xs": heading.depth === 2,
46
- "pl-6": heading.depth === 3,
47
- "pl-9": heading.depth >= 4
48
- }}
49
- >
50
- <a
51
- href={`#${heading.slug}`}
52
- class="toc-link transition hover:text-primary-accent"
53
- >
54
- {heading.text}
55
- </a>
56
- </li>
57
- ))}
58
- </ul>
59
- </div>
60
- )}
61
-
62
- <style>
63
- .toc-current {
64
- color: var(--primary);
65
- font-weight: 500;
66
- }
67
- </style>
68
-
69
- <script>
70
- let wrappingElement: Element | null;
71
- let observeHeaderTags: IntersectionObserver;
72
- let allHeaderTags: NodeListOf<Element>;
73
-
74
- function setCurrent(e: IntersectionObserverEntry[]) {
75
- const allSectionLinks = document.querySelectorAll(".toc-link");
76
- e.map(i => {
77
- if (i.isIntersecting === true) {
78
- allSectionLinks.forEach(link => link.classList.remove("toc-current"));
79
- const targetLink = document.querySelector(`a[href="#${i.target.id}"].toc-link`);
80
- if (targetLink) targetLink.classList.add("toc-current");
81
- }
82
- });
83
- }
84
-
85
- function initTOC() {
86
- wrappingElement = document.querySelector(".markdown-content");
87
- if (wrappingElement !== null) {
88
- allHeaderTags = wrappingElement.querySelectorAll(":scope > h1, :scope > h2, :scope > h3, :scope > h4");
89
- }
90
-
91
- const options: IntersectionObserverInit = {
92
- root: null,
93
- rootMargin: "0px 0px -50% 0px",
94
- threshold: [1]
95
- };
96
-
97
- observeHeaderTags = new IntersectionObserver(setCurrent, options);
98
- if (wrappingElement === null) return;
99
- allHeaderTags.forEach(tag => {
100
- tag.classList.add("scroll-mt-3xl");
101
- observeHeaderTags.observe(tag);
102
- });
103
- }
104
-
105
- initTOC();
106
- document.addEventListener("astro:after-swap", initTOC);
107
- </script>