@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.
- package/README.md +135 -8
- package/package.json +17 -20
- package/src/components/TableOfContents.astro +44 -43
- package/src/components/astro/RLA3dHover.astro +22 -18
- package/src/components/astro/RLAAlert.astro +93 -62
- package/src/components/astro/RLAApp.astro +22 -18
- package/src/components/astro/RLAAspectRatio.astro +27 -23
- package/src/components/astro/RLAAudio.astro +22 -18
- package/src/components/astro/RLAAvatar.astro +68 -56
- package/src/components/astro/RLAAvatarGroup.astro +23 -19
- package/src/components/astro/RLABadge.astro +34 -33
- package/src/components/astro/RLABanner.astro +22 -18
- package/src/components/astro/RLABreadcrumb.astro +48 -44
- package/src/components/astro/RLABrowserMockup.astro +22 -18
- package/src/components/astro/RLAButton.astro +141 -90
- package/src/components/astro/RLACalendar.astro +22 -18
- package/src/components/astro/RLACard.astro +78 -74
- package/src/components/astro/RLACarousel.astro +75 -71
- package/src/components/astro/RLAChangelog.astro +22 -18
- package/src/components/astro/RLAChart.astro +19 -34
- package/src/components/astro/RLAChat.astro +22 -18
- package/src/components/astro/RLAChatMessage.astro +22 -18
- package/src/components/astro/RLAChatMessages.astro +22 -18
- package/src/components/astro/RLAChatPalette.astro +22 -18
- package/src/components/astro/RLAChatPrompt.astro +22 -18
- package/src/components/astro/RLAChatPromptSubmit.astro +22 -18
- package/src/components/astro/RLAChatReasoning.astro +22 -18
- package/src/components/astro/RLAChatShimmer.astro +22 -18
- package/src/components/astro/RLAChatTool.astro +22 -18
- package/src/components/astro/RLAChip.astro +51 -20
- package/src/components/astro/RLAColorPicker.astro +22 -18
- package/src/components/astro/RLACommandPalette.astro +22 -18
- package/src/components/astro/RLACompare.astro +22 -18
- package/src/components/astro/RLAConfirm.astro +117 -86
- package/src/components/astro/RLAContainer.astro +22 -18
- package/src/components/astro/RLAContextMenu.astro +22 -18
- package/src/components/astro/RLADashboardGroup.astro +22 -18
- package/src/components/astro/RLADashboardNavbar.astro +22 -18
- package/src/components/astro/RLADashboardPanel.astro +22 -18
- package/src/components/astro/RLADashboardResizeHandle.astro +22 -18
- package/src/components/astro/RLADashboardSearch.astro +22 -18
- package/src/components/astro/RLADashboardSearchButton.astro +22 -18
- package/src/components/astro/RLADashboardSidebar.astro +22 -18
- package/src/components/astro/RLADashboardSidebarCollapse.astro +22 -18
- package/src/components/astro/RLADashboardSidebarToggle.astro +22 -18
- package/src/components/astro/RLADashboardToolbar.astro +22 -18
- package/src/components/astro/RLADock.astro +22 -18
- package/src/{plugins/starlightAddons/components/Gamepad.astro → components/astro/RLADocsGamepad.astro} +178 -180
- package/src/{plugins/starlightAddons/components/Keyboard.astro → components/astro/RLADocsKeyboard.astro} +1 -3
- package/src/{plugins/starlightAddons/PackageManagers.astro → components/astro/RLADocsPackageManagers.astro} +28 -14
- package/src/components/astro/RLADrawer.astro +78 -74
- package/src/components/astro/RLAEditor.astro +22 -18
- package/src/components/astro/RLAEmpty.astro +22 -18
- package/src/components/astro/RLAError.astro +22 -18
- package/src/components/astro/RLAFieldset.astro +22 -18
- package/src/components/astro/RLAFloatingAction.astro +22 -18
- package/src/components/astro/RLAFooter.astro +39 -35
- package/src/components/astro/RLAForm.astro +23 -19
- package/src/components/astro/RLAGallery.astro +22 -18
- package/src/components/astro/RLAGrid.astro +39 -0
- package/src/components/astro/RLAHead.astro +427 -180
- package/src/components/astro/RLAHeader.astro +12 -53
- package/src/components/astro/RLAHoverCard.astro +35 -31
- package/src/components/astro/RLAIcon.astro +31 -27
- package/src/components/astro/RLAImage.astro +251 -19
- package/src/components/astro/RLAInputDate.astro +22 -18
- package/src/components/astro/RLAInputNumber.astro +22 -18
- package/src/components/astro/RLAInputTags.astro +22 -18
- package/src/components/astro/RLAInputTime.astro +22 -18
- package/src/components/astro/RLAKbd.astro +32 -22
- package/src/components/astro/RLAKnob.astro +22 -18
- package/src/components/astro/RLALabel.astro +27 -23
- package/src/components/astro/RLALink.astro +13 -10
- package/src/components/astro/RLALinkGroup.astro +99 -18
- package/src/components/astro/RLAListbox.astro +22 -18
- package/src/components/astro/RLALocaleSelector.astro +136 -109
- package/src/components/astro/RLALogo.astro +90 -56
- package/src/components/astro/RLAMain.astro +15 -4
- package/src/components/astro/RLAMarquee.astro +43 -32
- package/src/components/astro/RLAMegamenu.astro +22 -18
- package/src/components/astro/RLAMeter.astro +22 -18
- package/src/components/astro/RLAModal.astro +99 -95
- package/src/components/astro/RLANavigationMenu.astro +326 -136
- package/src/components/astro/RLAPage.astro +22 -18
- package/src/components/astro/RLAPageAside.astro +22 -18
- package/src/components/astro/RLAPageBody.astro +22 -18
- package/src/components/astro/RLAPageHeader.astro +22 -18
- package/src/components/astro/RLAPageSection.astro +5 -1
- package/src/components/astro/RLAPagination.astro +96 -94
- package/src/components/astro/RLAPassword.astro +22 -18
- package/src/components/astro/RLAPhoneMockup.astro +22 -18
- package/src/components/astro/RLAPinInput.astro +23 -0
- package/src/components/astro/RLAPlaceholder.astro +45 -41
- package/src/components/astro/RLAPopover.astro +35 -31
- package/src/components/astro/RLAPost.astro +65 -19
- package/src/components/astro/RLAPricingPlan.astro +22 -18
- package/src/components/astro/RLAPricingTable.astro +22 -18
- package/src/components/astro/RLAProgress.astro +8 -2
- package/src/components/astro/RLAProse.astro +22 -18
- package/src/components/astro/RLAQrCode.astro +22 -18
- package/src/components/astro/RLARadioGroup.astro +22 -18
- package/src/components/astro/RLARating.astro +22 -18
- package/src/components/astro/RLASelect.astro +38 -24
- package/src/components/astro/RLASeparator.astro +78 -27
- package/src/components/astro/RLASidebar.astro +212 -135
- package/src/components/astro/RLASkeleton.astro +24 -20
- package/src/components/astro/RLASlideover.astro +141 -72
- package/src/components/astro/RLASlider.astro +14 -14
- package/src/components/astro/RLASpeedDial.astro +22 -18
- package/src/components/astro/RLASplitter.astro +14 -2
- package/src/components/astro/RLASpoiler.astro +22 -18
- package/src/components/astro/RLAStepper.astro +22 -18
- package/src/components/astro/RLASteps.astro +71 -0
- package/src/components/astro/RLAStickySurface.astro +38 -27
- package/src/components/astro/RLATableOfContents.astro +22 -18
- package/src/components/astro/RLATabs.astro +133 -92
- package/src/components/astro/RLAThemeSelector.astro +5 -1
- package/src/components/astro/RLATimeline.astro +22 -18
- package/src/components/astro/RLATooltip.astro +35 -31
- package/src/components/astro/RLATour.astro +22 -18
- package/src/components/astro/RLATree.astro +22 -18
- package/src/components/astro/RLAUser.astro +22 -18
- package/src/components/astro/RLAVideo.astro +200 -196
- package/src/components/astro/RLAWatermark.astro +22 -18
- package/src/components/astro/RLAWindowMockup.astro +22 -18
- package/src/components/vue/RLVCheckbox.vue +68 -0
- package/src/components/vue/RLVForm.vue +44 -0
- package/src/components/vue/RLVFormField.vue +58 -0
- package/src/components/vue/RLVInput.vue +93 -0
- package/src/components/vue/RLVPost.vue +63 -0
- package/src/components/vue/RLVPosts.vue +21 -0
- package/src/components/vue/RLVSection.vue +5 -4
- package/src/components/vue/RLVToast.vue +68 -0
- package/src/components/vue/RLVToaster.vue +29 -0
- package/src/composables/index.ts +2 -0
- package/src/composables/useHeaderStore.ts +13 -0
- package/src/composables/useScrollToTop.ts +7 -7
- package/src/composables/useToast.ts +43 -0
- package/src/config/index.ts +1 -0
- package/src/config/security.ts +220 -0
- package/src/env.d.ts +0 -13
- package/src/integrations/ui.ts +199 -208
- package/src/middleware/security.ts +75 -15
- package/src/plugins/index.ts +0 -3
- package/src/plugins/starlightDocsApi/index.ts +20 -13
- package/src/presets/defaults.ts +12 -0
- package/src/presets/index.ts +683 -537
- package/src/styles/index.css +0 -2
- package/src/themes/3d-hover.theme.ts +11 -8
- package/src/themes/accordion.theme.ts +11 -8
- package/src/themes/alert.theme.ts +96 -21
- package/src/themes/app.theme.ts +11 -8
- package/src/themes/aspect-ratio.theme.ts +10 -8
- package/src/themes/audio.theme.ts +11 -8
- package/src/themes/avatar-group.theme.ts +9 -7
- package/src/themes/avatar.theme.ts +79 -23
- package/src/themes/badge.theme.ts +119 -16
- package/src/themes/banner.theme.ts +11 -8
- package/src/themes/breadcrumb.theme.ts +14 -12
- package/src/themes/browser-mockup.theme.ts +11 -8
- package/src/themes/button.theme.ts +224 -195
- package/src/themes/calendar.theme.ts +11 -8
- package/src/themes/card.theme.ts +37 -29
- package/src/themes/carousel.theme.ts +30 -28
- package/src/themes/changelog.theme.ts +11 -8
- package/src/themes/chart.theme.ts +2 -1
- package/src/themes/chat-message.theme.ts +11 -8
- package/src/themes/chat-messages.theme.ts +11 -8
- package/src/themes/chat-palette.theme.ts +11 -8
- package/src/themes/chat-prompt-submit.theme.ts +11 -8
- package/src/themes/chat-prompt.theme.ts +11 -8
- package/src/themes/chat-reasoning.theme.ts +11 -8
- package/src/themes/chat-shimmer.theme.ts +11 -8
- package/src/themes/chat-tool.theme.ts +11 -8
- package/src/themes/chat.theme.ts +11 -8
- package/src/themes/checkbox.theme.ts +12 -10
- package/src/themes/chip.theme.ts +71 -13
- package/src/themes/color-picker.theme.ts +11 -8
- package/src/themes/command-palette.theme.ts +11 -8
- package/src/themes/compare.theme.ts +11 -8
- package/src/themes/confirm.theme.ts +43 -28
- package/src/themes/container.theme.ts +11 -8
- package/src/themes/context-menu.theme.ts +11 -8
- package/src/themes/dashboard-group.theme.ts +11 -8
- package/src/themes/dashboard-navbar.theme.ts +11 -8
- package/src/themes/dashboard-panel.theme.ts +11 -8
- package/src/themes/dashboard-resize-handle.theme.ts +11 -8
- package/src/themes/dashboard-search-button.theme.ts +11 -8
- package/src/themes/dashboard-search.theme.ts +11 -8
- package/src/themes/dashboard-sidebar-collapse.theme.ts +11 -8
- package/src/themes/dashboard-sidebar-toggle.theme.ts +11 -8
- package/src/themes/dashboard-sidebar.theme.ts +11 -8
- package/src/themes/dashboard-toolbar.theme.ts +11 -8
- package/src/themes/dock.theme.ts +11 -8
- package/src/themes/drawer.theme.ts +55 -38
- package/src/themes/dropdown-menu.theme.ts +4 -2
- package/src/themes/editor.theme.ts +11 -8
- package/src/themes/empty.theme.ts +11 -8
- package/src/themes/error.theme.ts +11 -8
- package/src/themes/field-group.theme.ts +2 -1
- package/src/themes/fieldset.theme.ts +11 -8
- package/src/themes/floating-action.theme.ts +11 -8
- package/src/themes/footer.theme.ts +26 -23
- package/src/themes/form.theme.ts +11 -8
- package/src/themes/gallery.theme.ts +11 -8
- package/src/themes/head.theme.ts +11 -8
- package/src/themes/header.theme.ts +38 -36
- package/src/themes/hover-card.theme.ts +25 -23
- package/src/themes/icon.theme.ts +20 -17
- package/src/themes/image.theme.ts +21 -8
- package/src/themes/input-date.theme.ts +11 -8
- package/src/themes/input-menu.theme.ts +11 -4
- package/src/themes/input-number.theme.ts +11 -8
- package/src/themes/input-tags.theme.ts +11 -8
- package/src/themes/input-time.theme.ts +11 -8
- package/src/themes/input.theme.ts +2 -1
- package/src/themes/kbd.theme.ts +91 -20
- package/src/themes/knob.theme.ts +11 -8
- package/src/themes/label.theme.ts +18 -16
- package/src/themes/link-group.theme.ts +30 -8
- package/src/themes/link.theme.ts +11 -8
- package/src/themes/listbox.theme.ts +11 -8
- package/src/themes/locale-selector.theme.ts +49 -50
- package/src/themes/logo.theme.ts +11 -8
- package/src/themes/main.theme.ts +13 -12
- package/src/themes/marquee.theme.ts +24 -22
- package/src/themes/megamenu.theme.ts +11 -8
- package/src/themes/meter.theme.ts +11 -8
- package/src/themes/modal.theme.ts +44 -32
- package/src/themes/navigation-menu.theme.ts +34 -9
- package/src/themes/page-aside.theme.ts +11 -8
- package/src/themes/page-body.theme.ts +11 -8
- package/src/themes/page-header.theme.ts +11 -8
- package/src/themes/page-section.theme.ts +173 -172
- package/src/themes/page.theme.ts +11 -8
- package/src/themes/pagination.theme.ts +24 -22
- package/src/themes/password.theme.ts +11 -8
- package/src/themes/phone-mockup.theme.ts +11 -8
- package/src/themes/pin-input.theme.ts +14 -0
- package/src/themes/placeholder.theme.ts +13 -10
- package/src/themes/popover.theme.ts +26 -24
- package/src/themes/post.theme.ts +31 -8
- package/src/themes/pricing-plan.theme.ts +11 -8
- package/src/themes/pricing-table.theme.ts +11 -8
- package/src/themes/progress.theme.ts +10 -9
- package/src/themes/prose.theme.ts +11 -8
- package/src/themes/qr-code.theme.ts +11 -8
- package/src/themes/quote.theme.ts +11 -8
- package/src/themes/radio-group.theme.ts +11 -8
- package/src/themes/rating.theme.ts +11 -8
- package/src/themes/scroll-area.theme.ts +4 -2
- package/src/themes/scroll-to-top.theme.ts +12 -10
- package/src/themes/select.theme.ts +4 -2
- package/src/themes/separator.theme.ts +143 -15
- package/src/themes/sidebar.theme.ts +9 -4
- package/src/themes/skeleton.theme.ts +17 -16
- package/src/themes/slideover.theme.ts +53 -37
- package/src/themes/slider.theme.ts +13 -11
- package/src/themes/speed-dial.theme.ts +11 -8
- package/src/themes/spinner.theme.ts +2 -3
- package/src/themes/splitter.theme.ts +2 -1
- package/src/themes/spoiler.theme.ts +11 -8
- package/src/themes/stepper.theme.ts +11 -8
- package/src/themes/sticky-surface.theme.ts +9 -7
- package/src/themes/switch.theme.ts +12 -10
- package/src/themes/table-of-contents.theme.ts +46 -8
- package/src/themes/tabs.theme.ts +14 -6
- package/src/themes/textarea.theme.ts +2 -1
- package/src/themes/theme-selector.theme.ts +15 -16
- package/src/themes/timeline.theme.ts +11 -8
- package/src/themes/toast.theme.ts +10 -4
- package/src/themes/tooltip.theme.ts +24 -23
- package/src/themes/tour.theme.ts +11 -8
- package/src/themes/tree.theme.ts +11 -8
- package/src/themes/user.theme.ts +11 -8
- package/src/themes/video.theme.ts +15 -12
- package/src/themes/watermark.theme.ts +11 -8
- package/src/themes/window-mockup.theme.ts +11 -8
- package/src/types/components/3d-hover.ts +1 -1
- package/src/types/components/alert.ts +2 -2
- package/src/types/components/app.ts +1 -1
- package/src/types/components/audio.ts +1 -1
- package/src/types/components/avatar-group.ts +11 -12
- package/src/types/components/avatar.ts +46 -21
- package/src/types/components/badge.ts +2 -2
- package/src/types/components/banner.ts +1 -1
- package/src/types/components/browser-mockup.ts +1 -1
- package/src/types/components/button.ts +7 -10
- package/src/types/components/calendar.ts +1 -1
- package/src/types/components/changelog.ts +1 -1
- package/src/types/components/chart.ts +2 -1
- package/src/types/components/chat-message.ts +1 -1
- package/src/types/components/chat-messages.ts +1 -1
- package/src/types/components/chat-palette.ts +1 -1
- package/src/types/components/chat-prompt-submit.ts +1 -1
- package/src/types/components/chat-prompt.ts +1 -1
- package/src/types/components/chat-reasoning.ts +1 -1
- package/src/types/components/chat-shimmer.ts +1 -1
- package/src/types/components/chat-tool.ts +1 -1
- package/src/types/components/chat.ts +1 -1
- package/src/types/components/checkbox.ts +2 -2
- package/src/types/components/chip.ts +1 -1
- package/src/types/components/collapsible.ts +2 -1
- package/src/types/components/color-picker.ts +1 -1
- package/src/types/components/command-palette.ts +1 -1
- package/src/types/components/compare.ts +1 -1
- package/src/types/components/container.ts +7 -1
- package/src/types/components/context-menu.ts +1 -1
- package/src/types/components/dashboard-group.ts +1 -1
- package/src/types/components/dashboard-navbar.ts +1 -1
- package/src/types/components/dashboard-panel.ts +1 -1
- package/src/types/components/dashboard-resize-handle.ts +1 -1
- package/src/types/components/dashboard-search-button.ts +1 -1
- package/src/types/components/dashboard-search.ts +1 -1
- package/src/types/components/dashboard-sidebar-collapse.ts +1 -1
- package/src/types/components/dashboard-sidebar-toggle.ts +1 -1
- package/src/types/components/dashboard-sidebar.ts +1 -1
- package/src/types/components/dashboard-toolbar.ts +1 -1
- package/src/types/components/dock.ts +1 -1
- package/src/types/components/dropdown-menu.ts +2 -1
- package/src/types/components/editor.ts +1 -1
- package/src/types/components/empty.ts +1 -1
- package/src/types/components/error.ts +1 -1
- package/src/types/components/fieldset.ts +1 -1
- package/src/types/components/file-upload.ts +2 -1
- package/src/types/components/floating-action.ts +1 -1
- package/src/types/components/form.ts +9 -1
- package/src/types/components/gallery.ts +1 -1
- package/src/types/components/icon.ts +0 -1
- package/src/types/components/image.ts +28 -7
- package/src/types/components/index.ts +134 -134
- package/src/types/components/input-date.ts +1 -1
- package/src/types/components/input-menu.ts +2 -2
- package/src/types/components/input-number.ts +1 -1
- package/src/types/components/input-pin.ts +26 -1
- package/src/types/components/input-tags.ts +1 -1
- package/src/types/components/input-time.ts +1 -1
- package/src/types/components/input.ts +2 -2
- package/src/types/components/knob.ts +1 -1
- package/src/types/components/link-group.ts +35 -1
- package/src/types/components/link.ts +4 -0
- package/src/types/components/listbox.ts +1 -1
- package/src/types/components/locale-selector.ts +33 -33
- package/src/types/components/logo.ts +5 -0
- package/src/types/components/main.ts +17 -17
- package/src/types/components/megamenu.ts +1 -1
- package/src/types/components/meter.ts +1 -1
- package/src/types/components/modal.ts +0 -1
- package/src/types/components/navigation-menu.ts +13 -8
- package/src/types/components/page-aside.ts +1 -1
- package/src/types/components/page-body.ts +1 -1
- package/src/types/components/page-header.ts +1 -1
- package/src/types/components/page.ts +1 -1
- package/src/types/components/password.ts +1 -1
- package/src/types/components/phone-mockup.ts +1 -1
- package/src/types/components/pin-input.ts +11 -0
- package/src/types/components/popover.ts +0 -1
- package/src/types/components/post.ts +25 -1
- package/src/types/components/pricing-plan.ts +1 -1
- package/src/types/components/pricing-table.ts +1 -1
- package/src/types/components/progress.ts +2 -3
- package/src/types/components/prose.ts +1 -1
- package/src/types/components/qr-code.ts +1 -1
- package/src/types/components/radio-group.ts +1 -1
- package/src/types/components/rating.ts +1 -1
- package/src/types/components/scroll-area.ts +0 -1
- package/src/types/components/scroll-to-top.ts +2 -2
- package/src/types/components/select.ts +2 -1
- package/src/types/components/separator.ts +0 -1
- package/src/types/components/sidebar.ts +53 -3
- package/src/types/components/slideover.ts +0 -1
- package/src/types/components/slider.ts +2 -2
- package/src/types/components/speed-dial.ts +1 -1
- package/src/types/components/spinner.ts +2 -3
- package/src/types/components/splitter.ts +0 -1
- package/src/types/components/spoiler.ts +1 -1
- package/src/types/components/stepper.ts +1 -1
- package/src/types/components/sticky-surface.ts +0 -1
- package/src/types/components/switch.ts +2 -3
- package/src/types/components/table-of-contents.ts +7 -1
- package/src/types/components/tabs.ts +2 -1
- package/src/types/components/textarea.ts +2 -1
- package/src/types/components/theme-selector.ts +15 -15
- package/src/types/components/timeline.ts +1 -1
- package/src/types/components/toast.ts +2 -1
- package/src/types/components/tooltip.ts +0 -1
- package/src/types/components/tour.ts +1 -1
- package/src/types/components/tree.ts +1 -1
- package/src/types/components/user.ts +1 -1
- package/src/types/components/watermark.ts +1 -1
- package/src/types/components/window-mockup.ts +1 -1
- package/src/types/theme.ts +10 -0
- package/src/utils/docs.ts +215 -0
- package/src/utils/headerStack.ts +12 -5
- package/src/utils/index.ts +1 -0
- package/src/components/astro/RLAInputPin.astro +0 -19
- package/src/integrations/vue-entrypoint.ts +0 -6
- package/src/nuxt.ts +0 -125
- package/src/plugins/starlightAddons/PageTitle.astro +0 -113
- package/src/plugins/starlightAddons/index.ts +0 -58
- package/src/plugins/starlightAddons/starlight.d.ts +0 -6
- package/src/themes/input-pin.theme.ts +0 -10
|
@@ -1,181 +1,428 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { ClientRouter } from 'astro:transitions';
|
|
3
|
-
import type { SiteConfig } from '@/config';
|
|
4
|
-
|
|
5
|
-
export interface OGImage {
|
|
6
|
-
/** Image URL (relative or absolute) */
|
|
7
|
-
src: string;
|
|
8
|
-
/** Alt text for the image */
|
|
9
|
-
alt: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RSSFeed {
|
|
13
|
-
/** RSS feed URL */
|
|
14
|
-
href: string;
|
|
15
|
-
/** Feed title (defaults to "RSS") */
|
|
16
|
-
title?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface HeadProps {
|
|
20
|
-
/** Page title */
|
|
21
|
-
title?: string;
|
|
22
|
-
/** Page description */
|
|
23
|
-
description?: string;
|
|
24
|
-
/** Open Graph image with alt text */
|
|
25
|
-
ogImage?: OGImage;
|
|
26
|
-
/** Open Graph type (e.g., "website", "article") */
|
|
27
|
-
ogType?: string;
|
|
28
|
-
/** Open Graph locale (defaults to "en_US") */
|
|
29
|
-
ogLocale?: string;
|
|
30
|
-
/** Whether to prevent indexing */
|
|
31
|
-
noindex?: boolean;
|
|
32
|
-
/** Whether this is a 404 page */
|
|
33
|
-
is404?: boolean;
|
|
34
|
-
/** Robots metadata (overrides noindex/is404 logic if provided) */
|
|
35
|
-
robots?: string;
|
|
36
|
-
/** Canonical URL */
|
|
37
|
-
canonical?: string;
|
|
38
|
-
/** Language alternates for i18n */
|
|
39
|
-
languageAlternates?: Array<{ hreflang: string; href: string }>;
|
|
40
|
-
/** Site configuration for defaults */
|
|
41
|
-
config?: SiteConfig;
|
|
42
|
-
/** Whether to enable View Transitions (ClientRouter) */
|
|
43
|
-
transitions?: boolean;
|
|
44
|
-
/** Meta charset */
|
|
45
|
-
charset?: string;
|
|
46
|
-
/** Meta viewport */
|
|
47
|
-
viewport?: string;
|
|
48
|
-
/** RSS feed configuration */
|
|
49
|
-
rssFeed?: RSSFeed;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const {
|
|
53
|
-
title,
|
|
54
|
-
description,
|
|
55
|
-
ogImage,
|
|
56
|
-
ogType = 'website',
|
|
57
|
-
ogLocale = 'en_US',
|
|
58
|
-
noindex = false,
|
|
59
|
-
is404 = false,
|
|
60
|
-
robots,
|
|
61
|
-
canonical,
|
|
62
|
-
languageAlternates = [],
|
|
63
|
-
config,
|
|
64
|
-
transitions = true,
|
|
65
|
-
charset = 'utf-8',
|
|
66
|
-
viewport = 'width=device-width,initial-scale=1',
|
|
67
|
-
rssFeed,
|
|
68
|
-
} = Astro.props as HeadProps;
|
|
69
|
-
|
|
70
|
-
// Resolve defaults from config if available
|
|
71
|
-
const siteName = config?.name || 'Rimelight';
|
|
72
|
-
const siteDescription = config?.description || '';
|
|
73
|
-
const ogImageFallback = config?.seo?.ogImageFallback || config?.ogImage || '';
|
|
74
|
-
const themeColor = config?.branding?.colors?.themeColor;
|
|
75
|
-
const favicon = config?.branding?.favicon?.svg || '/favicon.svg';
|
|
76
|
-
const twitterHandle = config?.seo?.authorHandle;
|
|
77
|
-
const titleTemplate = config?.seo?.titleTemplate || `%s | ${siteName}`;
|
|
78
|
-
|
|
79
|
-
// Calculated Values
|
|
80
|
-
const displayTitle = is404
|
|
81
|
-
? `404 - Not Found | ${siteName}`
|
|
82
|
-
: title
|
|
83
|
-
? titleTemplate.replace('%s', title)
|
|
84
|
-
: siteName;
|
|
85
|
-
|
|
86
|
-
const finalDescription = description || siteDescription;
|
|
87
|
-
const safeDescription = finalDescription && config?.seo?.maxDescriptionLength
|
|
88
|
-
? (finalDescription.length > config.seo.maxDescriptionLength
|
|
89
|
-
? finalDescription.slice(0, config.seo.maxDescriptionLength - 3) + '...'
|
|
90
|
-
: finalDescription)
|
|
91
|
-
: finalDescription;
|
|
92
|
-
|
|
93
|
-
const finalOgImage = ogImage || (ogImageFallback ? { src: ogImageFallback, alt: siteName } : undefined);
|
|
94
|
-
const absoluteOgImage = finalOgImage
|
|
95
|
-
? new URL(finalOgImage.src, Astro.site).toString()
|
|
96
|
-
: undefined;
|
|
97
|
-
|
|
98
|
-
function formatCanonicalURL(url: string | URL) {
|
|
99
|
-
const resolved = new URL(url, Astro.site);
|
|
100
|
-
const path = resolved.toString();
|
|
101
|
-
const hasQueryParams = path.includes('?');
|
|
102
|
-
if (hasQueryParams) {
|
|
103
|
-
return path.replace(/\/?$/, '');
|
|
104
|
-
}
|
|
105
|
-
return path.replace(/\/?$/, '/');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const finalCanonical = canonical
|
|
109
|
-
? formatCanonicalURL(canonical)
|
|
110
|
-
: (!is404 ? formatCanonicalURL(Astro.url) : undefined);
|
|
111
|
-
|
|
112
|
-
const isIndexable = !noindex && !is404;
|
|
113
|
-
const defaultRobots = isIndexable ? 'index, follow, max-image-preview:large' : 'noindex, nofollow';
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
<!-- Basic Metadata -->
|
|
117
|
-
<meta charset={charset} />
|
|
118
|
-
<meta name="viewport" content={viewport} />
|
|
119
|
-
<meta name="generator" content={Astro.generator} />
|
|
120
|
-
|
|
121
|
-
<!-- Sitemap -->
|
|
122
|
-
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
123
|
-
|
|
124
|
-
<!-- RSS Feed -->
|
|
125
|
-
{rssFeed && <link rel="alternate" type="application/rss+xml" href={rssFeed.href} title={rssFeed.title || 'RSS'} />}
|
|
126
|
-
|
|
127
|
-
<!-- SEO -->
|
|
128
|
-
<title>{displayTitle}</title>
|
|
129
|
-
{safeDescription && <meta name="description" content={safeDescription} />}
|
|
130
|
-
<meta name="robots" content={robots || defaultRobots} />
|
|
131
|
-
{finalCanonical && <link rel="canonical" href={finalCanonical} />}
|
|
132
|
-
|
|
133
|
-
<!-- i18n Alternates -->
|
|
134
|
-
{languageAlternates.map((alt) => (
|
|
135
|
-
<link rel="alternate" hreflang={alt.hreflang} href={alt.href} />
|
|
136
|
-
))}
|
|
137
|
-
|
|
138
|
-
<!-- Open Graph / Facebook -->
|
|
139
|
-
<meta property="og:type" content={ogType} />
|
|
140
|
-
<meta property="og:locale" content={ogLocale} />
|
|
141
|
-
<meta property="og:url" content={Astro.url.href} />
|
|
142
|
-
<meta property="og:title" content={title || siteName} />
|
|
143
|
-
{safeDescription && <meta property="og:description" content={safeDescription} />}
|
|
144
|
-
{absoluteOgImage && <meta property="og:image" content={absoluteOgImage} />}
|
|
145
|
-
{finalOgImage && <meta property="og:image:alt" content={finalOgImage.alt} />}
|
|
146
|
-
<meta property="og:site_name" content={siteName} />
|
|
147
|
-
|
|
148
|
-
<!-- Twitter -->
|
|
149
|
-
<meta property="twitter:card" content="summary_large_image" />
|
|
150
|
-
<meta property="twitter:url" content={Astro.url.href} />
|
|
151
|
-
<meta property="twitter:title" content={title || siteName} />
|
|
152
|
-
{safeDescription && <meta property="twitter:description" content={safeDescription} />}
|
|
153
|
-
{absoluteOgImage && <meta property="twitter:image" content={absoluteOgImage} />}
|
|
154
|
-
{finalOgImage && <meta property="twitter:image:alt" content={finalOgImage.alt} />}
|
|
155
|
-
{twitterHandle && <meta property="twitter:site" content={twitterHandle} />}
|
|
156
|
-
{twitterHandle && <meta property="twitter:creator" content={twitterHandle} />}
|
|
157
|
-
|
|
158
|
-
<!-- Icons -->
|
|
159
|
-
<link rel="icon" type="image/svg+xml" href={favicon} />
|
|
160
|
-
|
|
161
|
-
<!-- Theme -->
|
|
162
|
-
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
163
|
-
|
|
164
|
-
<script is:inline>
|
|
165
|
-
(function() {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
1
|
+
---
|
|
2
|
+
import { ClientRouter } from 'astro:transitions';
|
|
3
|
+
import type { SiteConfig } from '@/config';
|
|
4
|
+
|
|
5
|
+
export interface OGImage {
|
|
6
|
+
/** Image URL (relative or absolute) */
|
|
7
|
+
src: string;
|
|
8
|
+
/** Alt text for the image */
|
|
9
|
+
alt: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RSSFeed {
|
|
13
|
+
/** RSS feed URL */
|
|
14
|
+
href: string;
|
|
15
|
+
/** Feed title (defaults to "RSS") */
|
|
16
|
+
title?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface HeadProps {
|
|
20
|
+
/** Page title */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Page description */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Open Graph image with alt text */
|
|
25
|
+
ogImage?: OGImage;
|
|
26
|
+
/** Open Graph type (e.g., "website", "article") */
|
|
27
|
+
ogType?: string;
|
|
28
|
+
/** Open Graph locale (defaults to "en_US") */
|
|
29
|
+
ogLocale?: string;
|
|
30
|
+
/** Whether to prevent indexing */
|
|
31
|
+
noindex?: boolean;
|
|
32
|
+
/** Whether this is a 404 page */
|
|
33
|
+
is404?: boolean;
|
|
34
|
+
/** Robots metadata (overrides noindex/is404 logic if provided) */
|
|
35
|
+
robots?: string;
|
|
36
|
+
/** Canonical URL */
|
|
37
|
+
canonical?: string;
|
|
38
|
+
/** Language alternates for i18n */
|
|
39
|
+
languageAlternates?: Array<{ hreflang: string; href: string }>;
|
|
40
|
+
/** Site configuration for defaults */
|
|
41
|
+
config?: SiteConfig;
|
|
42
|
+
/** Whether to enable View Transitions (ClientRouter) */
|
|
43
|
+
transitions?: boolean;
|
|
44
|
+
/** Meta charset */
|
|
45
|
+
charset?: string;
|
|
46
|
+
/** Meta viewport */
|
|
47
|
+
viewport?: string;
|
|
48
|
+
/** RSS feed configuration */
|
|
49
|
+
rssFeed?: RSSFeed;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
title,
|
|
54
|
+
description,
|
|
55
|
+
ogImage,
|
|
56
|
+
ogType = 'website',
|
|
57
|
+
ogLocale = 'en_US',
|
|
58
|
+
noindex = false,
|
|
59
|
+
is404 = false,
|
|
60
|
+
robots,
|
|
61
|
+
canonical,
|
|
62
|
+
languageAlternates = [],
|
|
63
|
+
config,
|
|
64
|
+
transitions = true,
|
|
65
|
+
charset = 'utf-8',
|
|
66
|
+
viewport = 'width=device-width,initial-scale=1',
|
|
67
|
+
rssFeed,
|
|
68
|
+
} = Astro.props as HeadProps;
|
|
69
|
+
|
|
70
|
+
// Resolve defaults from config if available
|
|
71
|
+
const siteName = config?.name || 'Rimelight';
|
|
72
|
+
const siteDescription = config?.description || '';
|
|
73
|
+
const ogImageFallback = config?.seo?.ogImageFallback || config?.ogImage || '';
|
|
74
|
+
const themeColor = config?.branding?.colors?.themeColor;
|
|
75
|
+
const favicon = config?.branding?.favicon?.svg || '/favicon.svg';
|
|
76
|
+
const twitterHandle = config?.seo?.authorHandle;
|
|
77
|
+
const titleTemplate = config?.seo?.titleTemplate || `%s | ${siteName}`;
|
|
78
|
+
|
|
79
|
+
// Calculated Values
|
|
80
|
+
const displayTitle = is404
|
|
81
|
+
? `404 - Not Found | ${siteName}`
|
|
82
|
+
: title
|
|
83
|
+
? titleTemplate.replace('%s', title)
|
|
84
|
+
: siteName;
|
|
85
|
+
|
|
86
|
+
const finalDescription = description || siteDescription;
|
|
87
|
+
const safeDescription = finalDescription && config?.seo?.maxDescriptionLength
|
|
88
|
+
? (finalDescription.length > config.seo.maxDescriptionLength
|
|
89
|
+
? finalDescription.slice(0, config.seo.maxDescriptionLength - 3) + '...'
|
|
90
|
+
: finalDescription)
|
|
91
|
+
: finalDescription;
|
|
92
|
+
|
|
93
|
+
const finalOgImage = ogImage || (ogImageFallback ? { src: ogImageFallback, alt: siteName } : undefined);
|
|
94
|
+
const absoluteOgImage = finalOgImage
|
|
95
|
+
? new URL(finalOgImage.src, Astro.site).toString()
|
|
96
|
+
: undefined;
|
|
97
|
+
|
|
98
|
+
function formatCanonicalURL(url: string | URL) {
|
|
99
|
+
const resolved = new URL(url, Astro.site);
|
|
100
|
+
const path = resolved.toString();
|
|
101
|
+
const hasQueryParams = path.includes('?');
|
|
102
|
+
if (hasQueryParams) {
|
|
103
|
+
return path.replace(/\/?$/, '');
|
|
104
|
+
}
|
|
105
|
+
return path.replace(/\/?$/, '/');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const finalCanonical = canonical
|
|
109
|
+
? formatCanonicalURL(canonical)
|
|
110
|
+
: (!is404 ? formatCanonicalURL(Astro.url) : undefined);
|
|
111
|
+
|
|
112
|
+
const isIndexable = !noindex && !is404;
|
|
113
|
+
const defaultRobots = isIndexable ? 'index, follow, max-image-preview:large' : 'noindex, nofollow';
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
<!-- Basic Metadata -->
|
|
117
|
+
<meta charset={charset} />
|
|
118
|
+
<meta name="viewport" content={viewport} />
|
|
119
|
+
<meta name="generator" content={Astro.generator} />
|
|
120
|
+
|
|
121
|
+
<!-- Sitemap -->
|
|
122
|
+
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
123
|
+
|
|
124
|
+
<!-- RSS Feed -->
|
|
125
|
+
{rssFeed && <link rel="alternate" type="application/rss+xml" href={rssFeed.href} title={rssFeed.title || 'RSS'} />}
|
|
126
|
+
|
|
127
|
+
<!-- SEO -->
|
|
128
|
+
<title>{displayTitle}</title>
|
|
129
|
+
{safeDescription && <meta name="description" content={safeDescription} />}
|
|
130
|
+
<meta name="robots" content={robots || defaultRobots} />
|
|
131
|
+
{finalCanonical && <link rel="canonical" href={finalCanonical} />}
|
|
132
|
+
|
|
133
|
+
<!-- i18n Alternates -->
|
|
134
|
+
{languageAlternates.map((alt) => (
|
|
135
|
+
<link rel="alternate" hreflang={alt.hreflang} href={alt.href} />
|
|
136
|
+
))}
|
|
137
|
+
|
|
138
|
+
<!-- Open Graph / Facebook -->
|
|
139
|
+
<meta property="og:type" content={ogType} />
|
|
140
|
+
<meta property="og:locale" content={ogLocale} />
|
|
141
|
+
<meta property="og:url" content={Astro.url.href} />
|
|
142
|
+
<meta property="og:title" content={title || siteName} />
|
|
143
|
+
{safeDescription && <meta property="og:description" content={safeDescription} />}
|
|
144
|
+
{absoluteOgImage && <meta property="og:image" content={absoluteOgImage} />}
|
|
145
|
+
{finalOgImage && <meta property="og:image:alt" content={finalOgImage.alt} />}
|
|
146
|
+
<meta property="og:site_name" content={siteName} />
|
|
147
|
+
|
|
148
|
+
<!-- Twitter -->
|
|
149
|
+
<meta property="twitter:card" content="summary_large_image" />
|
|
150
|
+
<meta property="twitter:url" content={Astro.url.href} />
|
|
151
|
+
<meta property="twitter:title" content={title || siteName} />
|
|
152
|
+
{safeDescription && <meta property="twitter:description" content={safeDescription} />}
|
|
153
|
+
{absoluteOgImage && <meta property="twitter:image" content={absoluteOgImage} />}
|
|
154
|
+
{finalOgImage && <meta property="twitter:image:alt" content={finalOgImage.alt} />}
|
|
155
|
+
{twitterHandle && <meta property="twitter:site" content={twitterHandle} />}
|
|
156
|
+
{twitterHandle && <meta property="twitter:creator" content={twitterHandle} />}
|
|
157
|
+
|
|
158
|
+
<!-- Icons -->
|
|
159
|
+
<link rel="icon" type="image/svg+xml" href={favicon} />
|
|
160
|
+
|
|
161
|
+
<!-- Theme -->
|
|
162
|
+
{themeColor && <meta name="theme-color" content={themeColor} />}
|
|
163
|
+
|
|
164
|
+
<script is:inline>
|
|
165
|
+
(function() {
|
|
166
|
+
if (!window.initialCspNonce) {
|
|
167
|
+
window.initialCspNonce = document.querySelector('meta[name="csp-nonce"]')?.getAttribute('content') ||
|
|
168
|
+
Array.from(document.querySelectorAll('script')).find(function(s) { return s.nonce; })?.nonce ||
|
|
169
|
+
document.querySelector('script[nonce]')?.nonce ||
|
|
170
|
+
document.querySelector('style[nonce]')?.nonce;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var orig = document.createElement;
|
|
174
|
+
document.createElement = function(tag, opts) {
|
|
175
|
+
var el = orig.call(document, tag, opts);
|
|
176
|
+
var lowTag = tag.toLowerCase();
|
|
177
|
+
if (lowTag === 'script' || lowTag === 'style') {
|
|
178
|
+
var nonce = window.initialCspNonce;
|
|
179
|
+
if (nonce) {
|
|
180
|
+
el.setAttribute('nonce', nonce);
|
|
181
|
+
el.nonce = nonce;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return el;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Synchronous DOM insertion overrides to catch cloned, imported, or createElementNS tags
|
|
188
|
+
var origAppend = Element.prototype.appendChild;
|
|
189
|
+
Element.prototype.appendChild = function(child) {
|
|
190
|
+
if (child && (child.tagName === 'SCRIPT' || child.tagName === 'STYLE')) {
|
|
191
|
+
var nonce = window.initialCspNonce;
|
|
192
|
+
if (nonce && !child.getAttribute('nonce')) {
|
|
193
|
+
child.setAttribute('nonce', nonce);
|
|
194
|
+
child.nonce = nonce;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return origAppend.apply(this, arguments);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
var origInsert = Element.prototype.insertBefore;
|
|
201
|
+
Element.prototype.insertBefore = function(newChild, refChild) {
|
|
202
|
+
if (newChild && (newChild.tagName === 'SCRIPT' || newChild.tagName === 'STYLE')) {
|
|
203
|
+
var nonce = window.initialCspNonce;
|
|
204
|
+
if (nonce && !newChild.getAttribute('nonce')) {
|
|
205
|
+
newChild.setAttribute('nonce', nonce);
|
|
206
|
+
newChild.nonce = nonce;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return origInsert.apply(this, arguments);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var origAppendMethod = Element.prototype.append;
|
|
213
|
+
if (origAppendMethod) {
|
|
214
|
+
Element.prototype.append = function() {
|
|
215
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
216
|
+
var arg = arguments[i];
|
|
217
|
+
if (arg && (arg.tagName === 'SCRIPT' || arg.tagName === 'STYLE')) {
|
|
218
|
+
var nonce = window.initialCspNonce;
|
|
219
|
+
if (nonce && !arg.getAttribute('nonce')) {
|
|
220
|
+
arg.setAttribute('nonce', nonce);
|
|
221
|
+
arg.nonce = nonce;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return origAppendMethod.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var origPrependMethod = Element.prototype.prepend;
|
|
230
|
+
if (origPrependMethod) {
|
|
231
|
+
Element.prototype.prepend = function() {
|
|
232
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
233
|
+
var arg = arguments[i];
|
|
234
|
+
if (arg && (arg.tagName === 'SCRIPT' || arg.tagName === 'STYLE')) {
|
|
235
|
+
var nonce = window.initialCspNonce;
|
|
236
|
+
if (nonce && !arg.getAttribute('nonce')) {
|
|
237
|
+
arg.setAttribute('nonce', nonce);
|
|
238
|
+
arg.nonce = nonce;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return origPrependMethod.apply(this, arguments);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function getThemeClass() {
|
|
247
|
+
var stored = localStorage.getItem('theme');
|
|
248
|
+
if (stored === 'dark') return 'dark';
|
|
249
|
+
if (stored === 'light') return '';
|
|
250
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : '';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function applyTheme(doc) {
|
|
254
|
+
var cls = getThemeClass();
|
|
255
|
+
if (cls) {
|
|
256
|
+
doc.documentElement.classList.add('dark');
|
|
257
|
+
} else {
|
|
258
|
+
doc.documentElement.classList.remove('dark');
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Apply immediately on initial load
|
|
263
|
+
applyTheme(document);
|
|
264
|
+
|
|
265
|
+
// Apply to incoming document BEFORE the swap — eliminates the flash
|
|
266
|
+
document.addEventListener('astro:before-swap', function(e) {
|
|
267
|
+
applyTheme(e.newDocument);
|
|
268
|
+
var nonce = window.initialCspNonce;
|
|
269
|
+
if (nonce) {
|
|
270
|
+
e.newDocument.querySelectorAll('script').forEach(function(s) {
|
|
271
|
+
s.setAttribute('nonce', nonce);
|
|
272
|
+
});
|
|
273
|
+
e.newDocument.querySelectorAll('style').forEach(function(s) {
|
|
274
|
+
s.setAttribute('nonce', nonce);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Safety net: re-apply after swap in case anything overrides it
|
|
280
|
+
document.addEventListener('astro:after-swap', function() {
|
|
281
|
+
applyTheme(document);
|
|
282
|
+
});
|
|
283
|
+
})();
|
|
284
|
+
</script>
|
|
285
|
+
|
|
286
|
+
<script is:inline data-astro-rerun>
|
|
287
|
+
(function() {
|
|
288
|
+
'use strict';
|
|
289
|
+
if (window.rlHeaderObserver) window.rlHeaderObserver.disconnect();
|
|
290
|
+
|
|
291
|
+
if (!window.RLHeaderStack) {
|
|
292
|
+
window.RLHeaderStack = {
|
|
293
|
+
layers: [],
|
|
294
|
+
register: function(id, order, naturalHeight, isVisible, el) {
|
|
295
|
+
let layer = this.layers.find(function(l) { return l.id === id; });
|
|
296
|
+
if (!layer) {
|
|
297
|
+
layer = { id: id, order: order, naturalHeight: naturalHeight, isVisible: isVisible, el: el };
|
|
298
|
+
this.layers.push(layer);
|
|
299
|
+
this.layers.sort(function(a, b) { return a.order - b.order; });
|
|
300
|
+
} else {
|
|
301
|
+
layer.naturalHeight = naturalHeight;
|
|
302
|
+
layer.isVisible = isVisible;
|
|
303
|
+
layer.el = el;
|
|
304
|
+
}
|
|
305
|
+
this.update();
|
|
306
|
+
},
|
|
307
|
+
unregister: function(id) {
|
|
308
|
+
this.layers = this.layers.filter(function(l) { return l.id !== id; });
|
|
309
|
+
this.update();
|
|
310
|
+
},
|
|
311
|
+
update: function() {
|
|
312
|
+
let currentTop = 0;
|
|
313
|
+
for (let i = 0; i < this.layers.length; i++) {
|
|
314
|
+
const layer = this.layers[i];
|
|
315
|
+
if (layer.el) {
|
|
316
|
+
const topPx = layer.isVisible ? currentTop + 'px' : '-' + layer.naturalHeight + 'px';
|
|
317
|
+
layer.el.style.top = topPx;
|
|
318
|
+
layer.el.style.opacity = layer.isVisible ? '1' : '0';
|
|
319
|
+
layer.el.style.pointerEvents = layer.isVisible ? 'auto' : 'none';
|
|
320
|
+
layer.el.style.setProperty('--rl-header-bottom', 'calc(' + topPx + ' + ' + layer.naturalHeight + 'px)');
|
|
321
|
+
}
|
|
322
|
+
if (layer.isVisible) currentTop += layer.naturalHeight;
|
|
323
|
+
}
|
|
324
|
+
if (currentTop > 0) {
|
|
325
|
+
document.documentElement.style.setProperty('--rl-total-header-height', currentTop + 'px');
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const RL = window.RLHeaderStack;
|
|
331
|
+
RL.layers = [];
|
|
332
|
+
|
|
333
|
+
function getHeight(el) {
|
|
334
|
+
if (!el) return 64;
|
|
335
|
+
const h = el.offsetHeight;
|
|
336
|
+
return h > 0 ? h : 64;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function initHeader(header) {
|
|
340
|
+
if (header.rlManaged) return;
|
|
341
|
+
header.rlManaged = true;
|
|
342
|
+
|
|
343
|
+
const id = header.id;
|
|
344
|
+
const stackIndex = parseInt(header.getAttribute('data-stack-index') || '0', 10);
|
|
345
|
+
const hideOnScroll = header.getAttribute('data-hide-on-scroll') === 'true';
|
|
346
|
+
const contentEl = header.querySelector('[data-header-content]');
|
|
347
|
+
let naturalHeight = getHeight(contentEl);
|
|
348
|
+
let isVisible = true;
|
|
349
|
+
|
|
350
|
+
RL.register(id, stackIndex, naturalHeight, isVisible, header);
|
|
351
|
+
|
|
352
|
+
if (typeof ResizeObserver !== 'undefined' && contentEl) {
|
|
353
|
+
new ResizeObserver(function(entries) {
|
|
354
|
+
const h = entries[0] && entries[0].contentRect.height;
|
|
355
|
+
if (h && h > 0) {
|
|
356
|
+
naturalHeight = h;
|
|
357
|
+
RL.update();
|
|
358
|
+
}
|
|
359
|
+
}).observe(contentEl);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (hideOnScroll) {
|
|
363
|
+
let lastScrollY = window.scrollY;
|
|
364
|
+
window.addEventListener('scroll', function() {
|
|
365
|
+
const current = window.scrollY;
|
|
366
|
+
const diff = current - lastScrollY;
|
|
367
|
+
if (Math.abs(diff) >= 10) {
|
|
368
|
+
const newVisible = current <= 50 ? true : diff <= 0;
|
|
369
|
+
if (newVisible !== isVisible) {
|
|
370
|
+
isVisible = newVisible;
|
|
371
|
+
RL.register(id, stackIndex, naturalHeight, isVisible, header);
|
|
372
|
+
}
|
|
373
|
+
lastScrollY = current;
|
|
374
|
+
}
|
|
375
|
+
}, { passive: true });
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
(function retry() {
|
|
379
|
+
const h = getHeight(contentEl);
|
|
380
|
+
if (h !== naturalHeight) {
|
|
381
|
+
naturalHeight = h;
|
|
382
|
+
RL.update();
|
|
383
|
+
}
|
|
384
|
+
if (h > 0 && h !== 64 && contentEl && contentEl.offsetHeight > 0) return;
|
|
385
|
+
requestAnimationFrame(retry);
|
|
386
|
+
})();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function startObserver() {
|
|
390
|
+
if (document.body) {
|
|
391
|
+
const headers = document.querySelectorAll("[data-rla-header='true']");
|
|
392
|
+
for (let i = 0; i < headers.length; i++) initHeader(headers[i]);
|
|
393
|
+
|
|
394
|
+
window.rlHeaderObserver = new MutationObserver(function(mutations) {
|
|
395
|
+
for (let i = 0; i < mutations.length; i++) {
|
|
396
|
+
const added = mutations[i].addedNodes;
|
|
397
|
+
for (let j = 0; j < added.length; j++) {
|
|
398
|
+
const node = added[j];
|
|
399
|
+
if (node.nodeType !== 1) continue;
|
|
400
|
+
if (node.matches && node.matches("[data-rla-header='true']")) initHeader(node);
|
|
401
|
+
if (node.querySelectorAll) {
|
|
402
|
+
const nested = node.querySelectorAll("[data-rla-header='true']");
|
|
403
|
+
for (let k = 0; k < nested.length; k++) initHeader(nested[k]);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const removed = mutations[i].removedNodes;
|
|
407
|
+
for (let j = 0; j < removed.length; j++) {
|
|
408
|
+
const node = removed[j];
|
|
409
|
+
if (node.nodeType !== 1) continue;
|
|
410
|
+
if (node.matches && node.matches("[data-rla-header='true']")) RL.unregister(node.id);
|
|
411
|
+
if (node.querySelectorAll) {
|
|
412
|
+
const nested = node.querySelectorAll("[data-rla-header='true']");
|
|
413
|
+
for (let k = 0; k < nested.length; k++) RL.unregister(nested[k].id);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
window.rlHeaderObserver.observe(document.body, { childList: true, subtree: true });
|
|
419
|
+
} else {
|
|
420
|
+
document.addEventListener('DOMContentLoaded', startObserver);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
startObserver();
|
|
425
|
+
})();
|
|
426
|
+
</script>
|
|
427
|
+
|
|
181
428
|
{transitions && <ClientRouter />}
|