@rimelight/ui 0.0.33 → 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 +157 -157
- package/package.json +105 -105
- package/src/components/astro/RLAAspectRatio.astro +2 -2
- package/src/components/astro/RLAButton.astro +141 -139
- package/src/components/astro/RLAChart.astro +19 -34
- package/src/components/astro/RLAHead.astro +427 -196
- package/src/components/astro/RLAHeader.astro +66 -59
- package/src/components/astro/RLAImage.astro +61 -19
- package/src/components/astro/RLALink.astro +22 -23
- package/src/components/astro/RLALinkGroup.astro +66 -4
- package/src/components/astro/RLALocaleSelector.astro +136 -113
- package/src/components/astro/RLAMain.astro +8 -3
- package/src/components/astro/RLAMarquee.astro +9 -2
- package/src/components/astro/RLANavigationMenu.astro +245 -56
- package/src/components/astro/RLAPagination.astro +2 -4
- package/src/components/astro/RLAProgress.astro +8 -2
- package/src/components/astro/RLASelect.astro +38 -24
- package/src/components/astro/RLASlideover.astro +66 -1
- package/src/components/astro/RLASlider.astro +14 -14
- package/src/components/astro/RLASplitter.astro +14 -2
- package/src/components/astro/RLAStickySurface.astro +9 -2
- package/src/components/vue/RLVCheckbox.vue +68 -68
- package/src/components/vue/RLVForm.vue +44 -44
- package/src/components/vue/RLVFormField.vue +58 -58
- package/src/components/vue/RLVInput.vue +93 -93
- package/src/components/vue/RLVPost.vue +63 -63
- package/src/components/vue/RLVPosts.vue +21 -21
- package/src/components/vue/RLVToast.vue +68 -68
- package/src/components/vue/RLVToaster.vue +29 -29
- package/src/composables/index.ts +3 -3
- package/src/composables/useHeaderStore.ts +13 -14
- package/src/composables/useScrollToTop.ts +62 -62
- package/src/composables/useToast.ts +43 -42
- package/src/config/index.ts +1 -0
- package/src/config/security.ts +220 -0
- package/src/integrations/ui.ts +199 -199
- package/src/middleware/security.ts +75 -15
- package/src/plugins/index.ts +2 -2
- package/src/plugins/starlightDocsApi/index.ts +272 -272
- package/src/presets/defaults.ts +297 -297
- package/src/presets/index.ts +683 -637
- package/src/styles/index.css +160 -160
- package/src/themes/3d-hover.theme.ts +13 -13
- package/src/themes/accordion.theme.ts +13 -13
- package/src/themes/alert.theme.ts +131 -125
- package/src/themes/app.theme.ts +13 -13
- package/src/themes/audio.theme.ts +13 -13
- package/src/themes/avatar.theme.ts +84 -84
- package/src/themes/badge.theme.ts +169 -163
- package/src/themes/banner.theme.ts +13 -13
- package/src/themes/browser-mockup.theme.ts +13 -13
- package/src/themes/button.theme.ts +224 -202
- package/src/themes/calendar.theme.ts +13 -13
- package/src/themes/card.theme.ts +42 -42
- package/src/themes/changelog.theme.ts +13 -13
- package/src/themes/chart.theme.ts +22 -22
- package/src/themes/chat-message.theme.ts +13 -13
- package/src/themes/chat-messages.theme.ts +13 -13
- package/src/themes/chat-palette.theme.ts +13 -13
- package/src/themes/chat-prompt-submit.theme.ts +13 -13
- package/src/themes/chat-prompt.theme.ts +13 -13
- package/src/themes/chat-reasoning.theme.ts +13 -13
- package/src/themes/chat-shimmer.theme.ts +13 -13
- package/src/themes/chat-tool.theme.ts +13 -13
- package/src/themes/chat.theme.ts +13 -13
- package/src/themes/checkbox.theme.ts +50 -50
- package/src/themes/chip.theme.ts +74 -74
- package/src/themes/color-picker.theme.ts +13 -13
- package/src/themes/command-palette.theme.ts +13 -13
- package/src/themes/compare.theme.ts +13 -13
- package/src/themes/confirm.theme.ts +48 -48
- package/src/themes/container.theme.ts +13 -13
- package/src/themes/context-menu.theme.ts +13 -13
- package/src/themes/dashboard-group.theme.ts +13 -13
- package/src/themes/dashboard-navbar.theme.ts +13 -13
- package/src/themes/dashboard-panel.theme.ts +13 -13
- package/src/themes/dashboard-resize-handle.theme.ts +13 -13
- package/src/themes/dashboard-search-button.theme.ts +13 -13
- package/src/themes/dashboard-search.theme.ts +13 -13
- package/src/themes/dashboard-sidebar-collapse.theme.ts +13 -13
- package/src/themes/dashboard-sidebar-toggle.theme.ts +13 -13
- package/src/themes/dashboard-sidebar.theme.ts +13 -13
- package/src/themes/dashboard-toolbar.theme.ts +13 -13
- package/src/themes/dock.theme.ts +13 -13
- package/src/themes/drawer.theme.ts +61 -61
- package/src/themes/dropdown-menu.theme.ts +29 -29
- package/src/themes/editor.theme.ts +13 -13
- package/src/themes/empty.theme.ts +13 -13
- package/src/themes/error.theme.ts +13 -13
- package/src/themes/field-group.theme.ts +24 -24
- package/src/themes/fieldset.theme.ts +13 -13
- package/src/themes/floating-action.theme.ts +13 -13
- package/src/themes/footer.theme.ts +30 -30
- package/src/themes/form.theme.ts +13 -13
- package/src/themes/gallery.theme.ts +13 -13
- package/src/themes/head.theme.ts +13 -13
- package/src/themes/header.theme.ts +45 -46
- package/src/themes/icon.theme.ts +23 -23
- package/src/themes/image.theme.ts +23 -19
- package/src/themes/input-date.theme.ts +13 -13
- package/src/themes/input-menu.theme.ts +35 -35
- package/src/themes/input-number.theme.ts +13 -13
- package/src/themes/input-tags.theme.ts +13 -13
- package/src/themes/input-time.theme.ts +13 -13
- package/src/themes/input.theme.ts +42 -42
- package/src/themes/kbd.theme.ts +95 -89
- package/src/themes/knob.theme.ts +13 -13
- package/src/themes/link-group.theme.ts +32 -32
- package/src/themes/link.theme.ts +13 -13
- package/src/themes/listbox.theme.ts +13 -13
- package/src/themes/locale-selector.theme.ts +49 -49
- package/src/themes/logo.theme.ts +13 -13
- package/src/themes/main.theme.ts +13 -13
- package/src/themes/megamenu.theme.ts +13 -13
- package/src/themes/meter.theme.ts +13 -13
- package/src/themes/navigation-menu.theme.ts +44 -27
- package/src/themes/page-aside.theme.ts +13 -13
- package/src/themes/page-body.theme.ts +13 -13
- package/src/themes/page-header.theme.ts +13 -13
- package/src/themes/page-section.theme.ts +187 -187
- package/src/themes/page.theme.ts +13 -13
- package/src/themes/password.theme.ts +13 -13
- package/src/themes/phone-mockup.theme.ts +13 -13
- package/src/themes/placeholder.theme.ts +15 -15
- package/src/themes/post.theme.ts +33 -33
- package/src/themes/pricing-plan.theme.ts +13 -13
- package/src/themes/pricing-table.theme.ts +13 -13
- package/src/themes/progress.theme.ts +38 -38
- package/src/themes/prose.theme.ts +13 -13
- package/src/themes/qr-code.theme.ts +13 -13
- package/src/themes/quote.theme.ts +13 -13
- package/src/themes/radio-group.theme.ts +13 -13
- package/src/themes/rating.theme.ts +13 -13
- package/src/themes/scroll-area.theme.ts +26 -26
- package/src/themes/scroll-to-top.theme.ts +52 -52
- package/src/themes/select.theme.ts +29 -29
- package/src/themes/separator.theme.ts +147 -147
- package/src/themes/sidebar.theme.ts +38 -38
- package/src/themes/skeleton.theme.ts +21 -21
- package/src/themes/slideover.theme.ts +4 -4
- package/src/themes/slider.theme.ts +36 -36
- package/src/themes/speed-dial.theme.ts +13 -13
- package/src/themes/spinner.theme.ts +34 -34
- package/src/themes/splitter.theme.ts +23 -23
- package/src/themes/spoiler.theme.ts +13 -13
- package/src/themes/stepper.theme.ts +13 -13
- package/src/themes/switch.theme.ts +67 -67
- package/src/themes/table-of-contents.theme.ts +48 -48
- package/src/themes/tabs.theme.ts +52 -52
- package/src/themes/textarea.theme.ts +27 -27
- package/src/themes/theme-selector.theme.ts +15 -15
- package/src/themes/timeline.theme.ts +13 -13
- package/src/themes/toast.theme.ts +31 -31
- package/src/themes/tooltip.theme.ts +28 -28
- package/src/themes/tour.theme.ts +13 -13
- package/src/themes/tree.theme.ts +13 -13
- package/src/themes/user.theme.ts +13 -13
- package/src/themes/video.theme.ts +17 -17
- package/src/themes/watermark.theme.ts +13 -13
- package/src/themes/window-mockup.theme.ts +13 -13
- package/src/types/components/3d-hover.ts +11 -11
- package/src/types/components/alert.ts +2 -2
- package/src/types/components/app.ts +11 -11
- package/src/types/components/audio.ts +11 -11
- package/src/types/components/avatar-group.ts +11 -11
- package/src/types/components/avatar.ts +60 -60
- package/src/types/components/badge.ts +2 -2
- package/src/types/components/banner.ts +11 -11
- package/src/types/components/browser-mockup.ts +11 -11
- package/src/types/components/button.ts +74 -81
- package/src/types/components/calendar.ts +11 -11
- package/src/types/components/changelog.ts +11 -11
- package/src/types/components/chart.ts +2 -1
- package/src/types/components/chat-message.ts +11 -11
- package/src/types/components/chat-messages.ts +11 -11
- package/src/types/components/chat-palette.ts +11 -11
- package/src/types/components/chat-prompt-submit.ts +11 -11
- package/src/types/components/chat-prompt.ts +11 -11
- package/src/types/components/chat-reasoning.ts +11 -11
- package/src/types/components/chat-shimmer.ts +11 -11
- package/src/types/components/chat-tool.ts +11 -11
- package/src/types/components/chat.ts +11 -11
- package/src/types/components/checkbox.ts +2 -2
- package/src/types/components/chip.ts +17 -17
- package/src/types/components/collapsible.ts +2 -1
- package/src/types/components/color-picker.ts +11 -11
- package/src/types/components/command-palette.ts +11 -11
- package/src/types/components/compare.ts +11 -11
- package/src/types/components/container.ts +17 -17
- package/src/types/components/context-menu.ts +11 -11
- package/src/types/components/dashboard-group.ts +11 -11
- package/src/types/components/dashboard-navbar.ts +11 -11
- package/src/types/components/dashboard-panel.ts +11 -11
- package/src/types/components/dashboard-resize-handle.ts +11 -11
- package/src/types/components/dashboard-search-button.ts +11 -11
- package/src/types/components/dashboard-search.ts +11 -11
- package/src/types/components/dashboard-sidebar-collapse.ts +11 -11
- package/src/types/components/dashboard-sidebar-toggle.ts +11 -11
- package/src/types/components/dashboard-sidebar.ts +11 -11
- package/src/types/components/dashboard-toolbar.ts +11 -11
- package/src/types/components/dock.ts +11 -11
- package/src/types/components/dropdown-menu.ts +2 -1
- package/src/types/components/editor.ts +11 -11
- package/src/types/components/empty.ts +11 -11
- package/src/types/components/error.ts +11 -11
- package/src/types/components/fieldset.ts +11 -11
- package/src/types/components/file-upload.ts +2 -1
- package/src/types/components/floating-action.ts +11 -11
- package/src/types/components/form.ts +19 -19
- package/src/types/components/gallery.ts +11 -11
- package/src/types/components/icon.ts +19 -19
- package/src/types/components/image.ts +32 -28
- package/src/types/components/index.ts +134 -135
- package/src/types/components/input-date.ts +11 -11
- package/src/types/components/input-menu.ts +44 -43
- package/src/types/components/input-number.ts +11 -11
- package/src/types/components/input-pin.ts +36 -35
- package/src/types/components/input-tags.ts +11 -11
- package/src/types/components/input-time.ts +11 -11
- package/src/types/components/input.ts +2 -2
- package/src/types/components/knob.ts +11 -11
- package/src/types/components/link-group.ts +45 -23
- package/src/types/components/link.ts +4 -0
- package/src/types/components/listbox.ts +11 -11
- package/src/types/components/locale-selector.ts +33 -33
- package/src/types/components/logo.ts +32 -31
- package/src/types/components/main.ts +17 -17
- package/src/types/components/megamenu.ts +11 -11
- package/src/types/components/meter.ts +11 -11
- package/src/types/components/modal.ts +39 -39
- package/src/types/components/navigation-menu.ts +59 -54
- package/src/types/components/page-aside.ts +11 -11
- package/src/types/components/page-body.ts +11 -11
- package/src/types/components/page-header.ts +11 -11
- package/src/types/components/page.ts +11 -11
- package/src/types/components/password.ts +11 -11
- package/src/types/components/phone-mockup.ts +5 -5
- package/src/types/components/pin-input.ts +11 -11
- package/src/types/components/popover.ts +23 -23
- package/src/types/components/post.ts +35 -35
- package/src/types/components/pricing-plan.ts +11 -11
- package/src/types/components/pricing-table.ts +11 -11
- package/src/types/components/progress.ts +33 -33
- package/src/types/components/prose.ts +11 -11
- package/src/types/components/qr-code.ts +11 -11
- package/src/types/components/radio-group.ts +11 -11
- package/src/types/components/rating.ts +11 -11
- package/src/types/components/scroll-area.ts +23 -23
- package/src/types/components/scroll-to-top.ts +2 -2
- package/src/types/components/select.ts +2 -1
- package/src/types/components/separator.ts +19 -19
- package/src/types/components/sidebar.ts +87 -72
- package/src/types/components/slideover.ts +31 -31
- package/src/types/components/slider.ts +2 -2
- package/src/types/components/speed-dial.ts +11 -11
- package/src/types/components/spinner.ts +25 -25
- package/src/types/components/splitter.ts +19 -19
- package/src/types/components/spoiler.ts +11 -11
- package/src/types/components/stepper.ts +11 -11
- package/src/types/components/sticky-surface.ts +19 -19
- package/src/types/components/switch.ts +41 -41
- package/src/types/components/table-of-contents.ts +17 -17
- 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 +11 -11
- package/src/types/components/toast.ts +2 -1
- package/src/types/components/tooltip.ts +23 -23
- package/src/types/components/tour.ts +11 -11
- package/src/types/components/tree.ts +11 -11
- package/src/types/components/user.ts +11 -11
- package/src/types/components/watermark.ts +11 -11
- package/src/types/components/window-mockup.ts +11 -11
- package/src/types/theme.ts +10 -0
- package/src/utils/docs.ts +215 -189
- package/src/utils/headerStack.ts +95 -95
- package/src/utils/index.ts +5 -5
- package/src/components/astro/RLABlogPost.astro +0 -7
- package/src/components/astro/RLABlogPosts.astro +0 -9
- package/src/components/astro/RLAPosts.astro +0 -23
- package/src/themes/posts.theme.ts +0 -13
- package/src/types/components/posts.ts +0 -11
|
@@ -1,59 +1,66 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { scv } from "css-variants"
|
|
3
|
-
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
-
import type { HeaderProps } from "../../types"
|
|
5
|
-
import headerThemeDefault, { createHeaderTheme } from "../../themes/header.theme"
|
|
6
|
-
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
-
|
|
8
|
-
const uiConfig = getUIConfig()
|
|
9
|
-
const headerTheme = uiConfig.colors ? createHeaderTheme() : headerThemeDefault
|
|
10
|
-
|
|
11
|
-
const header = scv(headerTheme)
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
contain = true,
|
|
15
|
-
sticky = true,
|
|
16
|
-
fixed = false,
|
|
17
|
-
stackIndex = 0,
|
|
18
|
-
hideOnScroll = false,
|
|
19
|
-
ui: uiProp,
|
|
20
|
-
class: className,
|
|
21
|
-
...rest
|
|
22
|
-
} = Astro.props as HeaderProps;
|
|
23
|
-
|
|
24
|
-
const classes = resolveClasses(header, {
|
|
25
|
-
contain,
|
|
26
|
-
sticky: fixed ? false : sticky,
|
|
27
|
-
fixed,
|
|
28
|
-
}, useUi("header", uiProp), className);
|
|
29
|
-
|
|
30
|
-
const headerId = `rla-header-${Math.random().toString(36).slice(2, 8)}`;
|
|
31
|
-
const zIndex = 100 - stackIndex;
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
<header
|
|
35
|
-
id={headerId}
|
|
36
|
-
data-slot="root"
|
|
37
|
-
class:list={[classes.root]}
|
|
38
|
-
data-rla-header={fixed ? "true" : undefined}
|
|
39
|
-
data-stack-index={stackIndex}
|
|
40
|
-
data-hide-on-scroll={String(hideOnScroll)}
|
|
41
|
-
data-header-layer-id={headerId}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { HeaderProps } from "../../types"
|
|
5
|
+
import headerThemeDefault, { createHeaderTheme } from "../../themes/header.theme"
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
+
|
|
8
|
+
const uiConfig = getUIConfig()
|
|
9
|
+
const headerTheme = uiConfig.colors ? createHeaderTheme() : headerThemeDefault
|
|
10
|
+
|
|
11
|
+
const header = scv(headerTheme)
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
contain = true,
|
|
15
|
+
sticky = true,
|
|
16
|
+
fixed = false,
|
|
17
|
+
stackIndex = 0,
|
|
18
|
+
hideOnScroll = false,
|
|
19
|
+
ui: uiProp,
|
|
20
|
+
class: className,
|
|
21
|
+
...rest
|
|
22
|
+
} = Astro.props as HeaderProps;
|
|
23
|
+
|
|
24
|
+
const classes = resolveClasses(header, {
|
|
25
|
+
contain,
|
|
26
|
+
sticky: fixed ? false : sticky,
|
|
27
|
+
fixed,
|
|
28
|
+
}, useUi("header", uiProp), className);
|
|
29
|
+
|
|
30
|
+
const headerId = `rla-header-${Math.random().toString(36).slice(2, 8)}`;
|
|
31
|
+
const zIndex = 100 - stackIndex;
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<header
|
|
35
|
+
id={headerId}
|
|
36
|
+
data-slot="root"
|
|
37
|
+
class:list={[classes.root]}
|
|
38
|
+
data-rla-header={fixed ? "true" : undefined}
|
|
39
|
+
data-stack-index={stackIndex}
|
|
40
|
+
data-hide-on-scroll={String(hideOnScroll)}
|
|
41
|
+
data-header-layer-id={headerId}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
44
|
+
<div class:list={[classes.content]} data-header-content>
|
|
45
|
+
<div class:list={[classes.container]}>
|
|
46
|
+
<div class:list={[classes.left]} data-slot="left">
|
|
47
|
+
<slot name="left" />
|
|
48
|
+
</div>
|
|
49
|
+
<div class:list={[classes.center]} data-slot="center">
|
|
50
|
+
<slot name="center" />
|
|
51
|
+
</div>
|
|
52
|
+
<div class:list={[classes.right]} data-slot="right">
|
|
53
|
+
<slot name="right" />
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</header>
|
|
58
|
+
|
|
59
|
+
{fixed && (
|
|
60
|
+
<style is:inline set:html={`
|
|
61
|
+
#${headerId} {
|
|
62
|
+
z-index: ${zIndex} !important;
|
|
63
|
+
}
|
|
64
|
+
`} />
|
|
65
|
+
)}
|
|
66
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { Image } from "astro:assets"
|
|
2
|
+
import { Image, Picture, getImage } from "astro:assets"
|
|
3
3
|
import { scv } from "css-variants"
|
|
4
4
|
import { useUi, resolveClasses } from "../../utils"
|
|
5
5
|
import type { ImageProps, ImageMetadataInfo } from "../../types"
|
|
@@ -9,10 +9,14 @@ import { getUIConfig } from "virtual:rimelight-ui"
|
|
|
9
9
|
const uiConfig = getUIConfig()
|
|
10
10
|
const imageTheme = uiConfig.colors ? createImageTheme() : imageThemeDefault
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const img = scv(imageTheme)
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
src,
|
|
16
|
+
mobileSrc,
|
|
17
|
+
desktopSrc,
|
|
18
|
+
breakpoint,
|
|
19
|
+
formats,
|
|
16
20
|
alt = "",
|
|
17
21
|
height,
|
|
18
22
|
width,
|
|
@@ -31,13 +35,34 @@ const {
|
|
|
31
35
|
...rest
|
|
32
36
|
} = Astro.props as ImageProps
|
|
33
37
|
|
|
34
|
-
const classes = resolveClasses(
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const classes = resolveClasses(img, {}, useUi("image", uiProp), className)
|
|
39
|
+
|
|
40
|
+
const isResponsive = !!(mobileSrc && desktopSrc)
|
|
41
|
+
const isFormatFallback = !isResponsive && !!(formats && formats.length > 0)
|
|
42
|
+
const breakpointVal = breakpoint ?? 768
|
|
43
|
+
|
|
44
|
+
let mobileImg = null
|
|
45
|
+
let desktopImg = null
|
|
46
|
+
|
|
47
|
+
if (isResponsive) {
|
|
48
|
+
mobileImg = await getImage({
|
|
49
|
+
src: mobileSrc!,
|
|
50
|
+
format: "webp",
|
|
51
|
+
})
|
|
52
|
+
desktopImg = await getImage({
|
|
53
|
+
src: desktopSrc!,
|
|
54
|
+
format: "webp",
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const activeSrc = isResponsive ? desktopSrc : src
|
|
59
|
+
const isMetadata = typeof activeSrc !== "string" && activeSrc !== undefined
|
|
60
|
+
const imgWidth = width ?? (isMetadata ? (activeSrc as any).width : undefined)
|
|
61
|
+
const imgHeight = height ?? (isMetadata ? (activeSrc as any).height : undefined)
|
|
62
|
+
const imgFormat = isMetadata ? (activeSrc as any).format : (preMetadata?.format ?? undefined)
|
|
63
|
+
const rawName = activeSrc
|
|
64
|
+
? (typeof activeSrc === "string" ? activeSrc.split("/").pop() || "image" : (activeSrc as any).src.split("/").pop() || "image")
|
|
65
|
+
: "image"
|
|
41
66
|
const fileName = rawName.split("?")[0]
|
|
42
67
|
const fileExtension = imgFormat?.toUpperCase() || (fileName.includes(".") ? fileName.split(".").pop()?.toUpperCase() : "IMG")
|
|
43
68
|
const initialSize = preMetadata?.size ?? undefined
|
|
@@ -50,7 +75,17 @@ const initialSize = preMetadata?.size ?? undefined
|
|
|
50
75
|
class={classes.trigger}
|
|
51
76
|
data-image-trigger
|
|
52
77
|
>
|
|
53
|
-
|
|
78
|
+
{isResponsive && mobileImg && desktopImg ? (
|
|
79
|
+
<picture>
|
|
80
|
+
<source media={`(max-width: ${breakpointVal - 1}px)`} srcset={mobileImg.src} />
|
|
81
|
+
<source media={`(min-width: ${breakpointVal}px)`} srcset={desktopImg.src} />
|
|
82
|
+
<img src={desktopImg.src} alt={alt} loading={loading} class="w-full h-full object-cover rounded-lg" />
|
|
83
|
+
</picture>
|
|
84
|
+
) : isFormatFallback ? (
|
|
85
|
+
<Picture src={src!} formats={formats!} alt={alt} width={imgWidth ?? 800} height={imgHeight ?? 400} loading={loading} class="w-full h-full object-cover rounded-lg" />
|
|
86
|
+
) : (
|
|
87
|
+
<Image src={src!} alt={alt} width={imgWidth ?? 800} height={imgHeight ?? 400} loading={loading} fit={fit} />
|
|
88
|
+
)}
|
|
54
89
|
</button>
|
|
55
90
|
</slot>
|
|
56
91
|
|
|
@@ -60,12 +95,20 @@ const initialSize = preMetadata?.size ?? undefined
|
|
|
60
95
|
>
|
|
61
96
|
<div class="flex flex-col bg-background text-foreground max-h-[90vh]">
|
|
62
97
|
<div class="flex-1 min-h-0 flex items-center justify-center p-4 overflow-hidden">
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
{isResponsive && mobileImg && desktopImg ? (
|
|
99
|
+
<picture class="max-w-full max-h-[65vh] flex items-center justify-center overflow-hidden">
|
|
100
|
+
<source media={`(max-width: ${breakpointVal - 1}px)`} srcset={mobileImg.src} />
|
|
101
|
+
<source media={`(min-width: ${breakpointVal}px)`} srcset={desktopImg.src} />
|
|
102
|
+
<img src={desktopImg.src} alt={alt} class={classes.image} data-modal-img />
|
|
103
|
+
</picture>
|
|
104
|
+
) : (
|
|
105
|
+
<img
|
|
106
|
+
src={typeof src === "string" ? src : src!.src}
|
|
107
|
+
alt={alt}
|
|
108
|
+
class={classes.image}
|
|
109
|
+
data-modal-img
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
69
112
|
</div>
|
|
70
113
|
|
|
71
114
|
<hr class="border-border mx-4 mb-3 shrink-0" />
|
|
@@ -194,8 +237,7 @@ const initialSize = preMetadata?.size ?? undefined
|
|
|
194
237
|
const link = document.createElement("a")
|
|
195
238
|
link.href = url
|
|
196
239
|
const srcAttr = (trigger.querySelector("img") || {}).getAttribute("src") || ""
|
|
197
|
-
|
|
198
|
-
link.download = name
|
|
240
|
+
link.download = (srcAttr.split("/").pop() || "").split("?")[0] || `image-${Date.now()}`
|
|
199
241
|
document.body.appendChild(link)
|
|
200
242
|
link.click()
|
|
201
243
|
document.body.removeChild(link)
|
|
@@ -206,4 +248,4 @@ const initialSize = preMetadata?.size ?? undefined
|
|
|
206
248
|
})
|
|
207
249
|
}
|
|
208
250
|
}
|
|
209
|
-
</script>
|
|
251
|
+
</script>
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
---
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
</div>
|
|
1
|
+
---
|
|
2
|
+
import RLAButton from "./RLAButton.astro"
|
|
3
|
+
import type { LinkProps } from "../../types"
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
to,
|
|
7
|
+
href,
|
|
8
|
+
variant = "link",
|
|
9
|
+
color = "neutral",
|
|
10
|
+
...rest
|
|
11
|
+
} = Astro.props as LinkProps
|
|
12
|
+
|
|
13
|
+
const linkHref = href || (typeof to === 'string' ? to : undefined);
|
|
14
|
+
---
|
|
15
|
+
<RLAButton
|
|
16
|
+
variant={variant as any}
|
|
17
|
+
color={color as any}
|
|
18
|
+
href={linkHref}
|
|
19
|
+
{...rest}
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</RLAButton>
|
|
@@ -5,6 +5,8 @@ import type { LinkGroupProps } from "../../types"
|
|
|
5
5
|
import linkGroupThemeDefault, { createLinkGroupTheme } from "../../themes/link-group.theme"
|
|
6
6
|
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
7
|
|
|
8
|
+
import RLALink from "./RLALink.astro"
|
|
9
|
+
|
|
8
10
|
const uiConfig = getUIConfig()
|
|
9
11
|
const linkGroupTheme = uiConfig.colors ? createLinkGroupTheme() : linkGroupThemeDefault
|
|
10
12
|
|
|
@@ -12,6 +14,11 @@ const linkGroup = scv(linkGroupTheme)
|
|
|
12
14
|
|
|
13
15
|
const {
|
|
14
16
|
title,
|
|
17
|
+
label,
|
|
18
|
+
leadingIcon,
|
|
19
|
+
trailingIcon,
|
|
20
|
+
href,
|
|
21
|
+
to,
|
|
15
22
|
links = [],
|
|
16
23
|
theme,
|
|
17
24
|
ui: uiProp,
|
|
@@ -20,17 +27,72 @@ const {
|
|
|
20
27
|
} = Astro.props as LinkGroupProps
|
|
21
28
|
|
|
22
29
|
const classes = resolveClasses(linkGroup, { theme }, useUi("linkGroup", uiProp), className);
|
|
30
|
+
|
|
31
|
+
const headingLabel = label || (typeof title === "object" ? title.label : (typeof title === "string" ? title : undefined));
|
|
32
|
+
const headingLeadingIcon = leadingIcon || (typeof title === "object" ? title.leadingIcon : undefined);
|
|
33
|
+
const headingTrailingIcon = trailingIcon || (typeof title === "object" ? title.trailingIcon : undefined);
|
|
34
|
+
const headingHref = href || (typeof title === "object" ? title.href : undefined);
|
|
35
|
+
const headingTo = to || (typeof title === "object" ? (title as any).to : undefined);
|
|
36
|
+
|
|
37
|
+
const linksProp = links ?? [];
|
|
38
|
+
const normalizedLinks = Array.isArray(linksProp) ? linksProp : [linksProp];
|
|
39
|
+
|
|
40
|
+
// Prefix utility classes in classes.link with `!` to cleanly override conflicting text colors in RLAButton's base classes.
|
|
41
|
+
// For default or light themes, do not force base text classes so RLAButton's own light/dark mode styles can adapt naturally.
|
|
42
|
+
const isPinnedDark = theme === "flat" || theme === "dark";
|
|
43
|
+
const overrideLinkClass = classes.link
|
|
44
|
+
? classes.link
|
|
45
|
+
.split(" ")
|
|
46
|
+
.map(cls => {
|
|
47
|
+
if (!cls) return "";
|
|
48
|
+
if (cls.includes(":")) {
|
|
49
|
+
const parts = cls.split(":");
|
|
50
|
+
const state = parts.slice(0, -1).join(":");
|
|
51
|
+
const baseCls = parts[parts.length - 1];
|
|
52
|
+
return `${state}:!${baseCls}`;
|
|
53
|
+
}
|
|
54
|
+
if (cls.startsWith("text-") && !isPinnedDark) {
|
|
55
|
+
return cls;
|
|
56
|
+
}
|
|
57
|
+
return `!${cls}`;
|
|
58
|
+
})
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join(" ")
|
|
61
|
+
: "";
|
|
23
62
|
---
|
|
24
63
|
<div class={classes.root} data-slot="root" {...rest}>
|
|
25
|
-
{
|
|
64
|
+
{headingLabel && (
|
|
65
|
+
<h4 class={classes.title} data-slot="title">
|
|
66
|
+
{headingHref || headingTo ? (
|
|
67
|
+
<a href={headingHref || (typeof headingTo === 'string' ? headingTo : undefined)} class="hover:underline flex items-center gap-1.5">
|
|
68
|
+
{headingLeadingIcon && <span class={headingLeadingIcon} />}
|
|
69
|
+
<span>{headingLabel}</span>
|
|
70
|
+
{headingTrailingIcon && <span class={headingTrailingIcon} />}
|
|
71
|
+
</a>
|
|
72
|
+
) : (
|
|
73
|
+
<span class="flex items-center gap-1.5">
|
|
74
|
+
{headingLeadingIcon && <span class={headingLeadingIcon} />}
|
|
75
|
+
<span>{headingLabel}</span>
|
|
76
|
+
{headingTrailingIcon && <span class={headingTrailingIcon} />}
|
|
77
|
+
</span>
|
|
78
|
+
)}
|
|
79
|
+
</h4>
|
|
80
|
+
)}
|
|
26
81
|
|
|
27
82
|
<ul class={classes.list} data-slot="list">
|
|
28
83
|
<slot>
|
|
29
|
-
{
|
|
84
|
+
{normalizedLinks.map((link) => (
|
|
30
85
|
<li class={classes.item} data-slot="item">
|
|
31
|
-
<
|
|
86
|
+
<RLALink
|
|
87
|
+
variant={link.variant ?? "ghost"}
|
|
88
|
+
color={link.color ?? "neutral"}
|
|
89
|
+
theme={link.theme ?? theme}
|
|
90
|
+
class:list={[overrideLinkClass, "w-full !justify-start"]}
|
|
91
|
+
data-slot="link"
|
|
92
|
+
{...link}
|
|
93
|
+
>
|
|
32
94
|
{link.label}
|
|
33
|
-
</
|
|
95
|
+
</RLALink>
|
|
34
96
|
</li>
|
|
35
97
|
))}
|
|
36
98
|
</slot>
|
|
@@ -1,114 +1,137 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { scv } from "css-variants"
|
|
3
|
-
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
-
import type { LocaleSelectorProps } from "../../types"
|
|
5
|
-
import localeSelectorThemeDefault, { createLocaleSelectorTheme } from "../../themes/locale-selector.theme"
|
|
6
|
-
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
-
import { getRelativeLocaleUrlList, getRelativeLocaleUrl } from "astro:i18n"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { LocaleSelectorProps } from "../../types"
|
|
5
|
+
import localeSelectorThemeDefault, { createLocaleSelectorTheme } from "../../themes/locale-selector.theme"
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
+
import { getRelativeLocaleUrlList, getRelativeLocaleUrl } from "astro:i18n"
|
|
8
|
+
import RLASelect from "./RLASelect.astro"
|
|
9
|
+
|
|
10
|
+
const uiConfig = getUIConfig()
|
|
11
|
+
const localeSelectorTheme = uiConfig.colors ? createLocaleSelectorTheme() : localeSelectorThemeDefault
|
|
12
|
+
|
|
13
|
+
const localeSelector = scv(localeSelectorTheme)
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
locales,
|
|
17
|
+
variant = "default",
|
|
18
|
+
size = "md",
|
|
19
|
+
ui: uiProp,
|
|
20
|
+
class: className,
|
|
21
|
+
...rest
|
|
22
|
+
} = Astro.props as LocaleSelectorProps;
|
|
23
|
+
|
|
24
|
+
const classes = resolveClasses(localeSelector, {
|
|
25
|
+
variant,
|
|
26
|
+
size
|
|
27
|
+
}, useUi("localeSelector", uiProp), className);
|
|
28
|
+
|
|
29
|
+
const currentLocale = Astro.currentLocale ?? 'en';
|
|
30
|
+
|
|
31
|
+
const processedLocales = locales && locales.length > 0
|
|
32
|
+
? locales.map(item => typeof item === 'string' ? { code: item, label: item } : item)
|
|
33
|
+
: [...new Map(getRelativeLocaleUrlList().map(url => {
|
|
34
|
+
const locale = url.split('/')[1] || 'en';
|
|
35
|
+
return [locale, { code: locale, label: locale }];
|
|
36
|
+
})).values()];
|
|
37
|
+
|
|
38
|
+
function getLocaleDisplayName(localeCode: string): string {
|
|
39
|
+
try {
|
|
40
|
+
const formatter = new Intl.DisplayNames([localeCode], { type: 'language' });
|
|
41
|
+
const nativeName = formatter.of(localeCode);
|
|
42
|
+
|
|
43
|
+
return nativeName
|
|
44
|
+
? nativeName.charAt(0).toUpperCase() + nativeName.slice(1)
|
|
45
|
+
: localeCode.toUpperCase();
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return localeCode.toUpperCase();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const items = processedLocales.map((item) => {
|
|
52
|
+
const targetUrl = getRelativeLocaleUrl(item.code, Astro.url.pathname.replace(/^\/[^/]+/, ''));
|
|
53
|
+
return {
|
|
54
|
+
label: item.label !== item.code ? item.label : getLocaleDisplayName(item.code),
|
|
55
|
+
value: targetUrl,
|
|
56
|
+
code: item.code
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const currentLocaleUrl = items.find(item => item.code === currentLocale)?.value || "";
|
|
61
|
+
|
|
62
|
+
// Prefix utility classes in classes.select with `!` to cleanly override conflicting styles in RLASelect's base trigger
|
|
63
|
+
// Also remove `pr-` classes which were meant for absolute positioned native select icons
|
|
64
|
+
const overrideTriggerClass = classes.select
|
|
65
|
+
? classes.select
|
|
66
|
+
.split(" ")
|
|
67
|
+
.map(cls => {
|
|
68
|
+
if (!cls) return "";
|
|
69
|
+
if (cls.startsWith("pr-") || cls.startsWith("!pr-")) return ""; // Strip padding-right
|
|
70
|
+
if (cls.includes(":")) {
|
|
71
|
+
const parts = cls.split(":");
|
|
72
|
+
const state = parts.slice(0, -1).join(":");
|
|
73
|
+
const baseCls = parts[parts.length - 1];
|
|
74
|
+
return `${state}:!${baseCls}`;
|
|
75
|
+
}
|
|
76
|
+
return `!${cls}`;
|
|
77
|
+
})
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.join(" ")
|
|
80
|
+
: "";
|
|
81
|
+
|
|
82
|
+
const gapClass = size === "sm" ? "gap-1.5" : size === "lg" ? "gap-3" : "gap-2";
|
|
83
|
+
|
|
84
|
+
const isDefault = variant === "default";
|
|
85
|
+
const triggerDarkModeOverrides = isDefault
|
|
86
|
+
? "dark:!bg-neutral-800 dark:!text-white dark:hover:!bg-neutral-700"
|
|
87
|
+
: "";
|
|
88
|
+
|
|
89
|
+
const selectUi = {
|
|
90
|
+
root: "!w-fit !inline-flex",
|
|
91
|
+
trigger: `flex items-center justify-between !w-fit ${gapClass} ${overrideTriggerClass} ${triggerDarkModeOverrides}`,
|
|
92
|
+
content: "!min-w-0 !w-full !bg-white !border-gray-200 !text-gray-800 dark:!bg-neutral-900 dark:!border-neutral-800 dark:!text-white",
|
|
93
|
+
item: "!text-gray-700 hover:!bg-gray-100 hover:!text-gray-900 dark:!text-neutral-300 dark:hover:!bg-neutral-800 dark:hover:!text-white"
|
|
94
|
+
};
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
<div class:list={[classes.root]} data-locale-selector {...rest}>
|
|
98
|
+
{Astro.slots.has("label") && (
|
|
99
|
+
<label class:list={[classes.label]}>
|
|
100
|
+
<slot name="label" />
|
|
101
|
+
</label>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
<div class:list={[classes.wrapper]}>
|
|
105
|
+
<RLASelect
|
|
106
|
+
items={items}
|
|
107
|
+
value={currentLocaleUrl}
|
|
108
|
+
size={size}
|
|
109
|
+
ui={selectUi}
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<script>
|
|
115
|
+
const initializeLocaleSelector = () => {
|
|
116
|
+
const selectors = document.querySelectorAll('[data-locale-selector]');
|
|
117
|
+
|
|
118
|
+
selectors.forEach(selector => {
|
|
119
|
+
if (selector.hasAttribute('data-initialized')) return;
|
|
120
|
+
selector.setAttribute('data-initialized', 'true');
|
|
121
|
+
|
|
122
|
+
const hiddenInput = selector.querySelector('[data-select-hidden-input]') as HTMLInputElement;
|
|
123
|
+
if (!hiddenInput) return;
|
|
124
|
+
|
|
125
|
+
hiddenInput.addEventListener('change', (event) => {
|
|
126
|
+
const target = event.target as HTMLInputElement;
|
|
127
|
+
const targetUrl = target.value;
|
|
128
|
+
if (targetUrl) {
|
|
129
|
+
window.location.href = targetUrl;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
document.addEventListener('DOMContentLoaded', initializeLocaleSelector);
|
|
136
|
+
document.addEventListener('astro:page-load', initializeLocaleSelector);
|
|
114
137
|
</script>
|