@xhub-short/ui 0.1.0-beta.1 → 0.1.0-beta.11

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 (76) hide show
  1. package/dist/CommentSheet.css-DyEc3Sro.d.ts +217 -0
  2. package/dist/VideoSlotPlayIndicator-DPs8Xt5C.d.ts +51 -0
  3. package/dist/chunk-3OB3OVYR.js +349 -0
  4. package/dist/{chunk-WKX2WBVO.js → chunk-3XPJHUYL.js} +1 -39
  5. package/dist/chunk-4RIMQOBR.js +58 -0
  6. package/dist/chunk-4TUBNA2X.js +180 -0
  7. package/dist/{chunk-4YDIRPIN.js → chunk-ANCP53F3.js} +3 -3
  8. package/dist/{chunk-UXMA4KJZ.js → chunk-CAWE42LH.js} +5 -3
  9. package/dist/{chunk-ANGBSV7L.js → chunk-CIIZ3IHV.js} +10 -5
  10. package/dist/chunk-DR7KR7OT.js +103 -0
  11. package/dist/chunk-DXLCQ4FH.js +102 -0
  12. package/dist/chunk-EDWS2IPH.js +1 -0
  13. package/dist/chunk-FR7UQSZP.js +570 -0
  14. package/dist/chunk-IWSBYOSS.js +91 -0
  15. package/dist/chunk-JEY6R4KJ.js +334 -0
  16. package/dist/chunk-KMJ3PQ7M.js +1262 -0
  17. package/dist/chunk-MFJS65C5.js +368 -0
  18. package/dist/{chunk-HW4LXTFT.js → chunk-OM4L7RE5.js} +18 -6
  19. package/dist/chunk-PBIH2F2Q.js +344 -0
  20. package/dist/chunk-PJ4NMVMY.js +326 -0
  21. package/dist/chunk-Q6MG7AVG.js +531 -0
  22. package/dist/chunk-QCKVF2DR.js +713 -0
  23. package/dist/chunk-QCRRF76W.js +75 -0
  24. package/dist/chunk-QUEJHA24.js +508 -0
  25. package/dist/chunk-VXW7AOGM.js +285 -0
  26. package/dist/chunk-YB7AXTX7.js +430 -0
  27. package/dist/chunk-ZGWSJ6Z5.js +601 -0
  28. package/dist/components/ActionBar/index.js +1 -1
  29. package/dist/components/AdvanceMenu/index.d.ts +78 -0
  30. package/dist/components/AdvanceMenu/index.js +1 -0
  31. package/dist/components/AuthorInfo/index.d.ts +5 -1
  32. package/dist/components/AuthorInfo/index.js +1 -1
  33. package/dist/components/BottomSheet/index.d.ts +82 -0
  34. package/dist/components/BottomSheet/index.js +1 -0
  35. package/dist/components/CleanModeOverlay/index.d.ts +60 -0
  36. package/dist/components/CleanModeOverlay/index.js +1 -0
  37. package/dist/components/CommentSheet/index.d.ts +164 -0
  38. package/dist/components/CommentSheet/index.js +1 -0
  39. package/dist/components/DetailView/index.d.ts +311 -0
  40. package/dist/components/DetailView/index.js +1 -0
  41. package/dist/components/ErrorBoundary/index.js +1 -1
  42. package/dist/components/ImageCarousel/index.d.ts +50 -0
  43. package/dist/components/ImageCarousel/index.js +1 -0
  44. package/dist/components/ImagePostSlot/index.d.ts +207 -0
  45. package/dist/components/ImagePostSlot/index.js +1 -0
  46. package/dist/components/ProgressBar/index.d.ts +30 -2
  47. package/dist/components/ProgressBar/index.js +1 -1
  48. package/dist/components/QualityPicker/index.d.ts +35 -0
  49. package/dist/components/QualityPicker/index.js +1 -0
  50. package/dist/components/ReportSheet/index.d.ts +68 -0
  51. package/dist/components/ReportSheet/index.js +1 -0
  52. package/dist/components/Skeleton/index.js +1 -1
  53. package/dist/components/SpeedPicker/index.d.ts +32 -0
  54. package/dist/components/SpeedPicker/index.js +1 -0
  55. package/dist/components/VideoFeed/index.d.ts +12 -1
  56. package/dist/components/VideoFeed/index.js +1 -1
  57. package/dist/components/VideoInfo/index.d.ts +4 -2
  58. package/dist/components/VideoInfo/index.js +1 -1
  59. package/dist/components/VideoPlayer/index.d.ts +14 -41
  60. package/dist/components/VideoPlayer/index.js +1 -1
  61. package/dist/components/VideoSlot/index.d.ts +84 -65
  62. package/dist/components/VideoSlot/index.js +2 -1
  63. package/dist/components/VirtualSlider/index.d.ts +339 -0
  64. package/dist/components/VirtualSlider/index.js +1 -0
  65. package/dist/components/icons/index.js +1 -1
  66. package/dist/index.d.ts +107 -95
  67. package/dist/index.js +84 -27
  68. package/package.json +51 -7
  69. package/dist/chunk-2PTMP65P.js +0 -738
  70. package/dist/chunk-4MN72OZH.js +0 -148
  71. package/dist/chunk-DHQJBXQW.js +0 -562
  72. package/dist/chunk-SSJDO24Q.js +0 -204
  73. package/dist/chunk-XAOEHLOX.js +0 -1326
  74. package/dist/chunk-YW23IBKF.js +0 -530
  75. package/dist/chunk-ZZDQKP4R.js +0 -418
  76. package/dist/use-gesture-react.esm-3SV4QLEJ.js +0 -1893
