@rxdrag/website-lib 0.0.151 → 0.0.153
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 +2 -2
- package/components/AnimationNumber.astro +217 -217
- package/components/Background.astro +140 -114
- package/components/BackgroundGroup.astro +20 -26
- package/components/BaseFooter.astro +24 -39
- package/components/BaseHeader.astro +22 -25
- package/components/Box.astro +20 -22
- package/components/Button.astro +80 -0
- package/components/Carousel.astro +456 -315
- package/components/CarouselPagination.astro +97 -76
- package/components/CarouselSlide.astro +10 -16
- package/components/Collapse.astro +125 -125
- package/components/CollapseIndicator.astro +20 -20
- package/components/Container.astro +27 -32
- package/components/Content.astro +20 -0
- package/components/CookieConsent.astro +47 -47
- package/components/CookieConsent.css +52 -52
- package/components/CookieConsentConfig.ts +208 -208
- package/components/Dialog.astro +342 -338
- package/components/DialogTrigger.astro +32 -32
- package/components/Document.astro +240 -225
- package/components/Frame.astro +32 -0
- package/components/GlassBorder.astro +104 -0
- package/components/GlassRefraction.astro +85 -0
- package/components/GradientBorder.astro +80 -0
- package/components/Grid.astro +32 -34
- package/components/GridCell.astro +28 -32
- package/components/Heading.astro +24 -24
- package/components/Icon.astro +29 -29
- package/components/Image.astro +100 -100
- package/components/Image.md +14 -14
- package/components/Link.astro +89 -99
- package/components/Main.astro +17 -17
- package/components/Meta.astro +65 -65
- package/components/Popover.astro +189 -189
- package/components/RichTextView.astro +28 -28
- package/components/Section.astro +26 -44
- package/components/TabButton.astro +32 -16
- package/components/TabPanel.astro +20 -19
- package/components/Tabs.astro +220 -147
- package/components/Video.astro +6 -4
- package/components/YearsSince.astro +20 -20
- package/components//344/270/211/345/261/202/346/250/241/345/236/213.md +5 -5
- package/components//344/270/273/351/242/230Token.md +198 -198
- package/components//345/216/237/345/255/220/345/206/273/347/273/223/346/270/205/345/215/225.md +270 -260
- package/components//347/211/251/346/226/231/346/270/205/345/215/225.md +599 -567
- package/index.ts +5 -5
- package/package.json +7 -7
- package/components/BaseBlock.astro +0 -34
- package/components/Motion.astro +0 -77
- package/components/Stack.astro +0 -31
|
@@ -1,114 +1,140 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { BackgroundConfig, Locals } from "@rxdrag/website-lib-core";
|
|
3
|
-
import {
|
|
4
|
-
BackgroundVideoPlayer,
|
|
5
|
-
BackgroundHlsVideoPlayer,
|
|
6
|
-
Entify,
|
|
7
|
-
} from "@rxdrag/website-lib-core";
|
|
8
|
-
import Image from "./Image.astro";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
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
|
-
|
|
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
|
-
background.type === "
|
|
112
|
-
<
|
|
113
|
-
)
|
|
114
|
-
}
|
|
1
|
+
---
|
|
2
|
+
import type { BackgroundConfig, Locals } from "@rxdrag/website-lib-core";
|
|
3
|
+
import {
|
|
4
|
+
BackgroundVideoPlayer,
|
|
5
|
+
BackgroundHlsVideoPlayer,
|
|
6
|
+
Entify,
|
|
7
|
+
} from "@rxdrag/website-lib-core";
|
|
8
|
+
import Image from "./Image.astro";
|
|
9
|
+
import GlassBorder from "./GlassBorder.astro";
|
|
10
|
+
import GradientBorder from "./GradientBorder.astro";
|
|
11
|
+
import GlassRefraction from "./GlassRefraction.astro";
|
|
12
|
+
|
|
13
|
+
export interface Props {
|
|
14
|
+
background: BackgroundConfig;
|
|
15
|
+
index?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { env, imageSizes } = Astro.locals as Locals;
|
|
19
|
+
|
|
20
|
+
const { background } = Astro.props;
|
|
21
|
+
|
|
22
|
+
const baseFill = "absolute inset-0 w-full h-full";
|
|
23
|
+
const defaultFill = `${baseFill} object-cover`;
|
|
24
|
+
const rawClass = (background.class || "").trim();
|
|
25
|
+
const hasLayoutOverride = /(?:^|\s)(?:inset(?:-[xy])?-|top-|bottom-|left-|right-|w-|h-)/.test(
|
|
26
|
+
rawClass,
|
|
27
|
+
);
|
|
28
|
+
const className = rawClass
|
|
29
|
+
? `${hasLayoutOverride ? "absolute" : defaultFill} ${rawClass}`
|
|
30
|
+
: defaultFill;
|
|
31
|
+
|
|
32
|
+
// 安全地提取 mediaRef 和 posterRef(只有部分背景类型有这些属性)
|
|
33
|
+
const mediaRef = background.type === "video" ? background.mediaRef : undefined;
|
|
34
|
+
|
|
35
|
+
const rx = Entify.getInstance(env, imageSizes);
|
|
36
|
+
|
|
37
|
+
// 获取媒体数据
|
|
38
|
+
const media = rx ? await rx.getMedia(mediaRef) : undefined;
|
|
39
|
+
|
|
40
|
+
// 预计算视频相关数据
|
|
41
|
+
const videoUrl =
|
|
42
|
+
background.type === "video" ? media?.file?.original : undefined;
|
|
43
|
+
|
|
44
|
+
// 处理视频封面
|
|
45
|
+
let posterUrl: string | undefined;
|
|
46
|
+
if (background.type === "video" && background.poster) {
|
|
47
|
+
if (typeof background.poster === "string") {
|
|
48
|
+
posterUrl = background.poster;
|
|
49
|
+
} else if (typeof background.poster === "object") {
|
|
50
|
+
const poster = background.poster as Partial<ImageMetadata>;
|
|
51
|
+
if (
|
|
52
|
+
typeof poster.src === "string" &&
|
|
53
|
+
typeof poster.width === "number" &&
|
|
54
|
+
typeof poster.height === "number"
|
|
55
|
+
) {
|
|
56
|
+
posterUrl = poster.src;
|
|
57
|
+
} else {
|
|
58
|
+
console.log(
|
|
59
|
+
"[Background] invalid video poster, expect ImageMetadata:",
|
|
60
|
+
background.poster,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const isHls =
|
|
67
|
+
background.type === "video" &&
|
|
68
|
+
(media?.storageType === "cloudflare_stream" ||
|
|
69
|
+
videoUrl?.endsWith(".m3u8") ||
|
|
70
|
+
videoUrl?.includes("cloudflarestream.com"));
|
|
71
|
+
|
|
72
|
+
// 预计算 Spline URL
|
|
73
|
+
const splineUrl = background.type === "spline" ? background.url : undefined;
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
{background.type === "color" && <div class={className} />}
|
|
78
|
+
|
|
79
|
+
{background.type === "blur" && <div class={className} />}
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
background.type === "glass" && (
|
|
83
|
+
<GlassRefraction class={className} />
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
background.type === "glass-border" && (
|
|
89
|
+
<GlassBorder {...background} class={className} />
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
background.type === "gradient-border" && (
|
|
95
|
+
<GradientBorder {...background} class={className} />
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
background.type === "image" && background.src && (
|
|
101
|
+
<Image
|
|
102
|
+
class={className}
|
|
103
|
+
src={background.src}
|
|
104
|
+
layout={background.layout || "full-width"}
|
|
105
|
+
alt=""
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
{
|
|
111
|
+
background.type === "svg" && background.code && (
|
|
112
|
+
<div class={className} set:html={background.code} />
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
{
|
|
117
|
+
background.type === "video" &&
|
|
118
|
+
(isHls ? (
|
|
119
|
+
<BackgroundHlsVideoPlayer
|
|
120
|
+
className={className}
|
|
121
|
+
src={videoUrl}
|
|
122
|
+
poster={posterUrl}
|
|
123
|
+
client:load
|
|
124
|
+
/>
|
|
125
|
+
) : (
|
|
126
|
+
<BackgroundVideoPlayer
|
|
127
|
+
className={className}
|
|
128
|
+
src={videoUrl}
|
|
129
|
+
poster={posterUrl}
|
|
130
|
+
client:load
|
|
131
|
+
/>
|
|
132
|
+
))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
{
|
|
136
|
+
background.type === "spline" && (
|
|
137
|
+
<iframe class={className} src={splineUrl} title="Spline 3D Scene" />
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
3
|
-
import Background from "./Background.astro";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
backgrounds?: BackgroundConfig[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const { backgrounds } = Astro.props;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
defaultClass={defaultClass}
|
|
22
|
-
/>
|
|
23
|
-
))
|
|
24
|
-
: null
|
|
25
|
-
}
|
|
26
|
-
</Fragment>
|
|
1
|
+
---
|
|
2
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
3
|
+
import Background from "./Background.astro";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
backgrounds?: BackgroundConfig[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { backgrounds } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
{
|
|
13
|
+
backgrounds?.length ? (
|
|
14
|
+
<div class="absolute inset-0 w-full h-full -z-10 pointer-events-none" data-bg-group>
|
|
15
|
+
{backgrounds.map((background) => (
|
|
16
|
+
<Background background={background} />
|
|
17
|
+
))}
|
|
18
|
+
</div>
|
|
19
|
+
) : null
|
|
20
|
+
}
|
|
@@ -1,39 +1,24 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
-
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
className,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = Astro.props;
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
<footer class:list={["footer-block relative", className, originalClass]} {...rest}>
|
|
29
|
-
<BackgroundGroup backgrounds={backgrounds} />
|
|
30
|
-
{
|
|
31
|
-
disableContainer ? (
|
|
32
|
-
<slot />
|
|
33
|
-
) : (
|
|
34
|
-
<Container class:list={["w-full h-full", containerClassName]}>
|
|
35
|
-
<slot />
|
|
36
|
-
</Container>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
</footer>
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
+
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 区块
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface Props extends HTMLAttributes<"footer"> {
|
|
11
|
+
className?: string;
|
|
12
|
+
backgrounds?: BackgroundConfig[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { className, backgrounds, class: originalClass, ...rest } = Astro.props;
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<footer
|
|
19
|
+
class:list={["footer-block relative", className, originalClass]}
|
|
20
|
+
{...rest}
|
|
21
|
+
>
|
|
22
|
+
<BackgroundGroup backgrounds={backgrounds} />
|
|
23
|
+
<slot />
|
|
24
|
+
</footer>
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { HTMLAttributes } from "astro/types";
|
|
3
|
-
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
-
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
className?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<BackgroundGroup backgrounds={backgrounds} />
|
|
24
|
-
<slot />
|
|
25
|
-
</header>
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
+
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 区块
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface Props extends HTMLAttributes<"header"> {
|
|
11
|
+
class?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
backgrounds?: BackgroundConfig[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { className, backgrounds, class: originalClass, ...rest } = Astro.props;
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<header class:list={["header", className, originalClass]} {...rest}>
|
|
20
|
+
<BackgroundGroup backgrounds={backgrounds} />
|
|
21
|
+
<slot />
|
|
22
|
+
</header>
|
package/components/Box.astro
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
class?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
backgrounds?: BackgroundConfig[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
<slot />
|
|
22
|
-
</BaseBlock>
|
|
1
|
+
---
|
|
2
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
3
|
+
import Frame from "./Frame.astro";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
backgrounds?: BackgroundConfig[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<Frame
|
|
15
|
+
class:list={["flex relative", className, originalClass]}
|
|
16
|
+
backgrounds={backgrounds}
|
|
17
|
+
{...rest}
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</Frame>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Link from "@rxdrag/website-lib/components/Link.astro";
|
|
3
|
+
import type { LinkProps } from "@rxdrag/website-lib-core";
|
|
4
|
+
import type { FrameProps } from "@rxdrag/website-lib-core";
|
|
5
|
+
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
6
|
+
|
|
7
|
+
interface Props extends FrameProps {
|
|
8
|
+
class?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
link?: LinkProps;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
size?: "sm" | "md" | "lg" | "none";
|
|
15
|
+
type?: "button" | "submit" | "reset";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
class: className,
|
|
20
|
+
className: className2,
|
|
21
|
+
link,
|
|
22
|
+
disabled,
|
|
23
|
+
loading = false,
|
|
24
|
+
fullWidth = false,
|
|
25
|
+
type = "button",
|
|
26
|
+
backgrounds,
|
|
27
|
+
size = "md",
|
|
28
|
+
...rest
|
|
29
|
+
} = Astro.props;
|
|
30
|
+
|
|
31
|
+
const isDisabled = disabled || loading;
|
|
32
|
+
const isLink = !!(link?.type || link?.to);
|
|
33
|
+
|
|
34
|
+
const sizeClass: Record<"sm" | "md" | "lg", string> = {
|
|
35
|
+
sm: "btn-sm",
|
|
36
|
+
md: "btn-md",
|
|
37
|
+
lg: "btn-lg",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const sizeClassName = size === "none" ? undefined : sizeClass[size];
|
|
41
|
+
|
|
42
|
+
const composedClass = [
|
|
43
|
+
fullWidth && "w-full",
|
|
44
|
+
isDisabled && "opacity-60 cursor-not-allowed",
|
|
45
|
+
loading && "pointer-events-none",
|
|
46
|
+
className,
|
|
47
|
+
className2,
|
|
48
|
+
backgrounds ? "relative" : undefined,
|
|
49
|
+
sizeClassName,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
{
|
|
55
|
+
isLink ? (
|
|
56
|
+
<Link
|
|
57
|
+
type={link!.type}
|
|
58
|
+
to={link!.to}
|
|
59
|
+
href={link!.href}
|
|
60
|
+
options={link!.options}
|
|
61
|
+
activeWhen={link!.activeWhen}
|
|
62
|
+
aria-disabled={isDisabled ? "true" : undefined}
|
|
63
|
+
class:list={composedClass}
|
|
64
|
+
backgrounds={backgrounds}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<slot />
|
|
68
|
+
</Link>
|
|
69
|
+
) : (
|
|
70
|
+
<button
|
|
71
|
+
type={type}
|
|
72
|
+
disabled={isDisabled}
|
|
73
|
+
class:list={composedClass}
|
|
74
|
+
{...rest}
|
|
75
|
+
>
|
|
76
|
+
<BackgroundGroup backgrounds={backgrounds} />
|
|
77
|
+
<slot />
|
|
78
|
+
</button>
|
|
79
|
+
)
|
|
80
|
+
}
|