@xhub-short/ui 0.1.0-beta.8 → 1.0.0-beta.18

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 (75) hide show
  1. package/dist/CommentSheet.css-DuBy01rU.d.ts +219 -0
  2. package/dist/VideoSlotPlayIndicator-DPs8Xt5C.d.ts +51 -0
  3. package/dist/chunk-3OB3OVYR.js +349 -0
  4. package/dist/chunk-4RIMQOBR.js +58 -0
  5. package/dist/chunk-5MKYDI4X.js +1 -0
  6. package/dist/chunk-5Y43HNRG.js +296 -0
  7. package/dist/chunk-7WXAQHJI.js +350 -0
  8. package/dist/chunk-BADA7OLG.js +564 -0
  9. package/dist/chunk-BEJAJFV6.js +191 -0
  10. package/dist/chunk-BNI7CYRI.js +334 -0
  11. package/dist/{chunk-UPCVSGWH.js → chunk-CAWE42LH.js} +5 -2
  12. package/dist/chunk-DGKMO3AE.js +717 -0
  13. package/dist/chunk-DR7KR7OT.js +103 -0
  14. package/dist/chunk-GSNIZ6DF.js +605 -0
  15. package/dist/chunk-HXQPEZRG.js +105 -0
  16. package/dist/chunk-IC2KUU4V.js +1264 -0
  17. package/dist/chunk-IWSBYOSS.js +91 -0
  18. package/dist/chunk-MFJS65C5.js +368 -0
  19. package/dist/{chunk-CXPNPSF7.js → chunk-NJXIYSDZ.js} +12 -1
  20. package/dist/{chunk-NRQXKZO3.js → chunk-OM4L7RE5.js} +12 -2
  21. package/dist/chunk-QCRRF76W.js +75 -0
  22. package/dist/chunk-QUEJHA24.js +508 -0
  23. package/dist/chunk-UYBQTE4M.js +337 -0
  24. package/dist/chunk-VJ744W5N.js +603 -0
  25. package/dist/chunk-VXW7AOGM.js +285 -0
  26. package/dist/{chunk-OQ7P5XC7.js → chunk-YB7AXTX7.js} +1 -1
  27. package/dist/components/ActionBar/index.d.ts +7 -2
  28. package/dist/components/ActionBar/index.js +1 -1
  29. package/dist/components/AdvanceMenu/index.d.ts +80 -0
  30. package/dist/components/AdvanceMenu/index.js +1 -0
  31. package/dist/components/ArticleSlot/index.d.ts +213 -0
  32. package/dist/components/ArticleSlot/index.js +1 -0
  33. package/dist/components/AuthorInfo/index.js +1 -1
  34. package/dist/components/BottomSheet/index.d.ts +87 -0
  35. package/dist/components/BottomSheet/index.js +1 -0
  36. package/dist/components/CleanModeOverlay/index.d.ts +60 -0
  37. package/dist/components/CleanModeOverlay/index.js +1 -0
  38. package/dist/components/CommentSheet/index.d.ts +155 -3
  39. package/dist/components/CommentSheet/index.js +1 -1
  40. package/dist/components/DetailView/index.d.ts +314 -0
  41. package/dist/components/DetailView/index.js +1 -0
  42. package/dist/components/ErrorBoundary/index.js +1 -1
  43. package/dist/components/{VideoFeed → Feed}/index.d.ts +64 -45
  44. package/dist/components/Feed/index.js +1 -0
  45. package/dist/components/ImageCarousel/index.d.ts +50 -0
  46. package/dist/components/ImageCarousel/index.js +1 -0
  47. package/dist/components/Playlist/index.d.ts +117 -0
  48. package/dist/components/Playlist/index.js +1 -0
  49. package/dist/components/ProgressBar/index.js +1 -1
  50. package/dist/components/QualityPicker/index.d.ts +35 -0
  51. package/dist/components/QualityPicker/index.js +1 -0
  52. package/dist/components/ReportSheet/index.d.ts +74 -0
  53. package/dist/components/ReportSheet/index.js +1 -0
  54. package/dist/components/Skeleton/index.js +1 -1
  55. package/dist/components/SpeedPicker/index.d.ts +32 -0
  56. package/dist/components/SpeedPicker/index.js +1 -0
  57. package/dist/components/VideoInfo/index.d.ts +7 -3
  58. package/dist/components/VideoInfo/index.js +1 -1
  59. package/dist/components/VideoPlayer/index.js +1 -1
  60. package/dist/components/VideoSlot/index.d.ts +31 -68
  61. package/dist/components/VideoSlot/index.js +2 -1
  62. package/dist/components/VirtualSlider/index.js +1 -1
  63. package/dist/index.d.ts +74 -11
  64. package/dist/index.js +39 -15
  65. package/package.json +8 -4
  66. package/dist/CommentSheet.css-BD6XbpU2.d.ts +0 -207
  67. package/dist/chunk-EBAMBI3O.js +0 -571
  68. package/dist/chunk-K3CETRCY.js +0 -737
  69. package/dist/chunk-PGHLVKXS.js +0 -148
  70. package/dist/chunk-QF7O26KZ.js +0 -357
  71. package/dist/chunk-RKS7YA7Z.js +0 -562
  72. package/dist/chunk-T4RQWGRY.js +0 -1519
  73. package/dist/chunk-UXNIXHII.js +0 -2040
  74. package/dist/chunk-YWAPI7JO.js +0 -204
  75. package/dist/components/VideoFeed/index.js +0 -1