@@ -0,0 +1,285 @@
1
+ import { clsx2 } from './chunk-EDWS2IPH.js';
2
+ import { injectComponentCSS } from './chunk-CAWE42LH.js';
3
+ import { memo, useInsertionEffect, useMemo, useEffect, useCallback, useRef, useState } from 'react';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ // src/components/ProgressBar/ProgressBar.css.ts
7
+ var PROGRESS_BAR_CSS = `.sv-progress-bar{position:relative;width:100%;height:var(--sv-progress-bar-touch-height,24px);display:flex;align-items:center;cursor:pointer;user-select:none;-webkit-user-select:none;touch-action:none}.sv-progress-bar--disabled{cursor:default;pointer-events:none}.sv-progress-bar__track-wrapper{position:relative;flex:1;display:flex;align-items:center}.sv-progress-bar__track{position:relative;width:100%;height:var(--sv-progress-bar-height,3px);background:var(--sv-progress-bar-track-bg,rgba(255,255,255,.2));border-radius:var(--sv-progress-bar-radius,1.5px);overflow:hidden}.sv-progress-bar:hover .sv-progress-bar__track,.sv-progress-bar--seeking .sv-progress-bar__track{height:var(--sv-progress-bar-height-active,5px)}.sv-progress-bar--seeking .sv-progress-bar__fill,.sv-progress-bar--seeking .sv-progress-bar__handle{transition:none}.sv-progress-bar__buffered{position:absolute;top:0;left:0;height:100%;background:var(--sv-progress-bar-buffered-bg,rgba(255,255,255,.3));border-radius:inherit;transform-origin:left center;transform:scaleX(0);transition:transform .3s ease-out}.sv-progress-bar__fill{position:absolute;top:0;left:0;height:100%;width:100%;background:var(--sv-progress-bar-fill-bg,var(--sv-color-accent,#fe2c55));border-radius:inherit;transform-origin:left center;transform:scaleX(0);transition:var(--sv-progress-bar-fill-transition,transform .25s linear);will-change:transform}.sv-progress-bar__handle{position:absolute;top:50%;width:var(--sv-progress-bar-handle-size,12px);height:var(--sv-progress-bar-handle-size,12px);left:0;transform:translate(-50%,-50%)scale(0);background:var(--sv-progress-bar-handle-bg,#fff);border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:left .25s linear,transform .15s ease-out}.sv-progress-bar:hover .sv-progress-bar__handle,.sv-progress-bar--seeking .sv-progress-bar__handle{transform:translate(-50%,-50%)scale(1)}.sv-progress-bar__time{display:flex;justify-content:space-between;padding:var(--sv-spacing-xs,4px)0;font-family:var(--sv-font-family,'Urbanist',sans-serif);font-size:var(--sv-font-size-xs,11px);font-variant-numeric:tabular-nums;color:var(--sv-text-secondary,rgba(255,255,255,.7))}.sv-progress-bar__time-current,.sv-progress-bar__time-duration{min-width:2.5em}.sv-progress-bar__time-current{text-align:left}.sv-progress-bar__time-duration{text-align:right}.sv-progress-bar__tooltip{position:absolute;top:0;left:0;transform:translate(-50%,-100%);margin-top:-8px;padding:4px 8px;background:var(--sv-bg-overlay,rgba(0,0,0,.8));border-radius:var(--sv-border-radius-sm,4px);font-family:var(--sv-font-family,'Urbanist',sans-serif);font-size:var(--sv-font-size-xs,11px);font-variant-numeric:tabular-nums;color:var(--sv-text-primary,#fff);white-space:nowrap;opacity:0;visibility:hidden;transition:opacity .15s ease,visibility .15s ease;pointer-events:none;z-index:10}.sv-progress-bar:hover .sv-progress-bar__tooltip,.sv-progress-bar--seeking .sv-progress-bar__tooltip{opacity:1;visibility:visible}.sv-progress-bar--minimal{height:auto}.sv-progress-bar--minimal .sv-progress-bar__track{height:var(--sv-progress-bar-height-minimal,2px)}.sv-progress-bar--minimal:hover .sv-progress-bar__track{height:var(--sv-progress-bar-height-minimal,2px)}.sv-progress-bar--minimal .sv-progress-bar__handle{display:none}.sv-progress-bar--auto-hide{transition:opacity .3s ease,visibility .3s ease,transform .3s ease;opacity:1;visibility:visible;transform:translateY(0)}.sv-progress-bar--auto-hide.sv-progress-bar--hidden{opacity:0;visibility:hidden;transform:translateY(8px);pointer-events:none}.sv-progress-bar--auto-hide:hover{opacity:1;visibility:visible;transform:translateY(0)}.sv-progress-bar--auto-hide.sv-progress-bar--seeking{opacity:1;visibility:visible;transform:translateY(0)}@media(prefers-reduced-motion:reduce){.sv-progress-bar__fill,.sv-progress-bar__buffered,.sv-progress-bar__handle,.sv-progress-bar__tooltip{transition:none}}`;
8
+ var CSS_PREFIX = "sv-progress-bar";
9
+ function formatTime(seconds) {
10
+ if (!Number.isFinite(seconds) || seconds < 0) return "0:00";
11
+ const h = Math.floor(seconds / 3600);
12
+ const m = Math.floor(seconds % 3600 / 60);
13
+ const s = Math.floor(seconds % 60);
14
+ if (h > 0) {
15
+ return `${h}:${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
16
+ }
17
+ return `${m}:${s.toString().padStart(2, "0")}`;
18
+ }
19
+ function calculateProgress(currentTime, duration) {
20
+ if (!duration || duration <= 0) return 0;
21
+ return Math.min(100, Math.max(0, currentTime / duration * 100));
22
+ }
23
+ function calculateTimeFromPosition(clientX, rect, duration) {
24
+ const x = clientX - rect.left;
25
+ const percentage = Math.min(1, Math.max(0, x / rect.width));
26
+ return percentage * duration;
27
+ }
28
+ function useProgressBarRefs({
29
+ externalFillRef,
30
+ externalBufferedRef,
31
+ externalHandleRef,
32
+ externalCurrentTimeRef,
33
+ externalDurationRef
34
+ }) {
35
+ const containerRef = useRef(null);
36
+ const internalFillRef = useRef(null);
37
+ const internalBufferedRef = useRef(null);
38
+ const internalHandleRef = useRef(null);
39
+ const internalCurrentTimeRef = useRef(null);
40
+ const internalDurationRef = useRef(null);
41
+ const tooltipRef = useRef(null);
42
+ return {
43
+ containerRef,
44
+ tooltipRef,
45
+ fillRef: externalFillRef ?? internalFillRef,
46
+ bufferedRef: externalBufferedRef ?? internalBufferedRef,
47
+ handleRef: externalHandleRef ?? internalHandleRef,
48
+ currentTimeRef: externalCurrentTimeRef ?? internalCurrentTimeRef,
49
+ durationRef: externalDurationRef ?? internalDurationRef,
50
+ hasExternalCurrentTimeRef: !!externalCurrentTimeRef,
51
+ hasExternalDurationRef: !!externalDurationRef
52
+ };
53
+ }
54
+ function useSeekHandlers({
55
+ containerRef,
56
+ duration,
57
+ isSeekable,
58
+ onSeek,
59
+ onSeekStart,
60
+ onSeekEnd
61
+ }) {
62
+ const [isSeeking, setIsSeeking] = useState(false);
63
+ const [hoverTime, setHoverTime] = useState(null);
64
+ const [hoverPosition, setHoverPosition] = useState(0);
65
+ const handleSeek = useCallback(
66
+ (clientX) => {
67
+ if (!isSeekable || !containerRef.current) return;
68
+ const rect = containerRef.current.getBoundingClientRect();
69
+ const time = calculateTimeFromPosition(clientX, rect, duration);
70
+ onSeek?.(time);
71
+ },
72
+ [isSeekable, duration, onSeek, containerRef]
73
+ );
74
+ const handlePointerDown = useCallback(
75
+ (e) => {
76
+ if (!isSeekable) return;
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ if (typeof e.currentTarget.setPointerCapture === "function") {
80
+ e.currentTarget.setPointerCapture(e.pointerId);
81
+ }
82
+ setIsSeeking(true);
83
+ onSeekStart?.();
84
+ handleSeek(e.clientX);
85
+ },
86
+ [isSeekable, onSeekStart, handleSeek]
87
+ );
88
+ const handlePointerMove = useCallback(
89
+ (e) => {
90
+ if (!containerRef.current) return;
91
+ const rect = containerRef.current.getBoundingClientRect();
92
+ const time = calculateTimeFromPosition(e.clientX, rect, duration);
93
+ const position = (e.clientX - rect.left) / rect.width * 100;
94
+ setHoverTime(time);
95
+ setHoverPosition(Math.min(100, Math.max(0, position)));
96
+ if (isSeeking) handleSeek(e.clientX);
97
+ },
98
+ [duration, isSeeking, handleSeek, containerRef]
99
+ );
100
+ const handlePointerUp = useCallback(
101
+ (e) => {
102
+ e.stopPropagation();
103
+ if (isSeeking) {
104
+ if (typeof e.currentTarget.releasePointerCapture === "function") {
105
+ e.currentTarget.releasePointerCapture(e.pointerId);
106
+ }
107
+ setIsSeeking(false);
108
+ onSeekEnd?.();
109
+ }
110
+ },
111
+ [isSeeking, onSeekEnd]
112
+ );
113
+ const handlePointerLeave = useCallback(() => {
114
+ setHoverTime(null);
115
+ if (isSeeking) {
116
+ setIsSeeking(false);
117
+ onSeekEnd?.();
118
+ }
119
+ }, [isSeeking, onSeekEnd]);
120
+ return {
121
+ isSeeking,
122
+ hoverTime,
123
+ hoverPosition,
124
+ handlePointerDown,
125
+ handlePointerMove,
126
+ handlePointerUp,
127
+ handlePointerLeave
128
+ };
129
+ }
130
+ function ProgressBarHeadlessBase({
131
+ currentTime,
132
+ duration,
133
+ buffered = 0,
134
+ seekable = false,
135
+ className,
136
+ onSeek,
137
+ onSeekStart,
138
+ onSeekEnd,
139
+ showTime = false,
140
+ showTooltip,
141
+ minimal = false,
142
+ autoHide = true,
143
+ visible,
144
+ fillRef: externalFillRef,
145
+ bufferedRef: externalBufferedRef,
146
+ handleRef: externalHandleRef,
147
+ currentTimeRef: externalCurrentTimeRef,
148
+ durationRef: externalDurationRef
149
+ }) {
150
+ useInsertionEffect(() => {
151
+ return injectComponentCSS("progress-bar", PROGRESS_BAR_CSS);
152
+ }, []);
153
+ const refs = useProgressBarRefs({
154
+ externalFillRef,
155
+ externalBufferedRef,
156
+ externalHandleRef,
157
+ externalCurrentTimeRef,
158
+ externalDurationRef
159
+ });
160
+ const progress = useMemo(() => calculateProgress(currentTime, duration), [currentTime, duration]);
161
+ const bufferedPercent = useMemo(() => Math.min(100, Math.max(0, buffered * 100)), [buffered]);
162
+ const isSeekable = seekable && !!onSeek && duration > 0;
163
+ const effectiveShowTooltip = showTooltip ?? isSeekable;
164
+ const {
165
+ isSeeking,
166
+ hoverTime,
167
+ hoverPosition,
168
+ handlePointerDown,
169
+ handlePointerMove,
170
+ handlePointerUp,
171
+ handlePointerLeave
172
+ } = useSeekHandlers({
173
+ containerRef: refs.containerRef,
174
+ duration,
175
+ isSeekable,
176
+ onSeek,
177
+ onSeekStart,
178
+ onSeekEnd
179
+ });
180
+ useEffect(() => {
181
+ if (!refs.hasExternalCurrentTimeRef && refs.currentTimeRef.current) {
182
+ refs.currentTimeRef.current.textContent = formatTime(currentTime);
183
+ }
184
+ }, [currentTime, refs]);
185
+ useEffect(() => {
186
+ if (!refs.hasExternalDurationRef && refs.durationRef.current) {
187
+ refs.durationRef.current.textContent = formatTime(duration);
188
+ }
189
+ }, [duration, refs]);
190
+ const stopBubble = useCallback((e) => {
191
+ e.stopPropagation();
192
+ }, []);
193
+ const isHidden = visible !== void 0 ? !visible : autoHide && !isSeeking && hoverTime === null;
194
+ return /* @__PURE__ */ jsxs(
195
+ "div",
196
+ {
197
+ className: clsx2(
198
+ CSS_PREFIX,
199
+ !isSeekable && `${CSS_PREFIX}--disabled`,
200
+ isSeeking && `${CSS_PREFIX}--seeking`,
201
+ minimal && `${CSS_PREFIX}--minimal`,
202
+ autoHide && `${CSS_PREFIX}--auto-hide`,
203
+ isHidden && `${CSS_PREFIX}--hidden`,
204
+ className
205
+ ),
206
+ onClick: stopBubble,
207
+ onKeyDown: stopBubble,
208
+ onPointerDown: stopBubble,
209
+ onPointerUp: stopBubble,
210
+ onTouchStart: stopBubble,
211
+ onTouchEnd: stopBubble,
212
+ children: [
213
+ /* @__PURE__ */ jsxs("div", { className: `${CSS_PREFIX}__track-wrapper`, children: [
214
+ /* @__PURE__ */ jsxs(
215
+ "div",
216
+ {
217
+ ref: refs.containerRef,
218
+ className: `${CSS_PREFIX}__track`,
219
+ onPointerDown: handlePointerDown,
220
+ onPointerMove: handlePointerMove,
221
+ onPointerUp: handlePointerUp,
222
+ onPointerLeave: handlePointerLeave,
223
+ onClick: (e) => e.stopPropagation(),
224
+ onKeyDown: (e) => e.stopPropagation(),
225
+ role: isSeekable ? "slider" : "progressbar",
226
+ "aria-label": "Video progress",
227
+ "aria-valuemin": 0,
228
+ "aria-valuemax": duration || 100,
229
+ "aria-valuenow": currentTime,
230
+ "aria-valuetext": `${formatTime(currentTime)} of ${formatTime(duration)}`,
231
+ tabIndex: isSeekable ? 0 : -1,
232
+ children: [
233
+ /* @__PURE__ */ jsx(
234
+ "div",
235
+ {
236
+ ref: refs.bufferedRef,
237
+ className: `${CSS_PREFIX}__buffered`,
238
+ style: { transform: `scaleX(${bufferedPercent / 100})` },
239
+ "aria-hidden": "true"
240
+ }
241
+ ),
242
+ /* @__PURE__ */ jsx(
243
+ "div",
244
+ {
245
+ ref: refs.fillRef,
246
+ className: `${CSS_PREFIX}__fill`,
247
+ style: { transform: `scaleX(${progress / 100})` },
248
+ "aria-hidden": "true"
249
+ }
250
+ ),
251
+ isSeekable && !minimal && /* @__PURE__ */ jsx(
252
+ "div",
253
+ {
254
+ ref: refs.handleRef,
255
+ className: `${CSS_PREFIX}__handle`,
256
+ style: { left: `${progress}%` },
257
+ "aria-hidden": "true"
258
+ }
259
+ )
260
+ ]
261
+ }
262
+ ),
263
+ effectiveShowTooltip && hoverTime !== null && /* @__PURE__ */ jsx(
264
+ "div",
265
+ {
266
+ ref: refs.tooltipRef,
267
+ className: `${CSS_PREFIX}__tooltip`,
268
+ style: { left: `${hoverPosition}%` },
269
+ "aria-hidden": "true",
270
+ children: formatTime(hoverTime)
271
+ }
272
+ )
273
+ ] }),
274
+ showTime && /* @__PURE__ */ jsxs("div", { className: `${CSS_PREFIX}__time`, children: [
275
+ /* @__PURE__ */ jsx("span", { ref: refs.currentTimeRef, className: `${CSS_PREFIX}__time-current`, children: formatTime(currentTime) }),
276
+ /* @__PURE__ */ jsx("span", { ref: refs.durationRef, className: `${CSS_PREFIX}__time-duration`, children: formatTime(duration) })
277
+ ] })
278
+ ]
279
+ }
280
+ );
281
+ }
282
+ var ProgressBarHeadless = memo(ProgressBarHeadlessBase);
283
+ ProgressBarHeadless.displayName = "ProgressBarHeadless";
284
+
285
+ export { PROGRESS_BAR_CSS, ProgressBarHeadless, calculateProgress, formatTime };