@unicom-cloud/ui 0.8.101 → 0.8.103

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 (141) hide show
  1. package/Badge.js +7 -54
  2. package/Copy.js +6 -5
  3. package/LiquidFill.js +6 -5
  4. package/List.js +1 -1
  5. package/Marquee.js +6 -5
  6. package/QrCode.js +6 -5
  7. package/Tooltip.js +3 -4
  8. package/Tour.js +6 -5
  9. package/anchor/Anchor.js +12 -12
  10. package/anchor/util.js +10 -10
  11. package/back-top/index.js +7 -7
  12. package/badge/index.js +109 -162
  13. package/card/index.js +63 -43
  14. package/color-picker/InputHex.js +3 -4
  15. package/color-picker/InputRgb.js +7 -8
  16. package/color-picker/Palette.js +3 -4
  17. package/color-picker/Panel.js +3 -4
  18. package/color-picker/colors.js +5 -5
  19. package/color-picker/hooks/useColorPicker.js +3 -4
  20. package/color-picker/utils.js +14 -15
  21. package/components/common/space/index.js +24 -24
  22. package/components/common/utils/PqbCSSTransition.js +1 -1
  23. package/components/common/utils/constant.js +6 -3
  24. package/components/common/utils/reactDOM.js +6 -4
  25. package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
  26. package/components/common/utils/setPrimaryColor.js +18 -18
  27. package/components/common/utils/setTheme.js +8 -9
  28. package/copy/index.js +4 -3
  29. package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
  30. package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
  31. package/dist/scroll-into-view-if-needed/src/index.js +19 -19
  32. package/form/FormItem.js +69 -65
  33. package/form/context.js +6 -7
  34. package/grid/Col-.js +86 -0
  35. package/grid/Col.js +156 -73
  36. package/grid/Grid.js +71 -67
  37. package/grid/Row.js +53 -44
  38. package/grid/index.js +13 -13
  39. package/index.js +639 -662
  40. package/input/Textarea.js +1 -1
  41. package/input/autoSizeTextAreaHeight.js +7 -7
  42. package/liquid-fill/index.js +6 -5
  43. package/liquid-fill/interface.js +1 -0
  44. package/list/index.js +1 -1
  45. package/marquee/index.js +141 -223
  46. package/marquee/interface.js +1 -0
  47. package/marquee-/index.js +260 -0
  48. package/marquee-/interface.js +1 -0
  49. package/menu/Item.js +9 -9
  50. package/package.json +1 -1
  51. package/qr-code/index.js +6 -5
  52. package/splitter/SplitBar.js +81 -79
  53. package/splitter/Splitter.js +70 -78
  54. package/splitter/hooks/useResizable.js +9 -18
  55. package/splitter/hooks/useResize.js +10 -10
  56. package/splitter/hooks/useSizes.js +28 -28
  57. package/statistic/index.js +10 -10
  58. package/style.css +1 -1
  59. package/table/Table.js +369 -370
  60. package/table/hook/useThResizable.js +6 -5
  61. package/table/th-resizable/index.js +13 -12
  62. package/time-picker/util.js +8 -8
  63. package/tooltip/index.js +1 -2
  64. package/tour/index.js +6 -5
  65. package/tour/interface.js +1 -0
  66. package/tree/NodeList.js +1 -1
  67. package/types/common/utils/constant.d.ts +1 -0
  68. package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
  69. package/types/common/utils/tree.d.ts +1 -0
  70. package/types/common/utils/tween.d.ts +1 -0
  71. package/types/pc/anchor/util.d.ts +1 -1
  72. package/types/pc/badge/interface.d.ts +2 -0
  73. package/types/pc/card/interface.d.ts +8 -0
  74. package/types/pc/color-picker/hooks/useColorPicker.d.ts +7 -2
  75. package/types/pc/color-picker/utils.d.ts +6 -1
  76. package/types/pc/config-provider/interface.d.ts +8 -8
  77. package/types/pc/form/FormItem.d.ts +1 -1
  78. package/types/pc/grid/Col-.d.ts +4 -0
  79. package/types/pc/grid/Col.d.ts +3 -2
  80. package/types/pc/grid/Grid.d.ts +2 -2
  81. package/types/pc/grid/Item.d.ts +3 -3
  82. package/types/pc/grid/Row.d.ts +3 -2
  83. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  84. package/types/pc/grid/interface.d.ts +13 -7
  85. package/types/pc/index.d.ts +4 -4
  86. package/types/pc/liquid-fill/index.d.ts +2 -113
  87. package/types/pc/liquid-fill/interface.d.ts +113 -0
  88. package/types/pc/marquee/index.d.ts +3 -60
  89. package/types/pc/marquee/interface.d.ts +95 -0
  90. package/types/pc/marquee-/index.d.ts +8 -0
  91. package/types/pc/marquee-/interface.d.ts +56 -0
  92. package/types/pc/qr-code/index.d.ts +1 -31
  93. package/types/pc/qr-code/interface.d.ts +26 -33
  94. package/types/pc/splitter/SplitBar.d.ts +0 -1
  95. package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
  96. package/types/pc/splitter/hooks/useResize.d.ts +1 -2
  97. package/types/pc/splitter/interface.d.ts +0 -8
  98. package/types/pc/tour/index.d.ts +2 -45
  99. package/types/pc/tour/interface.d.ts +46 -0
  100. package/types/pc/upload/interface.d.ts +1 -0
  101. package/types/pc/utils/constant.d.ts +1 -2
  102. package/types/pc/utils/dayjs.d.ts +2 -1
  103. package/types/pc/utils/index.d.ts +2 -5
  104. package/types/pc/utils/responsiveObserve.d.ts +8 -4
  105. package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
  106. package/types/pc/utils/tree.d.ts +2 -1
  107. package/types/pc/utils/tween.d.ts +1 -1
  108. package/typography/Ellipsis.js +6 -5
  109. package/typography/Operations.js +6 -5
  110. package/upload/request.js +12 -13
  111. package/upload/request_.js +2 -3
  112. package/utils/constant.js +5 -5
  113. package/utils/dayjs.js +13 -12
  114. package/utils/index.js +261 -284
  115. package/utils/responsiveObserve.js +32 -25
  116. package/utils/scrollIntoViewIfNeeded.js +12 -0
  117. package/utils/tree.js +11 -9
  118. package/utils/tween.js +5 -5
  119. package/version/index.js +1 -1
  120. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  121. package/dist/compute-scroll-into-view/src/index.js +0 -126
  122. package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
  123. package/dist/tinycolor/customize/index.js +0 -12
  124. package/dist/tinycolor/src/conversion.js +0 -143
  125. package/dist/tinycolor/src/css-color-names.js +0 -153
  126. package/dist/tinycolor/src/format-input.js +0 -77
  127. package/dist/tinycolor/src/index.js +0 -388
  128. package/dist/tinycolor/src/util.js +0 -32
  129. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  130. package/types/common/utils/scrollIntoView.d.ts +0 -4
  131. package/types/common/utils/tinycolor.d.ts +0 -1
  132. package/types/pc/utils/color.d.ts +0 -1
  133. package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
  134. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  135. package/types/pc/utils/scrollIntoView.d.ts +0 -3
  136. package/types/pc/utils/tinycolor.d.ts +0 -1
  137. package/utils/color.js +0 -4
  138. package/utils/computeScrollIntoView.js +0 -6
  139. package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  140. package/utils/scrollIntoView.js +0 -6
  141. package/utils/tinycolor.js +0 -29
