@rxdrag/website-lib 0.0.102 → 0.0.104

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.
Files changed (37) hide show
  1. package/package.json +9 -6
  2. package/src/components/AnimationNumber.astro +0 -61
  3. package/src/components/Background.astro +0 -106
  4. package/src/components/BackgroundGroup.astro +0 -21
  5. package/src/components/Box.astro +0 -25
  6. package/src/components/Collapse.astro +0 -20
  7. package/src/components/CollapsePanel.astro +0 -20
  8. package/src/components/CollapseTrigger.astro +0 -15
  9. package/src/components/Container.astro +0 -13
  10. package/src/components/Flip.astro +0 -43
  11. package/src/components/FooterShell.astro +0 -43
  12. package/src/components/Grid.astro +0 -26
  13. package/src/components/GridCell.astro +0 -22
  14. package/src/components/HeaderShell.astro +0 -43
  15. package/src/components/Icon.astro +0 -30
  16. package/src/components/Image.astro +0 -18
  17. package/src/components/Link.astro +0 -61
  18. package/src/components/Meta.astro +0 -65
  19. package/src/components/Modal.astro +0 -14
  20. package/src/components/ModalCloser.astro +0 -19
  21. package/src/components/ModalPanel.astro +0 -19
  22. package/src/components/ModalTrigger.astro +0 -18
  23. package/src/components/Motion.astro +0 -48
  24. package/src/components/Popover.astro +0 -20
  25. package/src/components/PopverPanel.astro +0 -20
  26. package/src/components/RichTextView.astro +0 -47
  27. package/src/components/Section.astro +0 -43
  28. package/src/components/SlotContent.astro +0 -4
  29. package/src/components/Tabs.astro +0 -23
  30. package/src/components/TabsBody.astro +0 -17
  31. package/src/components/TabsHeader.astro +0 -17
  32. package/src/components/TabsPanel.astro +0 -17
  33. package/src/components/TabsTab.astro +0 -18
  34. package/src/components/Video.astro +0 -51
  35. package/src/components/index.ts +0 -34
  36. package/src/env.d.ts +0 -1
  37. package/src/index.ts +0 -1
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@rxdrag/website-lib",
3
- "version": "0.0.102",
3
+ "version": "0.0.104",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": "./index.ts"
6
+ ".": "./index.ts",
7
+ "./components/*": "./components/*.astro"
7
8
  },
