@rxdrag/website-lib-core 0.0.77 → 0.0.79

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.77",
3
+ "version": "0.0.79",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -24,9 +24,9 @@
24
24
  "@types/react-dom": "^19.1.0",
25
25
  "eslint": "^7.32.0",
26
26
  "typescript": "^5",
27
- "@rxdrag/tsconfig": "0.2.0",
28
27
  "@rxdrag/slate-preview": "1.2.61",
29
- "@rxdrag/eslint-config-custom": "0.2.12"
28
+ "@rxdrag/eslint-config-custom": "0.2.12",
29
+ "@rxdrag/tsconfig": "0.2.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@iconify/utils": "^3.0.2",
@@ -91,7 +91,7 @@ export const MainMedia = ({
91
91
  lastMousePosRef.current.x,
92
92
  lastMousePosRef.current.y
93
93
  );
94
- }, 200);
94
+ }, 1000);
95
95
  },
96
96
  [enableZoom, isVideo, updateZoomPosition]
97
97
  );
@@ -116,6 +116,25 @@ export const MainMedia = ({
116
116
  setPosition({ x: 0, y: 0 });
117
117
  }, []);
118
118
 
119
+ const handleClick = useCallback(
120
+ (e: React.MouseEvent) => {
121
+ if (!enableZoom || isVideo) return;
122
+
123
+ if (hoverTimerRef.current) {
124
+ clearTimeout(hoverTimerRef.current);
125
+ }
126
+
127
+ if (isZoomed) {
128
+ setIsZoomed(false);
129
+ setPosition({ x: 0, y: 0 });
130
+ } else {
131
+ setIsZoomed(true);
132
+ updateZoomPosition(e.clientX, e.clientY);
133
+ }
134
+ },
135
+ [enableZoom, isVideo, isZoomed, updateZoomPosition]
136
+ );
137
+
119
138
  return (
120
139
  <div
121
140
  ref={mainAreaRef}
@@ -128,6 +147,7 @@ export const MainMedia = ({
128
147
  onMouseEnter={handleMouseEnter}
129
148
  onMouseMove={handleMouseMove}
130
149
  onMouseLeave={handleMouseLeave}
150
+ onClick={handleClick}
131
151
  >
132
152
  {/* Navigation Arrows - Hide when zoomed to avoid misclick */}
133
153
  {!isZoomed && (
@@ -4,19 +4,23 @@ import { iconList } from "./socials";
4
4
  import clsx from "clsx";
5
5
 
6
6
  export type ShareProps = {
7
- socials?: string[],
8
- size?: "xs" | "sm" | "md" | "lg" | "xl",
9
- className?: string,
10
- }
7
+ socials?: string[];
8
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
9
+ className?: string;
10
+ classNames?: {
11
+ item?: string;
12
+ itemIcon?: string;
13
+ };
14
+ };
11
15
 
12
16
  function getPageDetails() {
13
- if (typeof window === 'undefined') {
17
+ if (typeof window === "undefined") {
14
18
  return null;
15
19
  }
16
20
  const details = {
17
21
  url: window?.location?.href,
18
22
  title: document?.title || "null",
19
- description: 'null', // 默认为空字符串
23
+ description: "null", // 默认为空字符串
20
24
  };
21
25
 
22
26
  const descriptionMetaTag = document.querySelector('meta[name="description"]');
@@ -27,43 +31,56 @@ function getPageDetails() {
27
31
  return details;
28
32
  }
29
33
 
30
- export const Share = forwardRef<HTMLDivElement, ShareProps>((props: ShareProps, ref) => {
31
- const { className, ...rest } = props;
32
- const [socialList, setSolicalList] = useState<IconListType>();
34
+ export const Share = forwardRef<HTMLDivElement, ShareProps>(
35
+ (props: ShareProps, ref) => {
36
+ const { className, classNames, ...rest } = props;
37
+ const [socialList, setSolicalList] = useState<IconListType>();
33
38
 
34
- const details = getPageDetails();
39
+ const details = getPageDetails();
35
40
 
36
- useEffect(() => {
37
- setSolicalList(iconList)
38
- }, [props.socials]);
41
+ useEffect(() => {
42
+ setSolicalList(iconList);
43
+ }, [props.socials]);
39
44
 
40
- // 生成每个社交媒体的分享链接
41
- const generateLink = (key: string) => {
42
- const social = iconList[key];
43
- if (!social) return '#';
44
- return social.url(details?.url || "", details?.title, details?.description);
45
- };
45
+ // 生成每个社交媒体的分享链接
46
+ const generateLink = (key: string) => {
47
+ const social = iconList[key];
48
+ if (!social) return "#";
49
+ return social.url(
50
+ details?.url || "",
51
+ details?.title,
52
+ details?.description
53
+ );
54
+ };
46
55
 
47
-
48
- return (
49
- <div ref={ref} className={clsx("flex items-center", className)}>
50
- <div className="flex space-x-3">
51
- {Object.keys(socialList || {}).map((key) => (
52
- <a
53
- key={key}
54
- href={generateLink(key)}
55
- target="_blank"
56
- rel="noopener noreferrer"
57
- title={`Share on ${iconList[key].title}`}
58
- className="flex h-6 w-6 items-center justify-center text-gray-400 hover:text-gray-500"
59
- >
60
- <svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
61
- {iconList[key].path}
62
- </svg>
63
- </a>
64
- ))
65
- }
56
+ return (
57
+ <div ref={ref} className={clsx("flex items-center", className)} {...rest}>
58
+ <div className="flex space-x-3">
59
+ {Object.keys(socialList || {}).map((key) => (
60
+ <a
61
+ key={key}
62
+ href={generateLink(key)}
63
+ target="_blank"
64
+ rel="noopener noreferrer"
65
+ title={`Share on ${iconList[key].title}`}
66
+ className={clsx(
67
+ "flex h-6 w-6 items-center justify-center text-gray-400 hover:text-gray-500",
68
+ classNames?.item
69
+ )}
70
+ >
71
+ <svg
72
+ className={clsx("w-5 h-5", classNames?.itemIcon)}
73
+ fill="currentColor"
74
+ viewBox="0 0 24 24"
75
+ focusable="false"
76
+ aria-hidden="true"
77
+ >
78
+ {iconList[key].path}
79
+ </svg>
80
+ </a>
81
+ ))}
82
+ </div>
66
83
  </div>
67
- </div>
68
- );
69
- });
84
+ );
85
+ }
86
+ );