package/input/Textarea.js CHANGED
@@ -49,7 +49,7 @@ const ge = (e, A) => {
49
49
  beforeTriggerValueChangeCallback: (t) => {
50
50
  !("value" in e) && (n === void 0 || t.length <= n) && U(t);
51
51
  }
52
- }), S = F || l || "", { getPrefixCls: J, rtl: g } = ne(de), o = J?.("textarea"), z = s || e.resize === "none" || C(e.autoSize) && !w(e.autoSize.minRows) && !w(e.autoSize.maxRows) && e.autoSize?.minRows === e.autoSize?.maxRows || !w(e.rows);
52
+ }), S = F || l || "", { getPrefixCls: J, rtl: g } = ne(de), o = J?.("textarea"), z = s || e.resize === "none" || !w(e.rows) || C(e.autoSize) && !w(e.autoSize.minRows) && !w(e.autoSize.maxRows) && e.autoSize?.minRows === e.autoSize?.maxRows;
53
53
  z ? f.resize = "none" : e.resize && (f.resize = e.resize);
54
54
  const y = () => {
55
55
  if (r.current && r.current.focus) {
@@ -32,11 +32,11 @@ function y(n) {
32
32
  r || (r = document.createElement("textarea"), document.body.appendChild(r));
33
33
  const t = window.getComputedStyle(n), m = w.map((a) => `${a}:${t.getPropertyValue(a)}`).join(";");
34
34
  r.setAttribute("style", u + m);
35
- const e = parseFloat(t.getPropertyValue("padding-top")) + parseFloat(t.getPropertyValue("padding-bottom")), i = t.getPropertyValue("box-sizing"), l = parseFloat(t.getPropertyValue("border-top-width")) + parseFloat(t.getPropertyValue("border-bottom-width"));
35
+ const e = parseFloat(t.getPropertyValue("padding-top")) + parseFloat(t.getPropertyValue("padding-bottom")), i = t.getPropertyValue("box-sizing"), g = parseFloat(t.getPropertyValue("border-top-width")) + parseFloat(t.getPropertyValue("border-bottom-width"));
36
36
  return {
37
37
  paddingSize: e,
38
38
  boxSizing: i,
39
- borderSize: l
39
+ borderSize: g
40
40
  };
41
41
  }
42
42
  function H(n, t) {
@@ -48,16 +48,16 @@ function H(n, t) {
48
48
  };
49
49
  };
50
50
  if (n) {
51
- const { minRows: e, maxRows: i } = m(), l = t, { paddingSize: a, boxSizing: x, borderSize: p } = y(l);
52
- r.value = l.value || l.placeholder || "";
53
- let d = r.scrollHeight + p, g, o, h;
51
+ const { minRows: e, maxRows: i } = m(), g = t, { paddingSize: a, boxSizing: x, borderSize: p } = y(g);
52
+ r.value = g.value || g.placeholder || "";
53
+ let d = r.scrollHeight + p, l, o, h;
54
54
  if (e || i) {
55
55
  r.value = "";
56
56
  const f = r.scrollHeight - a;
57
- c(e) && (g = f * e, x === "border-box" && (g += a, g += p), d = Math.max(d, g)), c(i) && (o = f * i, x === "border-box" && (o += a, o += p), h = d > o ? "auto" : "", o = Math.min(d, o));
57
+ c(e) && (l = f * e, x === "border-box" && (l += a, l += p), d = Math.max(d, l)), c(i) && (o = f * i, x === "border-box" && (o += a, o += p), h = d > o ? "auto" : "", o = Math.min(d, o));
58
58
  }
59
59
  const s = {};
60
- return s.height = d, g && (s.minHeight = g), o && (s.maxHeight = o), h && (s.overflowY = h), s;
60
+ return s.height = d, l && (s.minHeight = l), o && (s.maxHeight = o), h && (s.overflowY = h), s;
61
61
  }
62
62
  }
63
63
  export {
@@ -13,12 +13,11 @@ import "../components/common/utils/reactDOM.js";
13
13
  import "@unicom-cloud/utils/constant";
14
14
  import mt from "../components/common/hooks/useUpdateEffect.js";
15
15
  import "lodash/debounce";
16
+ import "@unicom-cloud/utils/date";
16
17
  import "@unicom-cloud/utils/case-name";
17
18
  import lt from "@unicom-cloud/utils/class-name";
18
- import "../dist/tinycolor/chunk/BOzCVdr0.js";
19
19
  import "@unicom-cloud/utils/constant/ui";
20
20
  import "../utils/contextHolder.js";
21
- import "@unicom-cloud/utils/dayjs";
22
21
  import "@unicom-cloud/utils/clipboard-copy";
23
22
  import "../components/common/utils/dayjs.js";
24
23
  import "@unicom-cloud/utils/file/fileToURL";
@@ -47,13 +46,15 @@ import "../dist/react-transition-group/src/ReplaceTransition.js";
47
46
  import "../dist/react-transition-group/src/SwitchTransition.js";
48
47
  import "../dist/react-transition-group/chunk/CPfP7aNL.js";
49
48
  import "../dist/react-transition-group/src/TransitionGroup.js";
49
+ import { v4 as A } from "uuid";
50
50
  import "@unicom-cloud/utils/file/saveAs";
51
51
  import "@unicom-cloud/utils/screenfull";
52
+ import "@unicom-cloud/utils/tinycolor";
53
+ import "@unicom-cloud/utils/ui-color";
52
54
  import "@unicom-cloud/utils/constant/ui.js";
53
55
  import "react-is";
54
56
  import "@unicom-cloud/utils/tree";
55
57
  import { isNumber as ct } from "@unicom-cloud/utils/is";
56
- import { v4 as A } from "uuid";
57
58
  import "../dist/validate/src/index.js";
58
59
  import pt from "../config-provider/context.js";
59
60
  const dt = {
@@ -73,7 +74,7 @@ const dt = {
73
74
  decimalPlaces: 0,
74
75
  percentFontScale: 0.5,
75
76
  waveSpeedVariation: 0.5
76
- }, ge = (E) => {
77
+ }, we = (E) => {
77
78
  const { getPrefixCls: I, componentConfig: _ } = at(pt), i = I?.("liquid-fill"), H = st(
78
79
  E,
79
80
  dt,
@@ -254,5 +255,5 @@ const dt = {
254
255
  );
255
256
  };
256
257
  export {
257
- ge as default
258
+ we as default
258
259
  };
@@ -0,0 +1 @@
1
+
package/list/index.js CHANGED
@@ -10,7 +10,7 @@ import Tt from "../spin/index.js";
10
10
  import x from "@unicom-cloud/utils/class-name";
11
11
  import { omit as Bt } from "../components/common/utils/omit.js";
12
12
  import { pickDataAttributes as Vt } from "../components/common/utils/pick.js";
13
- import { scrollIntoView as _t } from "../components/common/utils/scrollIntoView.js";
13
+ import { scrollIntoView as _t } from "../components/common/utils/scrollIntoViewIfNeeded.js";
14
14
  import kt from "../virtual-list/VirtualList.js";
15
15
  import Gt from "./Item.js";
16
16
  import Ot from "../config-provider/context.js";
package/marquee/index.js CHANGED
@@ -1,23 +1,22 @@
1
- import { jsxs as S, jsx as l, Fragment as A } from "react/jsx-runtime";
2
- import { useContext as U, useRef as k, useState as u, useEffect as N } from "react";
1
+ import { jsx as s, Fragment as et, jsxs as j } from "react/jsx-runtime";
2
+ import { forwardRef as rt, useContext as it, useState as y, useRef as k, useCallback as A, useEffect as R, useMemo as f, Fragment as ot, Children as H } from "react";
3
3
  import "../config-provider/ConfigProvider.js";
4
4
  import "lodash/isEqualWith";
5
5
  import "../components/common/utils/is.js";
6
6
  import "@unicom-cloud/utils/constant/keyboardCode";
7
7
  import "lodash/isNumber";
8
- import "lodash/merge";
8
+ import nt from "lodash/merge";
9
9
  import "../components/common/utils/dom.js";
10
10
  import "../components/common/hooks/useIntersectionObserver.js";
11
- import V from "../components/common/hooks/useMergeProps.js";
11
+ import st from "../components/common/hooks/useMergeProps.js";
12
12
  import "../components/common/utils/reactDOM.js";
13
13
  import "@unicom-cloud/utils/constant";
14
14
  import "lodash/debounce";
15
+ import "@unicom-cloud/utils/date";
15
16
  import "@unicom-cloud/utils/case-name";
16
- import Z from "@unicom-cloud/utils/class-name";
17
- import "../dist/tinycolor/chunk/BOzCVdr0.js";
17
+ import mt from "@unicom-cloud/utils/class-name";
18
18
  import "@unicom-cloud/utils/constant/ui";
19
19
  import "../utils/contextHolder.js";
20
- import "@unicom-cloud/utils/dayjs";
21
20
  import "@unicom-cloud/utils/clipboard-copy";
22
21
  import "../components/common/utils/dayjs.js";
23
22
  import "@unicom-cloud/utils/file/fileToURL";
@@ -46,238 +45,157 @@ import "../dist/react-transition-group/src/ReplaceTransition.js";
46
45
  import "../dist/react-transition-group/src/SwitchTransition.js";
47
46
  import "../dist/react-transition-group/chunk/CPfP7aNL.js";
48
47
  import "../dist/react-transition-group/src/TransitionGroup.js";
49
- import { resizeObserver as _ } from "../components/common/utils/resizeObserver.js";
48
+ import { resizeObserver as at } from "../components/common/utils/resizeObserver.js";
49
+ import "uuid";
50
50
  import "@unicom-cloud/utils/file/saveAs";
51
51
  import "@unicom-cloud/utils/screenfull";
52
+ import "@unicom-cloud/utils/tinycolor";
53
+ import "@unicom-cloud/utils/ui-color";
52
54
  import "@unicom-cloud/utils/constant/ui.js";
53
55
  import "react-is";
54
56
  import "@unicom-cloud/utils/tree";
55
- import "@unicom-cloud/utils/is";
56
- import "uuid";
57
+ import { isPlainObject as lt } from "@unicom-cloud/utils/is";
57
58
  import "../dist/validate/src/index.js";
58
- import tt from "../config-provider/context.js";
59
- const et = {
59
+ import pt from "../config-provider/context.js";
60
+ const ct = {
60
61
  speed: 50,
61
- // 默认50像素/秒(数值越大越快)
62
62
  direction: "left",
63
63
  pauseOnHover: !1,
64
- gradient: !0,
65
- loop: 0,
66
- // 0表示无限循环
67
- gradientSize: 50
68
- }, ae = (q) => {
69
- const { getPrefixCls: O, componentConfig: P } = U(tt), s = O?.("marquee"), R = V(
70
- q,
71
- et,
72
- P?.Marquee
73
- );
74
- let {
75
- children: $,
76
- style: L,
77
- className: D,
78
- speed: E,
79
- // 默认50像素/秒(数值越大越快)
80
- direction: c,
81
- pauseOnHover: H,
82
- gradient: W,
83
- loop: a,
84
- // 0表示无限循环
85
- gradientSize: d,
86
- onComplete: b
87
- } = R;
88
- const h = k(null), T = k(null), w = k(null), n = k(), [F, j] = u({ width: 0, height: 0 }), [rt, B] = u({ width: 0, height: 0 }), [y, I] = u(!1), [M, m] = u(!0), [x, p] = u(0), [X, g] = u(0), o = c === "left" || c === "right";
89
- d = o ? 50 : 20;
90
- const z = () => {
91
- if (w.current && h.current) {
92
- const r = w.current.scrollWidth, t = w.current.scrollHeight, i = h.current.offsetWidth, e = h.current.offsetHeight;
93
- j({ width: r, height: t }), B({ width: i, height: e });
94
- const f = o ? r > i : t > e;
95
- if (I(f), f) {
96
- const v = c === "right" ? -r : c === "down" ? -t : 0;
97
- p(v);
64
+ loop: 0
65
+ }, ye = rt(
66
+ function(B, E) {
67
+ const { getPrefixCls: z, componentConfig: I } = it(pt), i = z?.("marquee"), t = z?.("marquee-var"), V = st(
68
+ B,
69
+ ct,
70
+ I?.Marquee
71
+ ), {
72
+ style: W = {},
73
+ className: _,
74
+ autoFill: m = !1,
75
+ play: p = !0,
76
+ pauseOnHover: C = !1,
77
+ pauseOnClick: v = !1,
78
+ direction: e = "left",
79
+ speed: M = 50,
80
+ delay: F = 0,
81
+ loop: q = 0,
82
+ gradient: D,
83
+ onFinish: G,
84
+ onCycleComplete: J,
85
+ onMount: x,
86
+ children: h
87
+ } = V, K = e === "left" || e === "right";
88
+ let r = D;
89
+ r === !0 && (r = {}), lt(r) && (r = nt(
90
+ { size: K ? 50 : 20, color: "#fff" },
91
+ r
92
+ ));
93
+ const [O, L] = y(0), [g, Q] = y(0), [$, T] = y(1), [w, U] = y(!1), X = k(null), a = E || X, c = k(null), u = A(() => {
94
+ if (c.current && a.current) {
95
+ const o = a.current.getBoundingClientRect(), d = c.current.getBoundingClientRect();
96
+ let n = o.width, l = d.width;
97
+ (e === "up" || e === "down") && (n = o.height, l = d.height), T(
98
+ m && n && l ? Math.max(2, Math.ceil(n / l)) : 1
99
+ ), L(n), Q(l);
98
100
  }
99
- }
100
- };
101
- N(() => {
102
- const r = _(
103
- [h.current],
104
- z
101
+ }, [m, a, e]);
102
+ R(() => {
103
+ if (!w) return;
104
+ u();
105
+ const o = at(
106
+ [a.current, c.current],
107
+ u
108
+ );
109
+ return () => {
110
+ o();
111
+ };
112
+ }, [u, a, c, w]), R(() => (u(), () => {
113
+ }), [u, h]), R(() => (U(!0), x && x(), () => {
114
+ }), [x]);
115
+ const P = f(() => g ? m ? g * $ / M : Math.max(O, g) / M : 0, [m, O, g, $, M]), Y = f(
116
+ () => ({
117
+ ...W,
118
+ [`--${t}-pause-on-hover`]: !p || C ? "paused" : "running",
119
+ [`--${t}-pause-on-click`]: !p || C && !v || v ? "paused" : "running",
120
+ [`--${t}-width`]: e === "up" || e === "down" ? "100vh" : "100%",
121
+ [`--${t}-transform`]: e === "up" ? "rotate(-90deg)" : e === "down" ? "rotate(90deg)" : "none"
122
+ }),
123
+ [W, t, p, C, v, e]
124
+ ), Z = f(
125
+ () => ({
126
+ [`--${t}-gradient-color`]: r?.color,
127
+ [`--${t}-gradient-width`]: typeof r?.size == "number" ? `${r?.size}px` : r?.size
128
+ }),
129
+ [r?.color, r?.size, t]
130
+ ), S = f(
131
+ () => ({
132
+ [`--${t}-play`]: p ? "running" : "paused",
133
+ [`--${t}-direction`]: e === "left" ? "normal" : "reverse",
134
+ [`--${t}-duration`]: `${P}s`,
135
+ [`--${t}-delay`]: `${F}s`,
136
+ [`--${t}-iteration-count`]: q ? `${q}` : "infinite",
137
+ [`--${t}-min-width`]: m ? "auto" : "100%"
138
+ }),
139
+ [t, p, e, P, F, q, m]
140
+ ), N = f(
141
+ () => ({
142
+ [`--${t}-transform`]: e === "up" ? "rotate(90deg)" : e === "down" ? "rotate(-90deg)" : "none"
143
+ }),
144
+ [e, t]
145
+ ), b = A(
146
+ (o) => Array.from({ length: o }).map((d, n) => /* @__PURE__ */ s(ot, { children: H.map(h, (l, tt) => /* @__PURE__ */ s(
147
+ "div",
148
+ {
149
+ style: N,
150
+ className: `${i}-child`,
151
+ children: l
152
+ },
153
+ `child-${n}-${tt}`
154
+ )) }, n)),
155
+ [h, N, i]
105
156
  );
106
- return () => r();
107
- }, []), N(() => {
108
- z(), g(0);
109
- }, [$]), N(() => {
110
- if (!M || !y)
111
- return;
112
- let r = null, t = x;
113
- const i = o ? F.width : F.height;
114
- let e = X;
115
- const f = (v) => {
116
- if (!r) {
117
- r = v, n.current = requestAnimationFrame(f);
118
- return;
119
- }
120
- const Q = (v - r) / 1e3;
121
- r = v;
122
- const C = E * Q;
123
- switch (c) {
124
- case "left":
125
- if (t -= C, t <= -i && (t += i, e += 1, g(e), a > 0 && e >= a)) {
126
- cancelAnimationFrame(n.current), m(!1), p(0), b?.();
127
- return;
128
- }
129
- break;
130
- case "right":
131
- if (t += C, t >= 0 && (t -= i, e += 1, g(e), a > 0 && e >= a)) {
132
- cancelAnimationFrame(n.current), m(!1), p(-i), b?.();
133
- return;
134
- }
135
- break;
136
- case "up":
137
- if (t -= C, t <= -i && (t += i, e += 1, g(e), a > 0 && e >= a)) {
138
- cancelAnimationFrame(n.current), m(!1), p(0), b?.();
139
- return;
140
- }
141
- break;
142
- case "down":
143
- if (t += C, t >= 0 && (t -= i, e += 1, g(e), a > 0 && e >= a)) {
144
- cancelAnimationFrame(n.current), m(!1), p(-i), b?.();
145
- return;
146
- }
147
- break;
148
- }
149
- p(t), n.current = requestAnimationFrame(f);
150
- };
151
- return n.current = requestAnimationFrame(f), () => {
152
- n.current && cancelAnimationFrame(n.current);
153
- };
154
- }, [M, E, c, F, y, a]), N(() => (z(), () => {
155
- n.current && cancelAnimationFrame(n.current);
156
- }), []);
157
- const Y = () => {
158
- H && m(!1);
159
- }, G = () => {
160
- H && m(!0);
161
- }, J = () => o ? `translateX(${x}px)` : `translateY(${x}px)`, K = () => {
162
- const r = {
163
- display: o ? "inline-block" : "block",
164
- whiteSpace: o ? "nowrap" : "normal",
165
- // 消除元素间默认间距
166
- marginRight: o ? 0 : void 0,
167
- marginBottom: o ? void 0 : 0
168
- }, t = /* @__PURE__ */ l(
157
+ return w ? /* @__PURE__ */ s(et, { children: /* @__PURE__ */ j(
169
158
  "div",
170
159
  {
171
- ref: w,
172
- style: r,
173
- className: `${s}-children`,
174
- children: $
175
- }
176
- );
177
- return y ? /* @__PURE__ */ S(A, { children: [
178
- t,
179
- /* @__PURE__ */ l("div", { style: r, className: `${s}-children`, children: $ })
180
- ] }) : t;
181
- };
182
- return /* @__PURE__ */ S(
183
- "div",
184
- {
185
- ref: h,
186
- className: Z(
187
- s,
188
- `${s}-${c}`,
189
- D
190
- ),
191
- style: {
192
- overflow: "hidden",
193
- position: "relative",
194
- ...L
195
- },
196
- onMouseEnter: Y,
197
- onMouseLeave: G,
198
- children: [
199
- /* @__PURE__ */ l(
200
- "div",
201
- {
202
- ref: T,
203
- style: {
204
- display: o ? "inline-block" : "block",
205
- whiteSpace: "nowrap",
206
- willChange: "transform",
207
- // 启用GPU加速
208
- transform: J()
209
- },
210
- className: `${s}-content`,
211
- children: K()
212
- }
213
- ),
214
- W && y && (o ? /* @__PURE__ */ S(A, { children: [
215
- /* @__PURE__ */ l(
216
- "div",
217
- {
218
- style: {
219
- position: "absolute",
220
- top: 0,
221
- left: 0,
222
- width: d,
223
- height: "100%",
224
- background: "linear-gradient(to right, #fff, transparent)",
225
- pointerEvents: "none"
226
- },
227
- className: `${s}-linear-gradient-to-right`
228
- }
229
- ),
230
- /* @__PURE__ */ l(
160
+ ref: a,
161
+ style: Y,
162
+ className: mt(i, `${i}-${e}`, _),
163
+ children: [
164
+ !!r && /* @__PURE__ */ s("div", { style: Z, className: `${i}-overlay` }),
165
+ /* @__PURE__ */ j(
231
166
  "div",
232
167
  {
233
- style: {
234
- position: "absolute",
235
- top: 0,
236
- right: 0,
237
- width: d,
238
- height: "100%",
239
- background: "linear-gradient(to left, #fff, transparent)",
240
- pointerEvents: "none"
241
- },
242
- className: `${s}-linear-gradient-to-left`
243
- }
244
- )
245
- ] }) : /* @__PURE__ */ S(A, { children: [
246
- /* @__PURE__ */ l(
247
- "div",
248
- {
249
- style: {
250
- position: "absolute",
251
- top: 0,
252
- left: 0,
253
- width: "100%",
254
- height: d,
255
- background: "linear-gradient(to bottom, #fff, transparent)",
256
- pointerEvents: "none"
257
- },
258
- className: `${s}-linear-gradient-to-bottom`
168
+ style: S,
169
+ className: `${i}-item`,
170
+ onAnimationIteration: J,
171
+ onAnimationEnd: G,
172
+ children: [
173
+ /* @__PURE__ */ s(
174
+ "div",
175
+ {
176
+ ref: c,
177
+ className: `${i}-initial-child-container`,
178
+ children: H.map(h, (o, d) => /* @__PURE__ */ s(
179
+ "div",
180
+ {
181
+ style: N,
182
+ className: `${i}-child`,
183
+ children: o
184
+ },
185
+ `original-${d}`
186
+ ))
187
+ }
188
+ ),
189
+ b($ - 1)
190
+ ]
259
191
  }
260
192
  ),
261
- /* @__PURE__ */ l(
262
- "div",
263
- {
264
- style: {
265
- position: "absolute",
266
- bottom: 0,
267
- left: 0,
268
- width: "100%",
269
- height: d,
270
- background: "linear-gradient(to top, #fff, transparent)",
271
- pointerEvents: "none"
272
- },
273
- className: `${s}-linear-gradient-to-top`
274
- }
275
- )
276
- ] }))
277
- ]
278
- }
279
- );
280
- };
193
+ /* @__PURE__ */ s("div", { style: S, className: `${i}-item`, children: b($) })
194
+ ]
195
+ }
196
+ ) }) : null;
197
+ }
198
+ );
281
199
  export {
282
- ae as default
200
+ ye as default
283
201
  };
@@ -0,0 +1 @@
1
+