8
9
  "files": [
9
10
  "src",
@@ -18,24 +19,26 @@
18
19
  "devDependencies": {
19
20
  "@astrojs/react": "^3.0.0",
20
21
  "@babel/types": "^7.26.9",
22
+ "@types/aos": "^3.0.7",
21
23
  "@types/react": "^19.1.0",
22
24
  "@types/react-dom": "^19.1.0",
23
25
  "astro": "^4.0.0",
24
26
  "eslint": "^7.32.0",
25
27
  "gsap": "^3.12.7",
26
28
  "typescript": "^5",
27
- "@rxdrag/rxcms-models": "0.3.96",
28
- "@rxdrag/eslint-config-custom": "0.2.12",
29
- "@rxdrag/entify-hooks": "0.2.77",
30
29
  "@rxdrag/slate-preview": "1.2.63",
30
+ "@rxdrag/entify-hooks": "0.2.77",
31
+ "@rxdrag/eslint-config-custom": "0.2.12",
32
+ "@rxdrag/rxcms-models": "0.3.96",
31
33
  "@rxdrag/tsconfig": "0.2.0"
32
34
  },
33
35
  "dependencies": {
36
+ "aos": "3.0.0-beta.6",
34
37
  "clsx": "^2.1.0",
35
38
  "react": "^19.1.0",
36
39
  "react-dom": "^19.1.0",
37
40
  "@rxdrag/rxcms-models": "0.3.96",
38
- "@rxdrag/website-lib-core": "0.0.103"
41
+ "@rxdrag/website-lib-core": "0.0.104"
39
42
  },
40
43
  "peerDependencies": {
41
44
  "astro": "^4.0.0 || ^5.0.0"
@@ -1,61 +0,0 @@
1
- ---
2
- import {
3
- getAnimationNumberDataAttrs,
4
- type AnimationNumberProps,
5
- } from "@rxdrag/website-lib-core";
6
-
7
- interface Props extends AnimationNumberProps {}
8
-
9
- const {
10
- start = 0,
11
- end = 100,
12
- transition = { duration: 2 },
13
- class: className,
14
- sign = "+",
15
- once = false,
16
- type = "int",
17
- fractionDigits = 1,
18
- } = Astro.props;
19
-
20
- const attrs = getAnimationNumberDataAttrs({
21
- start,
22
- end,
23
- transition,
24
- type,
25
- fractionDigits,
26
- once,
27
- });
28
- ---
29
-
30
- <div {...attrs} class={className}>
31
- <span class="motion-safe:animate-number">{start}</span>
32
- {sign && <span class="motion-safe:animate-sign hidden">{sign}</span>}
33
- </div>
34
-
35
- <script>
36
- import { pageLoader } from "@rxdrag/website-lib-core";
37
- import { numberController } from "@rxdrag/website-lib-core";
38
-
39
- // 页面加载后重新初始化动画
40
- //TODO 第三方引入时, pageloader有bug
41
- // pageLoader.onLoaded(() => {
42
- // numberController.mount();
43
- // });
44
-
45
- function mount() {
46
- numberController.mount();
47
- }
48
-
49
- try {
50
- if (typeof queueMicrotask === "function") {
51
- queueMicrotask(mount);
52
- } else {
53
- requestAnimationFrame(() => mount());
54
- }
55
- } catch {
56
- // ignore
57
- }
58
-
59
- document.addEventListener("astro:page-load", mount);
60
- document.addEventListener("astro:after-swap", mount);
61
- </script>
@@ -1,106 +0,0 @@
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
-
9
- export interface Props {
10
- background: BackgroundConfig;
11
- index?: number;
12
- defaultClass?: string;
13
- }
14
-
15
- const { env, imageSizes } = Astro.locals as Locals;
16
-
17
- const {
18
- background,
19
- defaultClass = "absolute top-0 left-0 w-full h-full object-cover",
20
- } = Astro.props;
21
-
22
- // 安全地提取 mediaRef 和 posterRef(只有部分背景类型有这些属性)
23
- const mediaRef =
24
- background.type === "image" ||
25
- background.type === "video" ||
26
- background.type === "spline"
27
- ? background.mediaRef
28
- : undefined;
29
-
30
- const posterRef =
31
- background.type === "video" ? background.posterRef : undefined;
32
-
33
- const rx = Entify.getInstance(env, imageSizes);
34
-
35
- // 获取媒体数据
36
- const media = rx ? await rx.getMedia(mediaRef) : undefined;
37
- const poster = rx ? await rx.getMedia(posterRef) : undefined;
38
-
39
- // 构建 className
40
- const className = [defaultClass, background.className]
41
- .filter(Boolean)
42
- .join(" ");
43
-
44
- // 预计算视频相关数据
45
- const videoUrl =
46
- background.type === "video" ? media?.file?.original : undefined;
47
- const posterUrl =
48
- background.type === "video" ? poster?.file?.original : undefined;
49
- const isHls =
50
- background.type === "video" &&
51
- (media?.storageType === "cloudflare_stream" ||
52
- videoUrl?.endsWith(".m3u8") ||
53
- videoUrl?.includes("cloudflarestream.com"));
54
-
55
- // 预计算图片 URL
56
- const imageUrl =
57
- background.type === "image" ? media?.file?.original : undefined;
58
-
59
- // 预计算 Spline URL
60
- const splineUrl =
61
- background.type === "spline"
62
- ? background.url ||
63
- (background.mediaRef ? `/media/${background.mediaRef}` : "")
64
- : undefined;
65
- ---
66
-
67
- {background.type === "color" && <div class={className} />}
68
-
69
- {background.type === "blur" && <div class={className} />}
70
-
71
- {
72
- background.type === "image" && (
73
- <img class={className} src={imageUrl} alt="Background Image" />
74
- )
75
- }
76
-
77
- {
78
- background.type === "svg" && background.code && (
79
- <div class={className} set:html={background.code} />
80
- )
81
- }
82
-
83
- {
84
- background.type === "video" &&
85
- (isHls ? (
86
- <BackgroundHlsVideoPlayer
87
- className={className}
88
- src={videoUrl}
89
- poster={posterUrl}
90
- client:load
91
- />
92
- ) : (
93
- <BackgroundVideoPlayer
94
- className={className}
95
- src={videoUrl}
96
- poster={posterUrl}
97
- client:load
98
- />
99
- ))
100
- }
101
-
102
- {
103
- background.type === "spline" && (
104
- <iframe class={className} src={splineUrl} title="Spline 3D Scene" />
105
- )
106
- }
@@ -1,21 +0,0 @@
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
- const defaultClass =
12
- "absolute w-full h-full inset-0 object-cover";
13
- ---
14
-
15
- <Fragment>
16
- {
17
- backgrounds?.map((background) => (
18
- <Background background={background} defaultClass={defaultClass} />
19
- ))
20
- }
21
- </Fragment>
@@ -1,25 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
-
8
- interface Props {
9
- class?: string;
10
- className?: string;
11
- backgrounds?: BackgroundConfig[];
12
- //动效
13
- animation?: AnimationConfig;
14
- }
15
-
16
- const { className, class: originalClass, backgrounds, ...rest } = Astro.props;
17
- ---
18
-
19
- <div
20
- class:list={["w-full, h-full flex flex-col", className, originalClass]}
21
- {...rest}
22
- >
23
- <BackgroundGroup backgrounds={backgrounds} />
24
- <slot />
25
- </div>
@@ -1,20 +0,0 @@
1
- ---
2
- import {
3
- getCollapseDataAttrs,
4
- type IMotionProps,
5
- } from "@rxdrag/website-lib-core";
6
-
7
- import Motion from "./Motion.astro";
8
-
9
- interface Props extends IMotionProps {
10
- openableKey?: string;
11
- }
12
-
13
- const { openableKey, ...rest } = Astro.props;
14
-
15
- const dataAttrs = getCollapseDataAttrs(openableKey);
16
- ---
17
-
18
- <Motion {...dataAttrs} {...rest}>
19
- <slot />
20
- </Motion>
@@ -1,20 +0,0 @@
1
- ---
2
- import {
3
- type IMotionProps,
4
- defaultPopoverPanelAnimation,
5
- getCollapsePanelDataAttrs,
6
- } from "@rxdrag/website-lib-core";
7
- import Motion from "./Motion.astro";
8
-
9
- interface Props extends IMotionProps {
10
- openableKey?: string;
11
- }
12
-
13
- const dataAttrs = getCollapsePanelDataAttrs();
14
-
15
- const { whileOpenable = defaultPopoverPanelAnimation, ...props } = Astro.props;
16
- ---
17
-
18
- <Motion whileOpenable={whileOpenable} {...dataAttrs} {...props}>
19
- <slot />
20
- </Motion>
@@ -1,15 +0,0 @@
1
- ---
2
- import {
3
- getCollapseTriggerDataAttrs,
4
- type CollapseTriggerProps,
5
- } from "@rxdrag/website-lib-core";
6
- import Motion from "./Motion.astro";
7
-
8
- interface Props extends CollapseTriggerProps {}
9
-
10
- const dataAttrs = getCollapseTriggerDataAttrs();
11
- ---
12
-
13
- <Motion {...dataAttrs} {...Astro.props}>
14
- <slot />
15
- </Motion>
@@ -1,13 +0,0 @@
1
- ---
2
- interface Props {
3
- //布局
4
- className?: string;
5
- class?: string;
6
- }
7
-
8
- const { className, class: classAttr, ...rest } = Astro.props;
9
- ---
10
-
11
- <div class:list={["section-container", className, classAttr]} {...rest}>
12
- <slot />
13
- </div>
@@ -1,43 +0,0 @@
1
- ---
2
- import { type HTMLElementsWithChildren } from "@rxdrag/website-lib-core";
3
-
4
- interface Props {
5
- flipKey?: string;
6
- as?: HTMLElementsWithChildren;
7
- class?: string;
8
- style?: string | Record<string, string | number>;
9
- [key: string]: any;
10
- }
11
-
12
- const { flipKey, as = "div", class: className, style, ...rest } = Astro.props;
13
-
14
- const Element = as;
15
- const mergedStyle = {
16
- ...style,
17
- };
18
-
19
- // 将 animate 属性序列化为 JSON 字符串
20
- const flipProps = {
21
- "data-flip": flipKey || true,
22
- };
23
- ---
24
-
25
- <Element class={className} style={mergedStyle} {...flipProps} {...rest}>
26
- <slot />
27
- </Element>
28
-
29
- <style>
30
- /* 确保动画过程中元素的行为正常 */
31
- [data-flip] {
32
- will-change: transform;
33
- transform-origin: 0 0;
34
- }
35
- </style>
36
-
37
- <script>
38
- import { flip, pageLoader } from "@rxdrag/website-lib-core";
39
- // 在页面加载和每次页面转场后都初始化Flip
40
- pageLoader.onLoaded(() => {
41
- flip.mount();
42
- });
43
- </script>
@@ -1,43 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
- import Container from "./Container.astro";
8
-
9
- /**
10
- * 区块
11
- */
12
-
13
- interface Props {
14
- class?: string;
15
- className?: string;
16
- containerClassName?: string;
17
- backgrounds?: BackgroundConfig[];
18
- //动效
19
- animation?: AnimationConfig;
20
- disableContainer?: boolean;
21
- }
22
-
23
- const {
24
- className,
25
- containerClassName,
26
- backgrounds,
27
- disableContainer,
28
- class: originalClass,
29
- } = Astro.props;
30
- ---
31
-
32
- <footer class:list={["footer-block relative", className, originalClass]}>
33
- <BackgroundGroup backgrounds={backgrounds} />
34
- {
35
- disableContainer ? (
36
- <slot />
37
- ) : (
38
- <Container class:list={["w-full h-full", containerClassName]}>
39
- <slot />
40
- </Container>
41
- )
42
- }
43
- </footer>
@@ -1,26 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
-
8
- interface Props {
9
- //布局方案名称,设计qi'yong
10
- patternName?: string;
11
- class?: string;
12
- className?: string;
13
- backgrounds?: BackgroundConfig[];
14
- //动效
15
- animation?: AnimationConfig;
16
- }
17
-
18
- const { className, class: originalClass, backgrounds } = Astro.props;
19
-
20
- //布局容器
21
- ---
22
-
23
- <div class:list={["relative grid gap-12", className, originalClass]}>
24
- <BackgroundGroup backgrounds={backgrounds} />
25
- <slot />
26
- </div>
@@ -1,22 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
-
8
- interface Props {
9
- class?: string;
10
- className?: string;
11
- backgrounds?: BackgroundConfig[];
12
- //动效
13
- animation?: AnimationConfig;
14
- }
15
-
16
- const { className, class: originalClass, backgrounds } = Astro.props;
17
- ---
18
-
19
- <div class:list={["w-full h-full flex flex-col", className, originalClass]}>
20
- <BackgroundGroup backgrounds={backgrounds} />
21
- <slot />
22
- </div>
@@ -1,43 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
- import Container from "./Container.astro";
8
-
9
- /**
10
- * 区块
11
- */
12
-
13
- interface Props {
14
- class?: string;
15
- className?: string;
16
- containerClassName?: string;
17
- backgrounds?: BackgroundConfig[];
18
- //动效
19
- animation?: AnimationConfig;
20
- disableContainer?: boolean;
21
- }
22
-
23
- const {
24
- className,
25
- containerClassName,
26
- backgrounds,
27
- disableContainer,
28
- class: originalClass,
29
- } = Astro.props;
30
- ---
31
-
32
- <header class:list={["header-block", className, originalClass]}>
33
- <BackgroundGroup backgrounds={backgrounds} />
34
- {
35
- disableContainer ? (
36
- <slot />
37
- ) : (
38
- <Container class:list={["w-full h-full", containerClassName]}>
39
- <slot />
40
- </Container>
41
- )
42
- }
43
- </header>
@@ -1,30 +0,0 @@
1
- ---
2
- import {
3
- Icon as CoreIcon,
4
- Entify,
5
- type Locals,
6
- } from "@rxdrag/website-lib-core";
7
-
8
- interface Props {
9
- className?: string;
10
- icon?: string;
11
- svg?: string;
12
- }
13
- const { env, imageSizes } = Astro.locals as Locals;
14
- const { className, icon, svg, ...rest } = Astro.props;
15
-
16
- const localIconName = icon?.startsWith("local:") ? icon?.split(":")[1] : null;
17
-
18
- const rx = Entify.getInstance(env, imageSizes);
19
-
20
- const svgIcon =
21
- !!rx && localIconName ? await rx.getIcon(localIconName) : undefined;
22
- ---
23
-
24
- <CoreIcon
25
- className={className}
26
- icon={localIconName ? undefined : icon}
27
- svg={svgIcon?.code || svg}
28
- {...rest}
29
- client:only="react"
30
- />
@@ -1,18 +0,0 @@
1
- ---
2
- import { Entify, type ImageProps, type Locals } from "@rxdrag/website-lib-core";
3
- const { env, imageSizes } = Astro.locals as Locals;
4
-
5
- interface Props extends ImageProps {}
6
-
7
- const { mediaRef, fileField, resize, className, ...props } = Astro.props;
8
-
9
- const rx = Entify.getInstance(env, imageSizes);
10
-
11
- const media = rx ? await rx.getMedia(mediaRef, fileField, resize) : undefined;
12
- ---
13
-
14
- <img
15
- src={fileField ? media?.file?.[fileField] : media?.file?.original || ""}
16
- class={className}
17
- {...props}
18
- />
@@ -1,61 +0,0 @@
1
- ---
2
- import {
3
- toHref,
4
- type IMotionProps,
5
- type LinkType,
6
- } from "@rxdrag/website-lib-core";
7
- import Motion from "./Motion.astro";
8
-
9
- // 定义a标签属性的接口
10
- interface AnchorAttributes {
11
- target?: "_blank" | "_self" | "_parent" | "_top";
12
- rel?: string;
13
- download?: boolean | string;
14
- ping?: string;
15
- referrerpolicy?: string;
16
- hreflang?: string;
17
- options?: {
18
- productsSlug?: string;
19
- postsSlug?: string;
20
- };
21
- }
22
-
23
- interface Props extends IMotionProps, AnchorAttributes {
24
- type?: LinkType | string;
25
- to?: string | undefined;
26
- class?: string;
27
- className?: string;
28
- //用于active类名的传递
29
- activeWhen?: string | true;
30
- }
31
-
32
- const {
33
- type,
34
- to,
35
- class: cls,
36
- className,
37
- activeWhen,
38
- options,
39
- ...props
40
- } = Astro.props;
41
- const href = toHref(type || "", to || "", options);
42
- const hrefObj = href ? { href } : {};
43
- ---
44
-
45
- <Motion
46
- as={"a"}
47
- data-actived-path={activeWhen}
48
- {...hrefObj}
49
- class:list={[cls, className]}
50
- {...props}
51
- >
52
- <slot />
53
- </Motion>
54
-
55
- <script>
56
- import { initLinks, pageLoader } from "@rxdrag/website-lib-core";
57
-
58
- pageLoader.onLoaded(() => {
59
- initLinks();
60
- });
61
- </script>
@@ -1,65 +0,0 @@
1
- ---
2
- import type { PageMeta } from "@rxdrag/rxcms-models";
3
-
4
- interface Props {
5
- content?: PageMeta;
6
- title?: string;
7
- }
8
-
9
- const { content, title: propTitle } = Astro.props;
10
-
11
- // 从content中提取SEO相关属性
12
- const {
13
- // SeoMeta属性
14
- seoTitle,
15
- seoKeywords,
16
- seoDescription,
17
- seoAuthor,
18
- publisher,
19
- seoRobots,
20
- // OgMeta属性
21
- ogTitle,
22
- ogDescription,
23
- ogUrl,
24
- ogSiteName,
25
- ogType,
26
- xCard,
27
- xSite,
28
- xUrl,
29
- // 其他属性
30
- ogImage,
31
- } = content || {};
32
-
33
- const title = propTitle || seoTitle || "YiZhanFei";
34
-
35
- //暂时不输出canonicalUrl非必须
36
- const canonicalURL = Astro.url.href;
37
- const imageUrl = ogImage?.file?.url || "";
38
- ---
39
-
40
- <title>{seoTitle || title}</title>
41
- <meta name="description" content={seoDescription} />
42
- <meta name="keywords" content={seoKeywords} />
43
- <meta name="author" content={seoAuthor} />
44
- <meta name="publisher" content={publisher} />
45
- <meta name="robots" content={seoRobots || "index, follow"} />
46
- <!-- <link rel="canonical" href={canonicalURL} /> -->
47
-
48
- <!-- Open Graph / Facebook -->
49
- <meta property="og:type" content={ogType || "website"} />
50
- <meta property="og:url" content={ogUrl || canonicalURL} />
51
- <meta property="og:title" content={ogTitle || title} />
52
- <meta property="og:description" content={ogDescription || seoDescription} />
53
- <meta property="og:image" content={imageUrl} />
54
- {ogSiteName && <meta property="og:site_name" content={ogSiteName} />}
55
-
56
- <!-- Twitter -->
57
- <meta property="twitter:card" content={xCard || "summary_large_image"} />
58
- <meta property="twitter:url" content={xUrl || ogUrl || canonicalURL} />
59
- <meta property="twitter:title" content={ogTitle || title} />
60
- <meta
61
- property="twitter:description"
62
- content={ogDescription || seoDescription}
63
- />
64
- <meta property="twitter:image" content={imageUrl} />
65
- {xSite && <meta property="twitter:site" content={xSite} />}
@@ -1,14 +0,0 @@
1
- ---
2
- import { getModalDataAttrs, type IMotionProps } from "@rxdrag/website-lib-core";
3
- import Motion from "./Motion.astro";
4
-
5
- interface Props extends IMotionProps {
6
- openableKey: string;
7
- }
8
-
9
- const dataAttrs = getModalDataAttrs(Astro.props.openableKey);
10
- ---
11
-
12
- <Motion {...dataAttrs} {...Astro.props}>
13
- <slot />
14
- </Motion>
@@ -1,19 +0,0 @@
1
- ---
2
- import {
3
- type IMotionProps,
4
- getModalCloserDataAttrs,
5
- } from "@rxdrag/website-lib-core";
6
- import Motion from "./Motion.astro";
7
-
8
- interface Props extends IMotionProps {
9
- openableKey?: string;
10
- }
11
-
12
- const dataAttrs = getModalCloserDataAttrs(Astro.props.openableKey);
13
- ---
14
-
15
- <Motion {...dataAttrs} {...Astro.props}>
16
- <slot />
17
- </Motion>
18
-
19
- <script></script>
@@ -1,19 +0,0 @@
1
- ---
2
- import {
3
- getModalPanelDataAttrs,
4
- type IMotionProps,
5
- } from "@rxdrag/website-lib-core";
6
- import Motion from "./Motion.astro";
7
-
8
- interface Props extends IMotionProps {
9
- openableKey?: string;
10
- }
11
-
12
- const dataAttrs = getModalPanelDataAttrs(Astro.props.openableKey);
13
- ---
14
-
15
- <Motion {...dataAttrs} {...Astro.props}>
16
- <slot />
17
- </Motion>
18
-
19
- <script></script>
@@ -1,18 +0,0 @@
1
- ---
2
- import {
3
- getModalTriggerDataAttrs,
4
- type ModalTriggerProps,
5
- } from "@rxdrag/website-lib-core";
6
- import Motion from "./Motion.astro";
7
-
8
- interface Props extends ModalTriggerProps {}
9
-
10
- const { callToAction, ...rest } = Astro.props;
11
- const dataAttrs = getModalTriggerDataAttrs(Astro.props.openableKey, callToAction);
12
- ---
13
-
14
- <Motion {...dataAttrs} {...rest}>
15
- <slot />
16
- </Motion>
17
-
18
- <script></script>
@@ -1,48 +0,0 @@
1
- ---
2
- import {
3
- getMotionProps,
4
- type HTMLElementsWithChildren,
5
- type IMotionProps,
6
- } from "@rxdrag/website-lib-core";
7
-
8
- interface Props extends IMotionProps {
9
- as?: HTMLElementsWithChildren;
10
- [key: string]: any;
11
- }
12
-
13
- const { as = "div", ...rest } = Astro.props;
14
-
15
- const Element = as;
16
- const { class: className, ...motionProps } = getMotionProps(rest);
17
- ---
18
-
19
- <Element class={className} {...motionProps}>
20
- <slot />
21
- </Element>
22
-
23
- <script>
24
- import {
25
- popover,
26
- modal,
27
- pageLoader,
28
- animate,
29
- aos,
30
- tabs,
31
- collapse,
32
- } from "@rxdrag/website-lib-core";
33
-
34
- pageLoader.onLoaded(() => {
35
- //初始化弹出层
36
- popover.mount();
37
- //初始化模态
38
- modal.mount();
39
- //初始化动画
40
- animate.mount();
41
- //初始化AOS
42
- aos.mount();
43
- //初始化标签页
44
- tabs.mount();
45
- //初始化折叠
46
- collapse.mount();
47
- });
48
- </script>
@@ -1,20 +0,0 @@
1
- ---
2
- import {
3
- getPopoverDataAttrs,
4
- type IMotionProps,
5
- } from "@rxdrag/website-lib-core";
6
-
7
- import Motion from "./Motion.astro";
8
-
9
- interface Props extends IMotionProps {
10
- openableKey?: string;
11
- }
12
-
13
- const { openableKey, ...rest } = Astro.props;
14
-
15
- const dataAttrs = getPopoverDataAttrs(openableKey);
16
- ---
17
-
18
- <Motion {...dataAttrs} {...rest}>
19
- <slot />
20
- </Motion>
@@ -1,20 +0,0 @@
1
- ---
2
- import {
3
- type IMotionProps,
4
- defaultPopoverPanelAnimation,
5
- getPopoverPanelDataAttrs,
6
- } from "@rxdrag/website-lib-core";
7
- import Motion from "./Motion.astro";
8
-
9
- interface Props extends IMotionProps {
10
- openableKey?: string;
11
- }
12
-
13
- const dataAttrs = getPopoverPanelDataAttrs(Astro.props.openableKey);
14
-
15
- const { whileOpenable = defaultPopoverPanelAnimation, ...props } = Astro.props;
16
- ---
17
-
18
- <Motion whileOpenable={whileOpenable} {...dataAttrs} {...props}>
19
- <slot />
20
- </Motion>
@@ -1,47 +0,0 @@
1
- ---
2
- import { mdxToSlate } from "@rxdrag/slate-preview";
3
- import {
4
- LeafPreviewView,
5
- slatePreviews,
6
- } from "@rxdrag/slate-preview";
7
- import type { TSlateLeaf } from "@rxdrag/slate-preview";
8
- import { ElementPreview } from "@rxdrag/slate-preview";
9
- import { PRODUCT_KEY, ProductCard } from "@rxdrag/website-lib-core";
10
-
11
- interface Props {
12
- value?: string;
13
- class?: string;
14
- style?: string | Record<string, string | number>;
15
- }
16
-
17
- const { value = "", class: className, style } = Astro.props;
18
- const previews = { ...slatePreviews, [PRODUCT_KEY]: ProductCard };
19
- const nodes = mdxToSlate(value);
20
- ---
21
-
22
- <div class={className} style={style}>
23
- {
24
- nodes?.map((node, index) => {
25
- // 递归处理节点的函数
26
- const renderNode = (node: any) => {
27
- // 纯文本节点
28
- if (typeof node.text !== 'undefined') {
29
- return <LeafPreviewView node={node as TSlateLeaf} />;
30
- }
31
-
32
- // 有子节点的元素
33
- if (node.children && node.children.length > 0) {
34
- return (
35
- <ElementPreview node={node} previews={previews}>
36
- {node.children.map((child: any) => renderNode(child))}
37
- </ElementPreview>
38
- );
39
- }
40
-
41
- return null;
42
- };
43
-
44
- return renderNode(node);
45
- })
46
- }
47
- </div>
@@ -1,43 +0,0 @@
1
- ---
2
- import type {
3
- AnimationConfig,
4
- BackgroundConfig,
5
- } from "@rxdrag/website-lib-core";
6
- import BackgroundGroup from "./BackgroundGroup.astro";
7
- import Container from "./Container.astro";
8
-
9
- /**
10
- * 区块
11
- */
12
-
13
- interface Props {
14
- class?: string;
15
- className?: string;
16
- containerClassName?: string;
17
- backgrounds?: BackgroundConfig[];
18
- //动效
19
- animation?: AnimationConfig;
20
- disableContainer?: boolean;
21
- }
22
-
23
- const {
24
- className,
25
- containerClassName,
26
- backgrounds,
27
- disableContainer,
28
- class: originalClass,
29
- } = Astro.props;
30
- ---
31
-
32
- <section class:list={["section-block", className, originalClass]}>
33
- <BackgroundGroup backgrounds={backgrounds} />
34
- {
35
- disableContainer ? (
36
- <slot />
37
- ) : (
38
- <Container class:list={["w-full h-full", containerClassName]}>
39
- <slot />
40
- </Container>
41
- )
42
- }
43
- </section>
@@ -1,4 +0,0 @@
1
- ---
2
- ---
3
-
4
- <slot />
@@ -1,23 +0,0 @@
1
- ---
2
- import Motion from "./Motion.astro";
3
- import { type IMotionProps } from "@rxdrag/website-lib-core";
4
- import { DATA_TABS, DATA_TABS_SELECTION } from "@rxdrag/website-lib-core";
5
-
6
- interface Props extends IMotionProps {
7
- name?: string;
8
- class?: string;
9
- selection?: number;
10
- }
11
-
12
- const id =
13
- Astro.props.name || `tabs-${Math.random().toString(36).substring(2, 9)}`;
14
- const { selection, ...rest } = Astro.props;
15
- const dataProps = {
16
- [DATA_TABS]: id,
17
- [DATA_TABS_SELECTION]: selection || 1,
18
- };
19
- ---
20
-
21
- <Motion {...rest} {...dataProps}>
22
- <slot />
23
- </Motion>
@@ -1,17 +0,0 @@
1
- ---
2
- import Motion from "./Motion.astro";
3
- import { type IMotionProps } from "@rxdrag/website-lib-core";
4
- import { DATA_TABS_BODY } from "@rxdrag/website-lib-core";
5
-
6
- interface Props extends IMotionProps {
7
- class?: string;
8
- }
9
-
10
- const dataProps = {
11
- [DATA_TABS_BODY]: true,
12
- };
13
- ---
14
-
15
- <Motion {...Astro.props} {...dataProps}>
16
- <slot />
17
- </Motion>
@@ -1,17 +0,0 @@
1
- ---
2
- import Motion from "./Motion.astro";
3
- import { type IMotionProps } from "@rxdrag/website-lib-core";
4
- import { DATA_TABS_HEADER } from "@rxdrag/website-lib-core";
5
-
6
- interface Props extends IMotionProps {
7
- class?: string;
8
- }
9
-
10
- const dataProps = {
11
- [DATA_TABS_HEADER]: true,
12
- };
13
- ---
14
-
15
- <Motion as="ul" {...Astro.props} {...dataProps}>
16
- <slot />
17
- </Motion>
@@ -1,17 +0,0 @@
1
- ---
2
- import { DATA_TABS_PANEL } from "@rxdrag/website-lib-core";
3
- import Motion from "./Motion.astro";
4
- import { type IMotionProps } from "@rxdrag/website-lib-core";
5
-
6
- interface Props extends IMotionProps {
7
- class?: string;
8
- }
9
-
10
- const dataProps = {
11
- [DATA_TABS_PANEL]: true,
12
- };
13
- ---
14
-
15
- <Motion {...Astro.props} {...dataProps}>
16
- <slot />
17
- </Motion>
@@ -1,18 +0,0 @@
1
- ---
2
- import { DATA_TABS_TAB } from "@rxdrag/website-lib-core";
3
- import Motion from "./Motion.astro";
4
- import { type IMotionProps } from "@rxdrag/website-lib-core";
5
- interface Props extends IMotionProps {
6
- class?: string;
7
- }
8
-
9
- const dataProps = {
10
- [DATA_TABS_TAB]: true,
11
- };
12
-
13
- const { class: className, ...props } = Astro.props;
14
- ---
15
-
16
- <Motion as="li" {...props} {...dataProps} class={className}>
17
- <slot />
18
- </Motion>
@@ -1,51 +0,0 @@
1
- ---
2
- import {
3
- Entify,
4
- ReactVideoPlayer,
5
- type Locals,
6
- } from "@rxdrag/website-lib-core";
7
- const { env, imageSizes } = Astro.locals as Locals;
8
-
9
- interface Props {
10
- videoRef?: string;
11
- posterRef?: string;
12
- endTitle?: string;
13
- classNames?: {
14
- container?: string;
15
- video?: string;
16
- playButton?: string;
17
- playButtonOuter?: string;
18
- playButtonInner?: string;
19
- playIcon?: string;
20
- overlay?: string;
21
- overlayTitle?: string;
22
- ctaButton?: string;
23
- overlayReplayButton?: string;
24
- };
25
- }
26
-
27
- const {
28
- videoRef,
29
- posterRef,
30
- endTitle = "Contact Us Now",
31
- classNames = {},
32
- } = Astro.props;
33
-
34
- const rx = Entify.getInstance(env, imageSizes);
35
-
36
- // 获取媒体数据(增加 rx 为空时的保护)
37
- const media = rx ? await rx.getMedia(videoRef) : undefined;
38
- const poster = rx ? await rx.getMedia(posterRef) : undefined;
39
- ---
40
-
41
- {
42
- media && (
43
- <ReactVideoPlayer
44
- client:load
45
- media={media}
46
- endTitle={endTitle}
47
- posterUrl={poster?.file?.original}
48
- classNames={classNames}
49
- />
50
- )
51
- }
@@ -1,34 +0,0 @@
1
- export { default as AnimationNumber } from "./AnimationNumber.astro";
2
- export { default as Background } from "./Background.astro";
3
- export { default as BackgroundGroup } from "./BackgroundGroup.astro";
4
- export { default as Box } from "./Box.astro";
5
- export { default as Collapse } from "./Collapse.astro";
6
- export { default as CollapseTrigger } from "./CollapseTrigger.astro";
7
- export { default as CollapsePanel } from "./CollapsePanel.astro";
8
- export { default as Container } from "./Container.astro";
9
- export { default as Flip } from "./Flip.astro";
10
- export { default as FooterShell } from "./FooterShell.astro";
11
- export { default as Grid } from "./Grid.astro";
12
- export { default as GridCell } from "./GridCell.astro";
13
- export { default as HeaderShell } from "./HeaderShell.astro";
14
- export { default as Icon } from "./Icon.astro";
15
- export { default as Image } from "./Image.astro";
16
- export { default as Link } from "./Link.astro";
17
- export { default as Meta } from "./Meta.astro";
18
- export { default as Modal } from "./Modal.astro";
19
- export { default as ModalCloser } from "./ModalCloser.astro";
20
- export { default as ModalPanel } from "./ModalPanel.astro";
21
- export { default as ModalTrigger } from "./ModalTrigger.astro";
22
- export { default as Motion } from "./Motion.astro";
23
- export { default as Popover } from "./Popover.astro";
24
- export { default as PopoverPanel } from "./PopverPanel.astro";
25
- export { default as RichTextView } from "./RichTextView.astro";
26
- export { default as Section } from "./Section.astro";
27
- export { default as Tabs } from "./Tabs.astro";
28
- export { default as TabsBody } from "./TabsBody.astro";
29
- export { default as TabsHeader } from "./TabsHeader.astro";
30
- export { default as TabsPanel } from "./TabsPanel.astro";
31
- export { default as TabsTab } from "./TabsTab.astro";
32
- export { default as SlotContent } from "./SlotContent.astro";
33
- export { default as Video } from "./Video.astro";
34
-
package/src/env.d.ts DELETED
@@ -1 +0,0 @@
1
- // <reference path="../.astro/types.d.ts" />
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./components";