@aura-react-comp/motion 0.2.5 → 0.2.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"marquee.d.ts","sourceRoot":"","sources":["marquee.tsx"],"names":[],"mappings":";AAYA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,QAAa,EACb,SAAkB,EAClB,GAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,YAAY,+BAoCd"}
1
+ {"version":3,"file":"marquee.d.ts","sourceRoot":"","sources":["marquee.tsx"],"names":[],"mappings":";AAiBA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,QAAa,EACb,SAAkB,EAClB,GAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,YAAY,+BA0Cd"}
@@ -6,6 +6,11 @@
6
6
  * - 只动画 transform(合成器友好);
7
7
  * - 单份内容宽度需 ≥ 容器宽度,否则回绕处会露出空隙;
8
8
  * - reduced-motion 下静态展示(不滚动)。
9
+ *
10
+ * 回绕对齐的关键:间距必须放在**每份内容的尾部**(paddingRight),而不是用
11
+ * 外层 flex 的 gap。若用外层 gap,总宽为 2c + g,-50% 位移是 c + g/2,
12
+ * 与一个完整周期(c + g)差 g/2,每次回绕都会「往回跳」一下(闪回)。
13
+ * 改为尾部 padding 后总宽为 2(c + g),-50% 正好等于一个周期。
9
14
  */
10
15
  import { motion, useReducedMotion } from 'motion/react';
11
16
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -31,15 +36,16 @@ export function Marquee({
31
36
  children: children
32
37
  });
33
38
  }
34
- const track = /*#__PURE__*/_jsx("div", {
35
- style: {
36
- display: 'flex',
37
- alignItems: 'center',
38
- gap,
39
- flexShrink: 0
40
- },
41
- children: children
42
- });
39
+
40
+ // 尾部 padding 保证「两份之间」与「份内元素之间」的间隔一致,
41
+ // 从而 -50% 位移正好落在一个周期上。
42
+ const trackStyle = {
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ gap,
46
+ flexShrink: 0,
47
+ paddingRight: gap
48
+ };
43
49
  return /*#__PURE__*/_jsx("div", {
44
50
  className: className,
45
51
  style: {
@@ -47,11 +53,9 @@ export function Marquee({
47
53
  position: 'relative',
48
54
  ...style
49
55
  },
50
- "aria-hidden": false,
51
56
  children: /*#__PURE__*/_jsxs(motion.div, {
52
57
  style: {
53
58
  display: 'flex',
54
- gap,
55
59
  width: 'max-content'
56
60
  },
57
61
  animate: {
@@ -62,7 +66,14 @@ export function Marquee({
62
66
  repeat: Infinity,
63
67
  ease: 'linear'
64
68
  },
65
- children: [track, track]
69
+ children: [/*#__PURE__*/_jsx("div", {
70
+ style: trackStyle,
71
+ children: children
72
+ }), /*#__PURE__*/_jsx("div", {
73
+ style: trackStyle,
74
+ "aria-hidden": "true",
75
+ children: children
76
+ })]
66
77
  })
67
78
  });
68
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aura-react-comp/motion",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Aura 动效组件库 — 令牌驱动的场景化动画组件(进出场、数字与文字特效、滚动驱动、编排、手势)",
5
5
  "keywords": [
6
6
  "aura",