@rxdrag/website-lib-core 0.0.118 → 0.0.119

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdrag/website-lib-core",
3
- "version": "0.0.118",
3
+ "version": "0.0.119",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -18,15 +18,14 @@
18
18
  "devDependencies": {
19
19
  "@babel/types": "^7.26.9",
20
20
  "@iconify/react": "^5.0.2",
21
- "@types/gsap": "^3.0.0",
22
21
  "@types/lodash-es": "^4.14.191",
23
22
  "@types/react": "^19.1.0",
24
23
  "@types/react-dom": "^19.1.0",
25
- "eslint": "^7.32.0",
24
+ "eslint": "^9.39.2",
26
25
  "typescript": "^5",
27
- "@rxdrag/eslint-config-custom": "0.2.12",
28
- "@rxdrag/slate-preview": "1.2.63",
29
- "@rxdrag/tsconfig": "0.2.0"
26
+ "@rxdrag/eslint-config-custom": "0.2.13",
27
+ "@rxdrag/tiptap-preview": "0.0.2",
28
+ "@rxdrag/tsconfig": "0.2.1"
30
29
  },
31
30
  "dependencies": {
32
31
  "@iconify/utils": "^3.0.2",
@@ -34,8 +33,8 @@
34
33
  "gsap": "^3.12.7",
35
34
  "hls.js": "^1.6.13",
36
35
  "lodash-es": "^4.17.21",
37
- "@rxdrag/entify-lib": "0.0.23",
38
- "@rxdrag/rxcms-models": "0.3.96"
36
+ "@rxdrag/entify-lib": "0.0.24",
37
+ "@rxdrag/rxcms-models": "0.3.97"
39
38
  },
40
39
  "peerDependencies": {
41
40
  "astro": "^4.0.0 || ^5.0.0",
@@ -36,6 +36,8 @@ export type TProduct = {
36
36
  related?: TProduct[];
37
37
  attachments?: Media[];
38
38
  meta?: PageMeta;
39
+ //todo:目前只有富文本编辑器用
40
+ coverUrl?: string;
39
41
  };
40
42
 
41
43
  export type TPostCategory = {
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from "react";
2
- import { TSlateResizable } from "@rxdrag/slate-preview";
2
+ import { TSlateResizable } from "@rxdrag/tiptap-preview";
3
3
  import { ProductView } from "./ProductView";
4
4
  import { Product } from "@rxdrag/rxcms-models";
5
5
 
@@ -1,22 +1,23 @@
1
- import { Product } from "@rxdrag/rxcms-models";
2
1
  import { HtmlHTMLAttributes } from "react";
3
2
  import "./style.css";
3
+ import { TProduct } from "../../../../entify";
4
4
 
5
5
  export function ProductMedia(
6
6
  props: {
7
- product?: Product;
7
+ product?: TProduct;
8
8
  width?: number;
9
9
  aspect?: string;
10
10
  } & HtmlHTMLAttributes<HTMLImageElement>
11
11
  ) {
12
12
  const { product, style, width, className, aspect, ...rest } = props;
13
- const media = product?.mediaPivots?.[0]?.media;
14
13
 
15
14
  return (
16
15
  <div
17
16
  className={"product-media " + className}
18
17
  style={{
19
18
  aspectRatio: aspect || "4 / 3",
19
+ borderRadius: "1rem",
20
+ overflow: "hidden",
20
21
  ...style,
21
22
  width,
22
23
  }}
@@ -26,8 +27,8 @@ export function ProductMedia(
26
27
  style={{
27
28
  width: "100%",
28
29
  }}
29
- src={media?.file?.resize || media?.file?.url || media?.file?.thumbnail}
30
- alt={product?.mediaPivots?.[0]?.altText}
30
+ src={product?.coverUrl}
31
+ alt={product?.title}
31
32
  />
32
33
  </div>
33
34
  );
@@ -1,14 +1,14 @@
1
- import { Product } from "@rxdrag/rxcms-models";
2
1
  import { ProductCardProps } from "./ProductCard";
3
- import { Figcaption, Figure, FigureContent } from "@rxdrag/slate-preview";
2
+ import { Figcaption, Figure, FigureContent } from "@rxdrag/tiptap-preview";
4
3
  import { ProductMedia } from "./ProductMedia";
5
4
  import { ProductTitle } from "./ProductTitle";
6
5
  import { ProductDescription } from "./ProductDescription";
7
6
  import { ProductCta } from "./ProductCta";
7
+ import { TProduct } from "../../../entify";
8
8
 
9
9
  export function ProductView(
10
10
  props: {
11
- product?: Product;
11
+ product?: TProduct;
12
12
  ctaTitle?: string;
13
13
  } & ProductCardProps
14
14
  ) {
@@ -2,5 +2,4 @@ export * from "./ProductCta";
2
2
  export * from "./ProductTitle";
3
3
  export * from "./ProductDescription";
4
4
  export * from "./ProductCard";
5
- export * from "./ProductCardPreview";
6
5
  export * from "./ProductMedia";
@@ -1,4 +1,4 @@
1
- import { extractOutline, mdxToSlate } from "@rxdrag/slate-preview";
1
+ import { extractOutlineFromTiptap, mdxToTiptap } from "@rxdrag/tiptap-preview";
2
2
  import { forwardRef, useEffect } from "react";
3
3
  import { useAcitviedHeading } from "./useAcitviedHeading";
4
4
  import clsx from "clsx";
@@ -18,8 +18,8 @@ export const RichTextOutline = forwardRef<
18
18
  >((props, ref) => {
19
19
  const { className, itemClassName, value, yOffset = 200, ...rest } = props;
20
20
  const activiedId = useAcitviedHeading(yOffset);
21
- const nodes = mdxToSlate(value ?? "");
22
- const outline = extractOutline(nodes ?? []);
21
+ const doc = mdxToTiptap(value ?? "");
22
+ const outline = extractOutlineFromTiptap(doc);
23
23
 
24
24
  useEffect(() => {
25
25
  const handleHashChange = () => {
@@ -1,12 +0,0 @@
1
- import { useQueryProduct } from "./useQueryProduct";
2
- import { ProductCardProps } from "./ProductCard";
3
- import { ProductView } from "./ProductView";
4
-
5
-
6
- export const createXProductCardPreview = (websiteId?: string) => {
7
- return ({ node }: ProductCardProps) => {
8
- const product = useQueryProduct(node?.productId, websiteId);
9
-
10
- return <ProductView product={product} node={node} />;
11
- }
12
- }