@@ -0,0 +1,103 @@
1
+ import { clsx } from 'clsx';
2
+ import { memo, useEffect, useCallback } from 'react';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/QualityPicker/QualityPickerHeadless.tsx
6
+
7
+ // src/components/QualityPicker/QualityPicker.css.ts
8
+ var QUALITY_PICKER_CSS = `.sv-quality-picker{--sv-quality-picker-bg:rgba(28,28,30,.95);--sv-quality-picker-text:#fff;--sv-quality-picker-text-secondary:rgba(255,255,255,.6);--sv-quality-picker-selected:#007aff;--sv-quality-picker-item-hover:rgba(255,255,255,.1);--sv-quality-picker-check:#007aff;--sv-quality-picker-badge:rgba(255,255,255,.15);--sv-quality-picker-item-height:48px;--sv-quality-picker-radius:12px;--sv-quality-picker-padding:8px}.sv-quality-picker{padding:var(--sv-quality-picker-padding)}.sv-quality-picker-title{padding:8px 16px;font-size:14px;font-weight:600;color:var(--sv-quality-picker-text-secondary);text-align:center}.sv-quality-picker-options{display:flex;flex-direction:column;gap:2px}.sv-quality-picker-option{display:flex;align-items:center;gap:12px;height:var(--sv-quality-picker-item-height);padding:0 16px;border:0;background:transparent;color:var(--sv-quality-picker-text);font-size:16px;font-weight:normal;cursor:pointer;border-radius:var(--sv-quality-picker-radius);transition:background-color 150ms ease;-webkit-tap-highlight-color:transparent}.sv-quality-picker-option:hover{background:var(--sv-quality-picker-item-hover)}.sv-quality-picker-option[data-selected="true"]{color:var(--sv-quality-picker-selected);font-weight:500}.sv-quality-picker-option-label{flex:1;display:flex;align-items:center;gap:8px}.sv-quality-picker-option-badge{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;padding:2px 6px;background:var(--sv-quality-picker-badge);border-radius:4px;color:var(--sv-quality-picker-text-secondary)}.sv-quality-picker-option[data-selected="true"] .sv-quality-picker-option-badge{background:var(--sv-quality-picker-selected);color:#fff}.sv-quality-picker-option-check{width:20px;height:20px;color:var(--sv-quality-picker-check);opacity:0;transition:opacity 150ms ease}.sv-quality-picker-option[data-selected="true"] .sv-quality-picker-option-check{opacity:1}.sv-quality-picker-empty{padding:24px 16px;text-align:center;color:var(--sv-quality-picker-text-secondary);font-size:14px}`;
9
+ var cssInjected = false;
10
+ function injectCSS() {
11
+ if (cssInjected || typeof document === "undefined") return;
12
+ const styleId = "sv-quality-picker-styles";
13
+ if (!document.getElementById(styleId)) {
14
+ const style = document.createElement("style");
15
+ style.id = styleId;
16
+ style.textContent = QUALITY_PICKER_CSS;
17
+ document.head.appendChild(style);
18
+ }
19
+ cssInjected = true;
20
+ }
21
+ function CheckIcon() {
22
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) });
23
+ }
24
+ function getQualityBadge(height) {
25
+ if (height >= 2160) return "4K";
26
+ if (height >= 1080) return "FHD";
27
+ if (height >= 720) return "HD";
28
+ return null;
29
+ }
30
+ function formatQualityLabel(level) {
31
+ return `${level.height}p`;
32
+ }
33
+ function QualityPickerHeadlessComponent({
34
+ quality,
35
+ levels,
36
+ onQualityChange,
37
+ title = "Quality",
38
+ className,
39
+ onClose,
40
+ autoClose = true,
41
+ showAuto = true,
42
+ autoLabel = "Auto",
43
+ emptyMessage = "No quality options available"
44
+ }) {
45
+ useEffect(() => {
46
+ injectCSS();
47
+ }, []);
48
+ const handleSelect = useCallback(
49
+ (level) => {
50
+ onQualityChange(level);
51
+ if (autoClose && onClose) {
52
+ onClose();
53
+ }
54
+ },
55
+ [onQualityChange, autoClose, onClose]
56
+ );
57
+ const sortedLevels = [...levels].sort((a, b) => b.height - a.height);
58
+ const isEmpty = sortedLevels.length === 0;
59
+ return /* @__PURE__ */ jsxs("div", { className: clsx("sv-quality-picker", className), "aria-label": title, children: [
60
+ title && /* @__PURE__ */ jsx("div", { className: "sv-quality-picker-title", children: title }),
61
+ isEmpty ? /* @__PURE__ */ jsx("div", { className: "sv-quality-picker-empty", children: emptyMessage }) : /* @__PURE__ */ jsxs("div", { className: "sv-quality-picker-options", children: [
62
+ showAuto && /* @__PURE__ */ jsxs(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ className: "sv-quality-picker-option",
67
+ "data-selected": quality === -1,
68
+ onClick: () => handleSelect(-1),
69
+ "aria-selected": quality === -1,
70
+ children: [
71
+ /* @__PURE__ */ jsx("span", { className: "sv-quality-picker-option-label", children: autoLabel }),
72
+ /* @__PURE__ */ jsx("span", { className: "sv-quality-picker-option-check", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
73
+ ]
74
+ }
75
+ ),
76
+ sortedLevels.map((level, index) => {
77
+ const isSelected = quality === index;
78
+ const badge = getQualityBadge(level.height);
79
+ return /* @__PURE__ */ jsxs(
80
+ "button",
81
+ {
82
+ type: "button",
83
+ className: "sv-quality-picker-option",
84
+ "data-selected": isSelected,
85
+ onClick: () => handleSelect(index),
86
+ "aria-selected": isSelected,
87
+ children: [
88
+ /* @__PURE__ */ jsxs("span", { className: "sv-quality-picker-option-label", children: [
89
+ formatQualityLabel(level),
90
+ badge && /* @__PURE__ */ jsx("span", { className: "sv-quality-picker-option-badge", children: badge })
91
+ ] }),
92
+ /* @__PURE__ */ jsx("span", { className: "sv-quality-picker-option-check", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
93
+ ]
94
+ },
95
+ level.height
96
+ );
97
+ })
98
+ ] })
99
+ ] });
100
+ }
101
+ var QualityPickerHeadless = memo(QualityPickerHeadlessComponent);
102
+
103
+ export { QUALITY_PICKER_CSS, QualityPickerHeadless };