@rxdrag/website-lib 0.0.120 → 0.0.121
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/components/BackgroundGroup.astro +8 -3
- package/components/BaseBlock.astro +34 -0
- package/components/{FooterShell.astro → BaseFooter.astro} +5 -9
- package/components/{HeaderShell.astro → BaseHeader.astro} +7 -9
- package/components/Box.astro +8 -11
- package/components/Container.astro +19 -4
- package/components/Document.astro +110 -0
- package/components/Grid.astro +22 -14
- package/components/GridCell.astro +20 -10
- package/components/Link.astro +33 -4
- package/components/Picture.astro +35 -0
- package/components/Section.astro +10 -9
- package/components/Stack.astro +31 -0
- package/components/Video.astro +8 -2
- package/components//347/211/251/346/226/231/346/270/205/345/215/225.md +487 -0
- package/package.json +5 -5
- package/components//347/211/251/346/226/231/345/244/207/345/277/230.md +0 -353
|
@@ -14,8 +14,13 @@ const defaultClass =
|
|
|
14
14
|
|
|
15
15
|
<Fragment>
|
|
16
16
|
{
|
|
17
|
-
backgrounds?.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
backgrounds?.length
|
|
18
|
+
? backgrounds.map((background) => (
|
|
19
|
+
<Background
|
|
20
|
+
background={background}
|
|
21
|
+
defaultClass={defaultClass}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
: null
|
|
20
25
|
}
|
|
21
26
|
</Fragment>
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* 规范:被冻结(Frozen)的设计器原子组件(基础壳)
|
|
10
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
11
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
12
|
+
* - baseClass 用于提供组件的默认类名;class/className 由使用方叠加
|
|
13
|
+
* - backgrounds 用于渲染 BackgroundGroup
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
17
|
+
baseClass?: string | string[];
|
|
18
|
+
className?: string;
|
|
19
|
+
backgrounds?: BackgroundConfig[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
baseClass = "",
|
|
24
|
+
className,
|
|
25
|
+
class: classAttr,
|
|
26
|
+
backgrounds,
|
|
27
|
+
...rest
|
|
28
|
+
} = Astro.props;
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<div class:list={[baseClass, className, classAttr]} {...rest}>
|
|
32
|
+
{backgrounds?.length ? <BackgroundGroup backgrounds={backgrounds} /> : null}
|
|
33
|
+
<slot />
|
|
34
|
+
</div>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
BackgroundConfig,
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
6
4
|
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
7
5
|
import Container from "./Container.astro";
|
|
8
6
|
|
|
@@ -10,13 +8,10 @@ import Container from "./Container.astro";
|
|
|
10
8
|
* 区块
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
|
-
interface Props {
|
|
14
|
-
class?: string;
|
|
11
|
+
interface Props extends HTMLAttributes<'footer'> {
|
|
15
12
|
className?: string;
|
|
16
13
|
containerClassName?: string;
|
|
17
14
|
backgrounds?: BackgroundConfig[];
|
|
18
|
-
//动效
|
|
19
|
-
animation?: AnimationConfig;
|
|
20
15
|
disableContainer?: boolean;
|
|
21
16
|
}
|
|
22
17
|
|
|
@@ -26,10 +21,11 @@ const {
|
|
|
26
21
|
backgrounds,
|
|
27
22
|
disableContainer,
|
|
28
23
|
class: originalClass,
|
|
24
|
+
...rest
|
|
29
25
|
} = Astro.props;
|
|
30
26
|
---
|
|
31
27
|
|
|
32
|
-
<footer class:list={["footer-block relative", className, originalClass]}>
|
|
28
|
+
<footer class:list={["footer-block relative", className, originalClass]} {...rest}>
|
|
33
29
|
<BackgroundGroup backgrounds={backgrounds} />
|
|
34
30
|
{
|
|
35
31
|
disableContainer ? (
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
BackgroundConfig,
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
6
4
|
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
7
5
|
import Container from "./Container.astro";
|
|
8
6
|
|
|
@@ -10,13 +8,11 @@ import Container from "./Container.astro";
|
|
|
10
8
|
* 区块
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
|
-
interface Props {
|
|
14
|
-
class?: string;
|
|
11
|
+
interface Props extends HTMLAttributes<'header'> {
|
|
15
12
|
className?: string;
|
|
16
13
|
containerClassName?: string;
|
|
17
14
|
backgrounds?: BackgroundConfig[];
|
|
18
15
|
//动效
|
|
19
|
-
animation?: AnimationConfig;
|
|
20
16
|
disableContainer?: boolean;
|
|
21
17
|
}
|
|
22
18
|
|
|
@@ -26,10 +22,12 @@ const {
|
|
|
26
22
|
backgrounds,
|
|
27
23
|
disableContainer,
|
|
28
24
|
class: originalClass,
|
|
25
|
+
...rest
|
|
29
26
|
} = Astro.props;
|
|
30
|
-
---
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<header class:list={["header-block", className, originalClass]} {...rest}>
|
|
33
31
|
<BackgroundGroup backgrounds={backgrounds} />
|
|
34
32
|
{
|
|
35
33
|
disableContainer ? (
|
package/components/Box.astro
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
BackgroundConfig,
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
6
|
-
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
2
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
3
|
+
import BaseBlock from "./BaseBlock.astro";
|
|
7
4
|
|
|
8
5
|
interface Props {
|
|
9
6
|
class?: string;
|
|
10
7
|
className?: string;
|
|
11
8
|
backgrounds?: BackgroundConfig[];
|
|
12
|
-
//动效
|
|
13
|
-
animation?: AnimationConfig;
|
|
14
9
|
}
|
|
15
10
|
|
|
16
11
|
const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
|
|
17
12
|
---
|
|
18
13
|
|
|
19
|
-
<
|
|
20
|
-
|
|
14
|
+
<BaseBlock
|
|
15
|
+
baseClass={["w-full", "h-full", "flex", "flex-col"]}
|
|
16
|
+
className={className}
|
|
17
|
+
class={originalClass}
|
|
18
|
+
backgrounds={backgrounds}
|
|
21
19
|
{...rest}
|
|
22
20
|
>
|
|
23
|
-
<BackgroundGroup backgrounds={backgrounds} />
|
|
24
21
|
<slot />
|
|
25
|
-
</
|
|
22
|
+
</BaseBlock>
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import BaseBlock from "./BaseBlock.astro";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 容器
|
|
7
|
+
*
|
|
8
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
9
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
10
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface Props extends HTMLAttributes<"div"> {
|
|
3
14
|
//布局
|
|
4
15
|
className?: string;
|
|
5
|
-
class?: string;
|
|
6
16
|
}
|
|
7
17
|
|
|
8
18
|
const { className, class: classAttr, ...rest } = Astro.props;
|
|
9
19
|
---
|
|
10
20
|
|
|
11
|
-
<
|
|
21
|
+
<BaseBlock
|
|
22
|
+
baseClass="section-container"
|
|
23
|
+
className={className}
|
|
24
|
+
class={classAttr}
|
|
25
|
+
{...rest}
|
|
26
|
+
>
|
|
12
27
|
<slot />
|
|
13
|
-
</
|
|
28
|
+
</BaseBlock>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { PageType, type PageMeta } from "@rxdrag/rxcms-models";
|
|
3
|
+
import type { Locals } from "@rxdrag/website-lib-core";
|
|
4
|
+
import Meta from "@rxdrag/website-lib/components/Meta.astro";
|
|
5
|
+
import { Entify } from "@rxdrag/website-lib-core";
|
|
6
|
+
|
|
7
|
+
const { env, imageSizes } = Astro.locals as Locals;
|
|
8
|
+
|
|
9
|
+
const rx = Entify.getInstance(env, imageSizes);
|
|
10
|
+
|
|
11
|
+
// 文档壳:只负责 <html>/<head>/<body> 结构,不包含 Header/Footer 等站点布局。
|
|
12
|
+
interface Props {
|
|
13
|
+
// html 的 lang 属性
|
|
14
|
+
lang?: string;
|
|
15
|
+
// SEO Meta(由上层 Layout/页面传入)
|
|
16
|
+
meta?: PageMeta;
|
|
17
|
+
// 页面标题(由 Meta 组件消费)
|
|
18
|
+
title?: string;
|
|
19
|
+
// 兼容 class / className 两种写法,最终合并到 body 上
|
|
20
|
+
class?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
lang = "en",
|
|
26
|
+
meta,
|
|
27
|
+
title,
|
|
28
|
+
class: className = "scroll-smooth",
|
|
29
|
+
className: className2,
|
|
30
|
+
// 其余 props 透传到 body(例如 data-* 属性等)
|
|
31
|
+
...rest
|
|
32
|
+
} = Astro.props;
|
|
33
|
+
|
|
34
|
+
//TODO: 添加meta获取逻辑,有可能需要重构后端数据结构,现在看来,只有动态内容需要获取meta,其它页面可以传入
|
|
35
|
+
|
|
36
|
+
let resolvedMeta: PageMeta | undefined = meta;
|
|
37
|
+
let resolvedTitle: string | undefined = title;
|
|
38
|
+
|
|
39
|
+
// 仅在未传入 meta/title 时,针对动态详情页兜底拉取
|
|
40
|
+
if (!resolvedMeta || !resolvedTitle) {
|
|
41
|
+
try {
|
|
42
|
+
const pathname = Astro.url?.pathname || "";
|
|
43
|
+
const slug = typeof Astro.params?.slug === "string" ? Astro.params.slug : undefined;
|
|
44
|
+
|
|
45
|
+
if (slug && pathname.startsWith("/posts/categories/")) {
|
|
46
|
+
const category = await rx.getPostCategoryBySlug(slug);
|
|
47
|
+
const page = await rx.getPageByType(PageType.PostList);
|
|
48
|
+
resolvedTitle = resolvedTitle ?? category?.name ?? "Blog";
|
|
49
|
+
resolvedMeta = resolvedMeta ?? page?.meta;
|
|
50
|
+
} else if (slug && pathname.startsWith("/products/categories/")) {
|
|
51
|
+
const category = await rx.getProductCategoryBySlug(slug);
|
|
52
|
+
const page = await rx.getPageByType(PageType.ProductList);
|
|
53
|
+
resolvedTitle = resolvedTitle ?? category?.name ?? "Products";
|
|
54
|
+
resolvedMeta = resolvedMeta ?? page?.meta;
|
|
55
|
+
} else if (slug && pathname.startsWith("/posts/")) {
|
|
56
|
+
const post = await rx.getPostBySlug(slug, { width: 1200, height: 600 });
|
|
57
|
+
resolvedTitle = resolvedTitle ?? post?.title;
|
|
58
|
+
resolvedMeta = resolvedMeta ?? post?.meta;
|
|
59
|
+
} else if (slug && pathname.startsWith("/products/")) {
|
|
60
|
+
const product = await rx.getProductBySlug(slug, { width: 800, height: 800 });
|
|
61
|
+
resolvedTitle = resolvedTitle ?? product?.title;
|
|
62
|
+
resolvedMeta = resolvedMeta ?? product?.meta;
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log("[Document] resolve meta failed:", e);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
<!doctype html>
|
|
71
|
+
<html lang={lang} class="aos-preload">
|
|
72
|
+
<head>
|
|
73
|
+
<meta charset="UTF-8" />
|
|
74
|
+
<meta
|
|
75
|
+
name="viewport"
|
|
76
|
+
content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=0.5, user-scalable=yes"
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<meta name="generator" content={Astro.generator} />
|
|
80
|
+
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
81
|
+
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
82
|
+
<!-- 给上层 Layout/页面注入自定义 head 内容(预加载、脚本、样式等) -->
|
|
83
|
+
<slot name="head" />
|
|
84
|
+
<Meta title={resolvedTitle} content={resolvedMeta} />
|
|
85
|
+
<style>
|
|
86
|
+
html.aos-preload [data-aos] {
|
|
87
|
+
opacity: 1 !important;
|
|
88
|
+
transform: none !important;
|
|
89
|
+
transition: none !important;
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
92
|
+
</head>
|
|
93
|
+
<!-- rest 会被展开到 body 上,方便上层控制 data-* 等属性 -->
|
|
94
|
+
<body class:list={[className, className2]} {...rest}>
|
|
95
|
+
<slot />
|
|
96
|
+
</body>
|
|
97
|
+
</html>
|
|
98
|
+
|
|
99
|
+
<style>
|
|
100
|
+
html,
|
|
101
|
+
body {
|
|
102
|
+
margin: 0;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
html {
|
|
108
|
+
scroll-behavior: smooth;
|
|
109
|
+
}
|
|
110
|
+
</style>
|
package/components/Grid.astro
CHANGED
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
6
|
-
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
+
import BaseBlock from "./BaseBlock.astro";
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 网格
|
|
8
|
+
*
|
|
9
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
10
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
11
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
15
|
+
// 布局方案名称(设计器用)
|
|
10
16
|
patternName?: string;
|
|
11
|
-
class?: string;
|
|
12
17
|
className?: string;
|
|
13
18
|
backgrounds?: BackgroundConfig[];
|
|
14
|
-
//动效
|
|
15
|
-
animation?: AnimationConfig;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
const { className, class: originalClass, backgrounds } = Astro.props;
|
|
21
|
+
const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
|
|
19
22
|
|
|
20
23
|
//布局容器
|
|
21
24
|
---
|
|
22
25
|
|
|
23
|
-
<
|
|
24
|
-
|
|
26
|
+
<BaseBlock
|
|
27
|
+
baseClass="relative grid gap-12"
|
|
28
|
+
className={className}
|
|
29
|
+
class={originalClass}
|
|
30
|
+
backgrounds={backgrounds}
|
|
31
|
+
{...rest}
|
|
32
|
+
>
|
|
25
33
|
<slot />
|
|
26
|
-
</
|
|
34
|
+
</BaseBlock>
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
2
3
|
import type {
|
|
3
|
-
AnimationConfig,
|
|
4
4
|
BackgroundConfig,
|
|
5
5
|
} from "@rxdrag/website-lib-core";
|
|
6
|
-
import
|
|
6
|
+
import BaseBlock from "./BaseBlock.astro";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* 网格单元
|
|
10
|
+
*
|
|
11
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
12
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
13
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
10
17
|
className?: string;
|
|
11
18
|
backgrounds?: BackgroundConfig[];
|
|
12
|
-
//动效
|
|
13
|
-
animation?: AnimationConfig;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
const { className, class: originalClass, backgrounds } = Astro.props;
|
|
21
|
+
const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
|
|
17
22
|
---
|
|
18
23
|
|
|
19
|
-
<
|
|
20
|
-
|
|
24
|
+
<BaseBlock
|
|
25
|
+
baseClass={["w-full", "h-full", "flex", "flex-col"]}
|
|
26
|
+
className={className}
|
|
27
|
+
class={originalClass}
|
|
28
|
+
backgrounds={backgrounds}
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
21
31
|
<slot />
|
|
22
|
-
</
|
|
32
|
+
</BaseBlock>
|
package/components/Link.astro
CHANGED
|
@@ -3,18 +3,33 @@ import { toHref, type LinkType } from "@rxdrag/website-lib-core";
|
|
|
3
3
|
|
|
4
4
|
import type { HTMLAttributes } from "astro/types";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* 链接
|
|
8
|
+
*
|
|
9
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
10
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
11
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-* 等通用能力
|
|
12
|
+
* - 支持 className(自定义组件统一约定)
|
|
13
|
+
* - href 由 type/to/options 计算得出;不允许外部通过 props 覆盖(避免行为不稳定)
|
|
14
|
+
*/
|
|
15
|
+
|
|
6
16
|
interface Props extends HTMLAttributes<"a"> {
|
|
7
17
|
type?: LinkType | string;
|
|
8
|
-
to?: string
|
|
9
|
-
class?: string;
|
|
18
|
+
to?: string;
|
|
10
19
|
className?: string;
|
|
11
20
|
//用于active类名的传递
|
|
12
21
|
activeWhen?: string | true;
|
|
13
22
|
|
|
23
|
+
// 链接生成配置:用于 toHref 计算最终 href 的路径前缀
|
|
24
|
+
// - productsSlug:产品详情页路径前缀(如 "products")
|
|
25
|
+
// - postsSlug:文章详情页路径前缀(如 "posts")
|
|
14
26
|
options?: {
|
|
15
27
|
productsSlug?: string;
|
|
16
28
|
postsSlug?: string;
|
|
17
29
|
};
|
|
30
|
+
|
|
31
|
+
// 允许外部传入以便兼容旧用法,但运行时会被忽略(href 统一由 type/to/options 生成)
|
|
32
|
+
href?: string;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
const {
|
|
@@ -24,17 +39,31 @@ const {
|
|
|
24
39
|
className,
|
|
25
40
|
activeWhen,
|
|
26
41
|
options,
|
|
42
|
+
href: hrefFromProps,
|
|
43
|
+
"class:list": classListFromProps,
|
|
27
44
|
...props
|
|
28
45
|
} = Astro.props;
|
|
46
|
+
|
|
47
|
+
if (hrefFromProps) {
|
|
48
|
+
console.log(
|
|
49
|
+
`[Link] prop "href" is ignored. Use type/to/options to generate href. href=${hrefFromProps}`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (classListFromProps) {
|
|
53
|
+
console.log(
|
|
54
|
+
'[Link] prop "class:list" is ignored. Use class/className instead.'
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
29
58
|
const href = toHref(type || "", to || "", options);
|
|
30
59
|
const hrefObj = href ? { href } : {};
|
|
31
60
|
---
|
|
32
61
|
|
|
33
62
|
<a
|
|
34
|
-
|
|
63
|
+
{...props}
|
|
35
64
|
{...hrefObj}
|
|
65
|
+
data-actived-path={activeWhen}
|
|
36
66
|
class:list={[cls, className]}
|
|
37
|
-
{...props}
|
|
38
67
|
>
|
|
39
68
|
<slot />
|
|
40
69
|
</a>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
|
|
4
|
+
type PictureSource = {
|
|
5
|
+
srcset: string;
|
|
6
|
+
media?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
sizes?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface Props extends HTMLAttributes<"picture"> {
|
|
12
|
+
className?: string;
|
|
13
|
+
sources?: PictureSource[];
|
|
14
|
+
imgProps: Omit<HTMLAttributes<"img">, "src"> & {
|
|
15
|
+
src: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
sources,
|
|
22
|
+
imgProps,
|
|
23
|
+
class: originalClass,
|
|
24
|
+
...rest
|
|
25
|
+
} = Astro.props;
|
|
26
|
+
|
|
27
|
+
const sourceList = sources ?? [];
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<picture class:list={["picture-block", className, originalClass]} {...rest}>
|
|
31
|
+
{sourceList.map((source) => (
|
|
32
|
+
<source {...source} />
|
|
33
|
+
))}
|
|
34
|
+
<img {...imgProps} />
|
|
35
|
+
</picture>
|
package/components/Section.astro
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
BackgroundConfig,
|
|
5
|
-
} from "@rxdrag/website-lib-core";
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
6
4
|
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
7
5
|
import Container from "./Container.astro";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* 区块
|
|
9
|
+
*
|
|
10
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
11
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
12
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
13
|
+
* - 默认包裹 Container 提供统一容器宽度;需要全宽内容时使用 disableContainer
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
|
-
interface Props {
|
|
14
|
-
class?: string;
|
|
16
|
+
interface Props extends HTMLAttributes<'section'> {
|
|
15
17
|
className?: string;
|
|
16
18
|
containerClassName?: string;
|
|
17
19
|
backgrounds?: BackgroundConfig[];
|
|
18
|
-
//动效
|
|
19
|
-
animation?: AnimationConfig;
|
|
20
20
|
disableContainer?: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -26,10 +26,11 @@ const {
|
|
|
26
26
|
backgrounds,
|
|
27
27
|
disableContainer,
|
|
28
28
|
class: originalClass,
|
|
29
|
+
...rest
|
|
29
30
|
} = Astro.props;
|
|
30
31
|
---
|
|
31
32
|
|
|
32
|
-
<section class:list={["section-block", className, originalClass]}>
|
|
33
|
+
<section class:list={["section-block", className, originalClass]} {...rest}>
|
|
33
34
|
<BackgroundGroup backgrounds={backgrounds} />
|
|
34
35
|
{
|
|
35
36
|
disableContainer ? (
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from "astro/types";
|
|
3
|
+
import type { BackgroundConfig } from "@rxdrag/website-lib-core";
|
|
4
|
+
import BaseBlock from "./BaseBlock.astro";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 堆叠布局
|
|
8
|
+
*
|
|
9
|
+
* 规范:被冻结(Frozen)的设计器原子组件
|
|
10
|
+
* - 对外接口与 DOM 结构应保持稳定,不随业务随意增删/调整
|
|
11
|
+
* - 允许通过原生属性透传(...rest)注入 id/style/data-*(如 data-aos-*)等通用能力
|
|
12
|
+
* - 默认 mobile 为 vertical(flex-col);响应式方向/间距/对齐通过 class / className(Tailwind)表达
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
16
|
+
className?: string;
|
|
17
|
+
backgrounds?: BackgroundConfig[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { className, class: classAttr, backgrounds, ...rest } = Astro.props;
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<BaseBlock
|
|
24
|
+
baseClass={["flex", "flex-col"]}
|
|
25
|
+
className={className}
|
|
26
|
+
class={classAttr}
|
|
27
|
+
backgrounds={backgrounds}
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</BaseBlock>
|
package/components/Video.astro
CHANGED
|
@@ -7,8 +7,12 @@ import {
|
|
|
7
7
|
const { env, imageSizes } = Astro.locals as Locals;
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
|
+
//TODO 要删除
|
|
10
11
|
videoRef?: string;
|
|
12
|
+
//TODO 要删除
|
|
11
13
|
posterRef?: string;
|
|
14
|
+
src?: string;
|
|
15
|
+
poster?: string;
|
|
12
16
|
endTitle?: string;
|
|
13
17
|
eagerLoad?: boolean;
|
|
14
18
|
classNames?: {
|
|
@@ -28,6 +32,8 @@ interface Props {
|
|
|
28
32
|
const {
|
|
29
33
|
videoRef,
|
|
30
34
|
posterRef,
|
|
35
|
+
src,
|
|
36
|
+
poster,
|
|
31
37
|
eagerLoad,
|
|
32
38
|
endTitle = "Contact Us Now",
|
|
33
39
|
classNames = {},
|
|
@@ -37,7 +43,7 @@ const rx = Entify.getInstance(env, imageSizes);
|
|
|
37
43
|
|
|
38
44
|
// 获取媒体数据(增加 rx 为空时的保护)
|
|
39
45
|
const media = rx ? await rx.getMedia(videoRef) : undefined;
|
|
40
|
-
const
|
|
46
|
+
const posterObj = rx ? await rx.getMedia(posterRef) : undefined;
|
|
41
47
|
---
|
|
42
48
|
|
|
43
49
|
{
|
|
@@ -46,7 +52,7 @@ const poster = rx ? await rx.getMedia(posterRef) : undefined;
|
|
|
46
52
|
client:load
|
|
47
53
|
media={media}
|
|
48
54
|
endTitle={endTitle}
|
|
49
|
-
posterUrl={
|
|
55
|
+
posterUrl={posterObj?.file?.original}
|
|
50
56
|
eagerLoad={eagerLoad}
|
|
51
57
|
classNames={classNames}
|
|
52
58
|
/>
|