@rxdrag/website-lib 0.0.152 → 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 -82
- 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 +5 -5
- package/components/BaseBlock.astro +0 -34
- package/components/Motion.astro +0 -77
- package/components/Stack.astro +0 -31
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
---
|
|
2
|
-
interface Props {
|
|
3
|
-
dialogId: string;
|
|
4
|
-
openableKey?: string;
|
|
5
|
-
as?: string;
|
|
6
|
-
callToAction?: string;
|
|
7
|
-
class?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
dialogId,
|
|
13
|
-
openableKey,
|
|
14
|
-
as: _as,
|
|
15
|
-
callToAction,
|
|
16
|
-
class: _class,
|
|
17
|
-
className,
|
|
18
|
-
...rest
|
|
19
|
-
} = Astro.props;
|
|
20
|
-
|
|
21
|
-
const resolvedDialogId = dialogId || openableKey;
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
<button
|
|
25
|
-
type="button"
|
|
26
|
-
data-modal-open={resolvedDialogId}
|
|
27
|
-
data-call-to-action={callToAction}
|
|
28
|
-
class:list={[className, _class]}
|
|
29
|
-
{...rest}
|
|
30
|
-
>
|
|
31
|
-
<slot />
|
|
32
|
-
</button>
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
dialogId: string;
|
|
4
|
+
openableKey?: string;
|
|
5
|
+
as?: string;
|
|
6
|
+
callToAction?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
dialogId,
|
|
13
|
+
openableKey,
|
|
14
|
+
as: _as,
|
|
15
|
+
callToAction,
|
|
16
|
+
class: _class,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
|
|
21
|
+
const resolvedDialogId = dialogId || openableKey;
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
data-modal-open={resolvedDialogId}
|
|
27
|
+
data-call-to-action={callToAction}
|
|
28
|
+
class:list={[className, _class]}
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</button>
|
|
@@ -1,225 +1,240 @@
|
|
|
1
|
-
---
|
|
2
|
-
import "aos/dist/aos.css";
|
|
3
|
-
import { PageType, type PageMeta } from "@rxdrag/rxcms-models";
|
|
4
|
-
import type { Locals } from "@rxdrag/website-lib-core";
|
|
5
|
-
import Meta from "@rxdrag/website-lib/components/Meta.astro";
|
|
6
|
-
import { Entify } from "@rxdrag/website-lib-core";
|
|
7
|
-
import { ClientRouter } from "astro:transitions";
|
|
8
|
-
|
|
9
|
-
const { env, imageSizes } = Astro.locals as Locals;
|
|
10
|
-
|
|
11
|
-
const rx = Entify.getInstance(env, imageSizes);
|
|
12
|
-
|
|
13
|
-
// 文档壳:只负责 <html>/<head>/<body> 结构,不包含 Header/Footer 等站点布局。
|
|
14
|
-
interface Props {
|
|
15
|
-
// html 的 lang 属性
|
|
16
|
-
lang?: string;
|
|
17
|
-
// SEO Meta(由上层 Layout/页面传入)
|
|
18
|
-
meta?: PageMeta;
|
|
19
|
-
// 页面标题(由 Meta 组件消费)
|
|
20
|
-
title?: string;
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
className
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
resolvedTitle = resolvedTitle ??
|
|
84
|
-
resolvedMeta = resolvedMeta ??
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return state.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
el.classList.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
document.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
1
|
+
---
|
|
2
|
+
import "aos/dist/aos.css";
|
|
3
|
+
import { PageType, type PageMeta } from "@rxdrag/rxcms-models";
|
|
4
|
+
import type { Locals } from "@rxdrag/website-lib-core";
|
|
5
|
+
import Meta from "@rxdrag/website-lib/components/Meta.astro";
|
|
6
|
+
import { Entify } from "@rxdrag/website-lib-core";
|
|
7
|
+
import { ClientRouter } from "astro:transitions";
|
|
8
|
+
|
|
9
|
+
const { env, imageSizes } = Astro.locals as Locals;
|
|
10
|
+
|
|
11
|
+
const rx = Entify.getInstance(env, imageSizes);
|
|
12
|
+
|
|
13
|
+
// 文档壳:只负责 <html>/<head>/<body> 结构,不包含 Header/Footer 等站点布局。
|
|
14
|
+
interface Props {
|
|
15
|
+
// html 的 lang 属性
|
|
16
|
+
lang?: string;
|
|
17
|
+
// SEO Meta(由上层 Layout/页面传入)
|
|
18
|
+
meta?: PageMeta;
|
|
19
|
+
// 页面标题(由 Meta 组件消费)
|
|
20
|
+
title?: string;
|
|
21
|
+
// JSON-LD 结构化数据,支持单个或数组
|
|
22
|
+
jsonLd?: Record<string, unknown> | Record<string, unknown>[];
|
|
23
|
+
// 兼容 class / className 两种写法,最终合并到 body 上
|
|
24
|
+
class?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
lang = "en",
|
|
30
|
+
meta,
|
|
31
|
+
title,
|
|
32
|
+
jsonLd,
|
|
33
|
+
class: className = "scroll-smooth",
|
|
34
|
+
className: className2,
|
|
35
|
+
// 其余 props 透传到 body(例如 data-* 属性等)
|
|
36
|
+
...rest
|
|
37
|
+
} = Astro.props;
|
|
38
|
+
|
|
39
|
+
const jsonLdItems = jsonLd
|
|
40
|
+
? Array.isArray(jsonLd) ? jsonLd : [jsonLd]
|
|
41
|
+
: [];
|
|
42
|
+
|
|
43
|
+
const bodyAttrs = {
|
|
44
|
+
"data-aos-easing": "ease-out-cubic",
|
|
45
|
+
"data-aos-duration": "800",
|
|
46
|
+
"data-aos-delay": "0",
|
|
47
|
+
"data-aos-offset": "50",
|
|
48
|
+
"data-aos-once": "true",
|
|
49
|
+
...rest,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//TODO: 添加meta获取逻辑,有可能需要重构后端数据结构,现在看来,只有动态内容需要获取meta,其它页面可以传入
|
|
53
|
+
|
|
54
|
+
let resolvedMeta: PageMeta | undefined = meta;
|
|
55
|
+
let resolvedTitle: string | undefined = title;
|
|
56
|
+
|
|
57
|
+
// 仅在未传入 meta/title 时,针对动态详情页兜底拉取
|
|
58
|
+
if (!resolvedMeta || !resolvedTitle) {
|
|
59
|
+
try {
|
|
60
|
+
const pathname = Astro.url?.pathname || "";
|
|
61
|
+
const slug =
|
|
62
|
+
typeof Astro.params?.slug === "string" ? Astro.params.slug : undefined;
|
|
63
|
+
const id =
|
|
64
|
+
typeof Astro.params?.id === "string" ? Astro.params.id : undefined;
|
|
65
|
+
|
|
66
|
+
if (slug && pathname.startsWith("/posts/categories/")) {
|
|
67
|
+
const category = await rx.getPostCategoryBySlug(slug);
|
|
68
|
+
const page = await rx.getPageByType(PageType.PostList);
|
|
69
|
+
resolvedTitle = resolvedTitle ?? category?.name ?? "Blog";
|
|
70
|
+
resolvedMeta = resolvedMeta ?? page?.meta;
|
|
71
|
+
} else if (slug && pathname.startsWith("/products/categories/")) {
|
|
72
|
+
const category = await rx.getProductCategoryBySlug(slug);
|
|
73
|
+
const page = await rx.getPageByType(PageType.ProductList);
|
|
74
|
+
resolvedTitle = resolvedTitle ?? category?.name ?? "Products";
|
|
75
|
+
resolvedMeta = resolvedMeta ?? page?.meta;
|
|
76
|
+
} else if (id && pathname.startsWith("/profiles/")) {
|
|
77
|
+
const user = await rx.getOneUser(id);
|
|
78
|
+
const page = await rx.getPageByType(PageType.Profile);
|
|
79
|
+
resolvedTitle = resolvedTitle ?? user?.name ?? "Profile";
|
|
80
|
+
resolvedMeta = resolvedMeta ?? page?.meta;
|
|
81
|
+
} else if (slug && pathname.startsWith("/posts/")) {
|
|
82
|
+
const post = await rx.getPostBySlug(slug, { width: 1200, height: 600 });
|
|
83
|
+
resolvedTitle = resolvedTitle ?? post?.title;
|
|
84
|
+
resolvedMeta = resolvedMeta ?? post?.meta;
|
|
85
|
+
} else if (slug && pathname.startsWith("/products/")) {
|
|
86
|
+
const product = await rx.getProductBySlug(slug, {
|
|
87
|
+
width: 800,
|
|
88
|
+
height: 800,
|
|
89
|
+
});
|
|
90
|
+
resolvedTitle = resolvedTitle ?? product?.title;
|
|
91
|
+
resolvedMeta = resolvedMeta ?? product?.meta;
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.log("[Document] resolve meta failed:", e);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
<!doctype html>
|
|
100
|
+
<html lang={lang} class="aos-preload">
|
|
101
|
+
<head>
|
|
102
|
+
<meta charset="UTF-8" />
|
|
103
|
+
<meta
|
|
104
|
+
name="viewport"
|
|
105
|
+
content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=0.5, user-scalable=yes"
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<meta name="generator" content={Astro.generator} />
|
|
109
|
+
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
110
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
111
|
+
<!-- 给上层 Layout/页面注入自定义 head 内容(预加载、脚本、样式等) -->
|
|
112
|
+
<!-- 预连接 -->
|
|
113
|
+
<link
|
|
114
|
+
rel="preconnect"
|
|
115
|
+
href="https://customer-amj1dt4tnge8w6ji.cloudflarestream.com"
|
|
116
|
+
crossorigin
|
|
117
|
+
/>
|
|
118
|
+
<script>
|
|
119
|
+
const w = window as any;
|
|
120
|
+
const state =
|
|
121
|
+
w.__aos_state__ ||
|
|
122
|
+
(w.__aos_state__ = { inited: false, loading: null, aos: null });
|
|
123
|
+
|
|
124
|
+
const el = document.documentElement;
|
|
125
|
+
const raf = () =>
|
|
126
|
+
new Promise((resolve) =>
|
|
127
|
+
requestAnimationFrame(() => resolve(undefined)),
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const ensureAos = async () => {
|
|
131
|
+
if (state.aos) return state.aos;
|
|
132
|
+
if (!state.loading) {
|
|
133
|
+
state.loading = import("aos").then((m) => {
|
|
134
|
+
state.aos = m.default;
|
|
135
|
+
return state.aos;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return state.loading;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const bootOrRefresh = async () => {
|
|
142
|
+
if (
|
|
143
|
+
window.matchMedia &&
|
|
144
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
145
|
+
) {
|
|
146
|
+
el.classList.add("aos-ready");
|
|
147
|
+
el.classList.remove("aos-preload");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (!document.querySelector("[data-aos]")) {
|
|
152
|
+
el.classList.add("aos-ready");
|
|
153
|
+
el.classList.remove("aos-preload");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
el.classList.add("aos-preload");
|
|
158
|
+
el.classList.remove("aos-ready");
|
|
159
|
+
|
|
160
|
+
const AOS = await ensureAos();
|
|
161
|
+
if (!state.inited) {
|
|
162
|
+
state.inited = true;
|
|
163
|
+
AOS.init({
|
|
164
|
+
duration: 800,
|
|
165
|
+
easing: "ease-out-cubic",
|
|
166
|
+
once: true,
|
|
167
|
+
offset: 50,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
await raf();
|
|
172
|
+
await raf();
|
|
173
|
+
AOS.refresh();
|
|
174
|
+
|
|
175
|
+
el.classList.add("aos-ready");
|
|
176
|
+
el.classList.remove("aos-preload");
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const boot = () => {
|
|
180
|
+
bootOrRefresh();
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
if (document.readyState === "loading") {
|
|
184
|
+
document.addEventListener("DOMContentLoaded", boot, { once: true });
|
|
185
|
+
} else {
|
|
186
|
+
boot();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
document.addEventListener("astro:page-load", boot);
|
|
190
|
+
document.addEventListener("astro:after-swap", boot);
|
|
191
|
+
</script>
|
|
192
|
+
<ClientRouter />
|
|
193
|
+
<!-- Consent default (Google) -->
|
|
194
|
+
<script is:inline>
|
|
195
|
+
window.dataLayer = window.dataLayer || [];
|
|
196
|
+
function gtag() {
|
|
197
|
+
dataLayer.push(arguments);
|
|
198
|
+
}
|
|
199
|
+
gtag("js", new Date());
|
|
200
|
+
gtag("consent", "default", {
|
|
201
|
+
ad_storage: "denied",
|
|
202
|
+
analytics_storage: "denied",
|
|
203
|
+
});
|
|
204
|
+
</script>
|
|
205
|
+
<slot name="head" />
|
|
206
|
+
<Meta title={resolvedTitle} content={resolvedMeta} />
|
|
207
|
+
{jsonLdItems.map((item) => (
|
|
208
|
+
<script type="application/ld+json" set:html={JSON.stringify(item)} />
|
|
209
|
+
))}
|
|
210
|
+
<style>
|
|
211
|
+
html.aos-preload [data-aos] {
|
|
212
|
+
opacity: 1 !important;
|
|
213
|
+
transform: none !important;
|
|
214
|
+
transition: none !important;
|
|
215
|
+
}
|
|
216
|
+
</style>
|
|
217
|
+
</head>
|
|
218
|
+
<!-- rest 会被展开到 body 上,方便上层控制 data-* 等属性 -->
|
|
219
|
+
<body class:list={[className, className2]} {...bodyAttrs}>
|
|
220
|
+
<slot />
|
|
221
|
+
</body>
|
|
222
|
+
</html>
|
|
223
|
+
|
|
224
|
+
<style>
|
|
225
|
+
html,
|
|
226
|
+
body {
|
|
227
|
+
margin: 0;
|
|
228
|
+
width: 100%;
|
|
229
|
+
height: 100%;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
html {
|
|
233
|
+
scroll-behavior: smooth;
|
|
234
|
+
scrollbar-gutter: stable;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
body {
|
|
238
|
+
scrollbar-gutter: stable;
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
3
|
+
import type { FrameProps } from "@rxdrag/website-lib-core";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Frame — 设计系统基础原子组件
|
|
7
|
+
*
|
|
8
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
9
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
10
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
11
|
+
* - class 用于提供组件的默认类名;class/className 由使用方叠加
|
|
12
|
+
* - backgrounds 用于渲染 BackgroundGroup
|
|
13
|
+
* Frame裁剪用 如果是虚化背景,需要单独裁剪
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export interface Props extends FrameProps {
|
|
17
|
+
tag?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
tag: Tag = "div",
|
|
22
|
+
class: classAttr,
|
|
23
|
+
className,
|
|
24
|
+
backgrounds,
|
|
25
|
+
...rest
|
|
26
|
+
} = Astro.props;
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<Tag class:list={["relative isolate",className, classAttr]} {...rest}>
|
|
30
|
+
<BackgroundGroup backgrounds={backgrounds} />
|
|
31
|
+
<slot />
|
|
32
|
+
</Tag>
|