@lobehub/ui 6.0.0-beta.1 → 6.0.0-beta.3

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 (117) hide show
  1. package/README.md +3 -1
  2. package/es/Accordion/style.d.mts +1 -1
  3. package/es/ActionIcon/type.d.mts +1 -0
  4. package/es/Alert/type.d.mts +1 -0
  5. package/es/AutoComplete/style.d.mts +2 -1
  6. package/es/AutoComplete/type.d.mts +1 -0
  7. package/es/Button/type.d.mts +1 -0
  8. package/es/Checkbox/type.d.mts +1 -0
  9. package/es/ColorSwatches/type.d.mts +1 -0
  10. package/es/Drawer/atoms.d.mts +1 -0
  11. package/es/Drawer/constants.d.mts +1 -0
  12. package/es/FileTypeIcon/type.d.mts +1 -0
  13. package/es/Form/type.d.mts +1 -0
  14. package/es/GroupAvatar/type.d.mts +1 -0
  15. package/es/Highlighter/const.d.mts +1 -0
  16. package/es/Input/style.d.mts +1 -0
  17. package/es/Input/type.d.mts +1 -0
  18. package/es/Markdown/plugins/remarkColor.d.mts +1 -0
  19. package/es/Markdown/plugins/remarkGfmPlus.d.mts +1 -0
  20. package/es/Markdown/plugins/remarkVideo.d.mts +1 -0
  21. package/es/Mermaid/const.d.mts +1 -0
  22. package/es/Modal/atoms.d.mts +1 -0
  23. package/es/Modal/constants.d.mts +1 -0
  24. package/es/Modal/type.d.mts +1 -0
  25. package/es/Radio/type.d.mts +1 -0
  26. package/es/Segmented/atoms.d.mts +1 -0
  27. package/es/Slider/type.d.mts +1 -0
  28. package/es/Switch/atoms.d.mts +1 -0
  29. package/es/Text/style.d.mts +2 -1
  30. package/es/ToggleGroup/atoms.d.mts +1 -0
  31. package/es/Video/Video.mjs +46 -0
  32. package/es/Video/Video.mjs.map +1 -0
  33. package/es/Video/context.mjs +14 -0
  34. package/es/Video/context.mjs.map +1 -0
  35. package/es/Video/index.d.mts +23 -39
  36. package/es/Video/index.mjs +21 -111
  37. package/es/Video/index.mjs.map +1 -1
  38. package/es/Video/parts/Caption.d.mts +9 -0
  39. package/es/Video/parts/Caption.mjs +34 -0
  40. package/es/Video/parts/Caption.mjs.map +1 -0
  41. package/es/Video/parts/CenterPlay.d.mts +8 -0
  42. package/es/Video/parts/CenterPlay.mjs +34 -0
  43. package/es/Video/parts/CenterPlay.mjs.map +1 -0
  44. package/es/Video/parts/Controls.d.mts +9 -0
  45. package/es/Video/parts/Controls.mjs +123 -0
  46. package/es/Video/parts/Controls.mjs.map +1 -0
  47. package/es/Video/parts/Frame.d.mts +9 -0
  48. package/es/Video/parts/Frame.mjs +94 -0
  49. package/es/Video/parts/Frame.mjs.map +1 -0
  50. package/es/Video/parts/HoverPreview.mjs +93 -0
  51. package/es/Video/parts/HoverPreview.mjs.map +1 -0
  52. package/es/Video/parts/LoadError.d.mts +8 -0
  53. package/es/Video/parts/LoadError.mjs +47 -0
  54. package/es/Video/parts/LoadError.mjs.map +1 -0
  55. package/es/Video/parts/PlayPauseIcon.mjs +48 -0
  56. package/es/Video/parts/PlayPauseIcon.mjs.map +1 -0
  57. package/es/Video/parts/RateMenu.mjs +48 -0
  58. package/es/Video/parts/RateMenu.mjs.map +1 -0
  59. package/es/Video/parts/Root.d.mts +9 -0
  60. package/es/Video/parts/Root.mjs +110 -0
  61. package/es/Video/parts/Root.mjs.map +1 -0
  62. package/es/Video/parts/SectionList.d.mts +9 -0
  63. package/es/Video/parts/SectionList.mjs +32 -0
  64. package/es/Video/parts/SectionList.mjs.map +1 -0
  65. package/es/Video/parts/SectionMenu.mjs +63 -0
  66. package/es/Video/parts/SectionMenu.mjs.map +1 -0
  67. package/es/Video/parts/Timeline.d.mts +9 -0
  68. package/es/Video/parts/Timeline.mjs +169 -0
  69. package/es/Video/parts/Timeline.mjs.map +1 -0
  70. package/es/Video/store.mjs +241 -0
  71. package/es/Video/store.mjs.map +1 -0
  72. package/es/Video/style.mjs +393 -23
  73. package/es/Video/style.mjs.map +1 -1
  74. package/es/Video/time.mjs +60 -0
  75. package/es/Video/time.mjs.map +1 -0
  76. package/es/Video/type.d.mts +125 -0
  77. package/es/Video/useControlsIdle.mjs +39 -0
  78. package/es/Video/useControlsIdle.mjs.map +1 -0
  79. package/es/Video/useFullscreen.mjs +17 -0
  80. package/es/Video/useFullscreen.mjs.map +1 -0
  81. package/es/Video/useKeyboard.mjs +60 -0
  82. package/es/Video/useKeyboard.mjs.map +1 -0
  83. package/es/Video/useVideo.d.mts +9 -0
  84. package/es/Video/useVideo.mjs +17 -0
  85. package/es/Video/useVideo.mjs.map +1 -0
  86. package/es/color/types.d.mts +1 -0
  87. package/es/hooks/useMarkdown/utils.d.mts +1 -0
  88. package/es/i18n/resources/en/index.d.mts +3 -2
  89. package/es/i18n/resources/en/index.mjs +4 -2
  90. package/es/i18n/resources/en/index.mjs.map +1 -1
  91. package/es/i18n/resources/en/video.d.mts +23 -0
  92. package/es/i18n/resources/en/video.mjs +24 -0
  93. package/es/i18n/resources/en/video.mjs.map +1 -0
  94. package/es/i18n/resources/zhCn/index.d.mts +3 -2
  95. package/es/i18n/resources/zhCn/index.mjs +4 -2
  96. package/es/i18n/resources/zhCn/index.mjs.map +1 -1
  97. package/es/i18n/resources/zhCn/video.d.mts +23 -0
  98. package/es/i18n/resources/zhCn/video.mjs +24 -0
  99. package/es/i18n/resources/zhCn/video.mjs.map +1 -0
  100. package/es/i18n/types.d.mts +3 -1
  101. package/es/index.d.mts +4 -2
  102. package/es/index.mjs +2 -1
  103. package/es/internal/menu/itemInterface.d.mts +1 -0
  104. package/es/internal/menu/renderUtils.d.mts +1 -0
  105. package/es/mdx/mdxComponents/Video.d.mts +2 -1
  106. package/es/mdx/mdxComponents/Video.mjs +5 -3
  107. package/es/mdx/mdxComponents/Video.mjs.map +1 -1
  108. package/es/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.mts +1 -0
  109. package/es/node_modules/.pnpm/eslint@10.12.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.mts +1 -0
  110. package/es/style.css +263 -23
  111. package/es/styles/createGlobalStyle.d.mts +1 -0
  112. package/es/styles/theme/generateColorPalette.d.mts +1 -0
  113. package/es/styles/theme/scope.d.mts +1 -0
  114. package/es/types/customToken.d.mts +1 -0
  115. package/package.json +5 -5
  116. package/es/Video/marker.stylex.mjs +0 -9
  117. package/es/Video/marker.stylex.mjs.map +0 -1
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { useTranslation } from "../../i18n/useTranslation.mjs";
4
+ import { useVideoContext } from "../context.mjs";
5
+ import { styles } from "../style.mjs";
6
+ import { useVideo } from "../useVideo.mjs";
7
+ import video_default from "../../i18n/resources/en/video.mjs";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { Play } from "lucide-react";
10
+ //#region src/Video/parts/CenterPlay.tsx
11
+ const CenterPlay = () => {
12
+ const { store } = useVideoContext();
13
+ const { t } = useTranslation(video_default);
14
+ if (!useVideo((state) => state.paused && state.status === "ready" && state.time < .05)) return null;
15
+ return /* @__PURE__ */ jsx("button", {
16
+ "aria-label": t("video.play"),
17
+ type: "button",
18
+ ...styleProps(styles.centerPlay),
19
+ onClick: (event) => {
20
+ event.stopPropagation();
21
+ store.play();
22
+ },
23
+ children: /* @__PURE__ */ jsx(Play, {
24
+ fill: "currentColor",
25
+ size: 24,
26
+ strokeWidth: 0
27
+ })
28
+ });
29
+ };
30
+ CenterPlay.displayName = "VideoCenterPlay";
31
+ //#endregion
32
+ export { CenterPlay as default };
33
+
34
+ //# sourceMappingURL=CenterPlay.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CenterPlay.mjs","names":["videoMessages"],"sources":["../../../src/Video/parts/CenterPlay.tsx"],"sourcesContent":["'use client';\n\nimport { Play } from 'lucide-react';\n\nimport videoMessages from '@/i18n/resources/en/video';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { useVideoContext } from '../context';\nimport { styles } from '../style';\nimport { useVideo } from '../useVideo';\n\nconst CenterPlay = () => {\n const { store } = useVideoContext();\n const { t } = useTranslation(videoMessages);\n const show = useVideo((state) => state.paused && state.status === 'ready' && state.time < 0.05);\n if (!show) return null;\n\n return (\n <button\n aria-label={t('video.play')}\n type=\"button\"\n {...styleProps(styles.centerPlay)}\n onClick={(event) => {\n event.stopPropagation();\n void store.play();\n }}\n >\n <Play fill=\"currentColor\" size={24} strokeWidth={0} />\n </button>\n );\n};\n\nCenterPlay.displayName = 'VideoCenterPlay';\n\nexport default CenterPlay;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,mBAAmB;CACvB,MAAM,EAAE,UAAU,gBAAgB;CAClC,MAAM,EAAE,MAAM,eAAeA,aAAa;CAE1C,IAAI,CADS,UAAU,UAAU,MAAM,UAAU,MAAM,WAAW,WAAW,MAAM,OAAO,GAClF,GAAG,OAAO;CAElB,OACE,oBAAC,UAAD;EACE,cAAY,EAAE,YAAY;EAC1B,MAAK;EACL,GAAI,WAAW,OAAO,UAAU;EAChC,UAAU,UAAU;GAClB,MAAM,gBAAgB;GACtB,MAAW,KAAK;EAClB;EAEA,UAAA,oBAAC,MAAD;GAAM,MAAK;GAAe,MAAM;GAAI,aAAa;EAAI,CAAA;CAC/C,CAAA;AAEZ;AAEA,WAAW,cAAc"}
@@ -0,0 +1,9 @@
1
+ import { VideoControlsProps } from "../type.mjs";
2
+ //#region src/Video/parts/Controls.d.ts
3
+ declare const Controls: {
4
+ ({ children, className, extra, frameStep, style }: VideoControlsProps): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ //#endregion
8
+ export { Controls as default };
9
+ //# sourceMappingURL=Controls.d.mts.map
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { useTranslation } from "../../i18n/useTranslation.mjs";
4
+ import { FrameContext, useVideoContext } from "../context.mjs";
5
+ import { styles } from "../style.mjs";
6
+ import { formatTime, frameOf } from "../time.mjs";
7
+ import { useVideo } from "../useVideo.mjs";
8
+ import video_default from "../../i18n/resources/en/video.mjs";
9
+ import { useFullscreen } from "../useFullscreen.mjs";
10
+ import PlayPauseIcon from "./PlayPauseIcon.mjs";
11
+ import RateMenu from "./RateMenu.mjs";
12
+ import SectionMenu from "./SectionMenu.mjs";
13
+ import Timeline from "./Timeline.mjs";
14
+ import { use } from "react";
15
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
+ import { Captions, ChevronLeft, ChevronRight, Maximize, Minimize, Volume2, VolumeX } from "lucide-react";
17
+ //#region src/Video/parts/Controls.tsx
18
+ const BarButton = ({ active, children, label, onClick, pressed, shortcut }) => /* @__PURE__ */ jsx("button", {
19
+ "aria-label": label,
20
+ "aria-pressed": pressed,
21
+ title: shortcut ? `${label} (${shortcut})` : label,
22
+ type: "button",
23
+ ...styleProps([styles.barButton, active && styles.barButtonActive]),
24
+ onClick,
25
+ children
26
+ });
27
+ const TimeReadout = () => {
28
+ const seconds = useVideo((state) => Math.floor(state.time));
29
+ const duration = useVideo((state) => state.duration);
30
+ return /* @__PURE__ */ jsx("span", {
31
+ ...styleProps(styles.time, void 0, { marginInline: 6 }),
32
+ children: `${formatTime(seconds)} / ${formatTime(duration)}`
33
+ });
34
+ };
35
+ const FrameReadout = () => {
36
+ const { config } = useVideoContext();
37
+ const { t } = useTranslation(video_default);
38
+ const frame = useVideo((state) => frameOf(state.time, config.fps));
39
+ return /* @__PURE__ */ jsx("span", {
40
+ ...styleProps(styles.frameNo, void 0, { marginInlineEnd: 6 }),
41
+ children: `${t("video.frame")} ${frame}`
42
+ });
43
+ };
44
+ const Controls = ({ children, className, extra, frameStep, style }) => {
45
+ const { config, store } = useVideoContext();
46
+ const frame = use(FrameContext);
47
+ const { t } = useTranslation(video_default);
48
+ const paused = useVideo((state) => state.paused);
49
+ const muted = useVideo((state) => state.muted);
50
+ const captions = useVideo((state) => state.captions);
51
+ const ready = useVideo((state) => state.status === "ready");
52
+ const fullscreen = useFullscreen(store);
53
+ const overlay = frame !== null;
54
+ const visible = !overlay || frame.visible;
55
+ const hasCaptions = config.markers.some((marker) => marker.content !== void 0 && marker.content !== null);
56
+ return /* @__PURE__ */ jsx("div", {
57
+ "data-video-controls": "",
58
+ "data-visible": String(visible),
59
+ ...styleProps([
60
+ styles.controls,
61
+ overlay ? styles.controlsOverlay : styles.controlsBelow,
62
+ overlay && !visible && styles.controlsHidden
63
+ ], className, style),
64
+ onClick: (event) => event.stopPropagation(),
65
+ onDoubleClick: (event) => event.stopPropagation(),
66
+ children: /* @__PURE__ */ jsxs("div", {
67
+ ...styleProps(!ready && styles.disabled),
68
+ children: [children ?? /* @__PURE__ */ jsx(Timeline, {}), /* @__PURE__ */ jsxs("div", {
69
+ ...styleProps(styles.row),
70
+ children: [
71
+ /* @__PURE__ */ jsx(BarButton, {
72
+ label: paused ? t("video.play") : t("video.pause"),
73
+ shortcut: "K",
74
+ onClick: store.toggle,
75
+ children: /* @__PURE__ */ jsx(PlayPauseIcon, { paused })
76
+ }),
77
+ /* @__PURE__ */ jsx(BarButton, {
78
+ label: muted ? t("video.unmute") : t("video.mute"),
79
+ shortcut: "M",
80
+ onClick: store.toggleMute,
81
+ children: muted ? /* @__PURE__ */ jsx(VolumeX, { size: 16 }) : /* @__PURE__ */ jsx(Volume2, { size: 16 })
82
+ }),
83
+ frameStep && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BarButton, {
84
+ label: t("video.previousFrame"),
85
+ shortcut: ",",
86
+ onClick: () => store.step(-1),
87
+ children: /* @__PURE__ */ jsx(ChevronLeft, { size: 16 })
88
+ }), /* @__PURE__ */ jsx(BarButton, {
89
+ label: t("video.nextFrame"),
90
+ shortcut: ".",
91
+ onClick: () => store.step(1),
92
+ children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
93
+ })] }),
94
+ /* @__PURE__ */ jsx(TimeReadout, {}),
95
+ frameStep && /* @__PURE__ */ jsx(FrameReadout, {}),
96
+ /* @__PURE__ */ jsx(SectionMenu, {}),
97
+ /* @__PURE__ */ jsx("div", { ...styleProps(styles.spacer) }),
98
+ extra,
99
+ hasCaptions && /* @__PURE__ */ jsx(BarButton, {
100
+ active: captions,
101
+ label: captions ? t("video.captionsHide") : t("video.captionsShow"),
102
+ pressed: captions,
103
+ shortcut: "C",
104
+ onClick: () => store.setCaptions(!captions),
105
+ children: /* @__PURE__ */ jsx(Captions, { size: 16 })
106
+ }),
107
+ /* @__PURE__ */ jsx(RateMenu, {}),
108
+ /* @__PURE__ */ jsx(BarButton, {
109
+ label: fullscreen ? t("video.exitFullscreen") : t("video.fullscreen"),
110
+ shortcut: "F",
111
+ onClick: store.toggleFullscreen,
112
+ children: fullscreen ? /* @__PURE__ */ jsx(Minimize, { size: 15 }) : /* @__PURE__ */ jsx(Maximize, { size: 15 })
113
+ })
114
+ ]
115
+ })]
116
+ })
117
+ });
118
+ };
119
+ Controls.displayName = "VideoControls";
120
+ //#endregion
121
+ export { Controls as default };
122
+
123
+ //# sourceMappingURL=Controls.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Controls.mjs","names":["videoMessages"],"sources":["../../../src/Video/parts/Controls.tsx"],"sourcesContent":["'use client';\n\nimport {\n Captions,\n ChevronLeft,\n ChevronRight,\n Maximize,\n Minimize,\n Volume2,\n VolumeX,\n} from 'lucide-react';\nimport { type ReactNode, use } from 'react';\n\nimport videoMessages from '@/i18n/resources/en/video';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { FrameContext, useVideoContext } from '../context';\nimport { styles } from '../style';\nimport { formatTime, frameOf } from '../time';\nimport type { VideoControlsProps } from '../type';\nimport { useFullscreen } from '../useFullscreen';\nimport { useVideo } from '../useVideo';\nimport PlayPauseIcon from './PlayPauseIcon';\nimport RateMenu from './RateMenu';\nimport SectionMenu from './SectionMenu';\nimport Timeline from './Timeline';\n\nconst BarButton = ({\n active,\n children,\n label,\n onClick,\n pressed,\n shortcut,\n}: {\n active?: boolean;\n children: ReactNode;\n label: string;\n onClick: () => void;\n pressed?: boolean;\n shortcut?: string;\n}) => (\n <button\n aria-label={label}\n aria-pressed={pressed}\n title={shortcut ? `${label} (${shortcut})` : label}\n type=\"button\"\n {...styleProps([styles.barButton, active && styles.barButtonActive])}\n onClick={onClick}\n >\n {children}\n </button>\n);\n\n// Leaves so playback re-renders only these, and the clock only once a second.\nconst TimeReadout = () => {\n const seconds = useVideo((state) => Math.floor(state.time));\n const duration = useVideo((state) => state.duration);\n return (\n <span {...styleProps(styles.time, undefined, { marginInline: 6 })}>\n {`${formatTime(seconds)} / ${formatTime(duration)}`}\n </span>\n );\n};\n\nconst FrameReadout = () => {\n const { config } = useVideoContext();\n const { t } = useTranslation(videoMessages);\n const frame = useVideo((state) => frameOf(state.time, config.fps));\n return (\n <span {...styleProps(styles.frameNo, undefined, { marginInlineEnd: 6 })}>\n {`${t('video.frame')} ${frame}`}\n </span>\n );\n};\n\nconst Controls = ({ children, className, extra, frameStep, style }: VideoControlsProps) => {\n const { config, store } = useVideoContext();\n const frame = use(FrameContext);\n const { t } = useTranslation(videoMessages);\n const paused = useVideo((state) => state.paused);\n const muted = useVideo((state) => state.muted);\n const captions = useVideo((state) => state.captions);\n const ready = useVideo((state) => state.status === 'ready');\n const fullscreen = useFullscreen(store);\n const overlay = frame !== null;\n const visible = !overlay || frame.visible;\n const hasCaptions = config.markers.some(\n (marker) => marker.content !== undefined && marker.content !== null,\n );\n\n return (\n <div\n data-video-controls=\"\"\n data-visible={String(visible)}\n {...styleProps(\n [\n styles.controls,\n overlay ? styles.controlsOverlay : styles.controlsBelow,\n overlay && !visible && styles.controlsHidden,\n ],\n className,\n style,\n )}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n >\n <div {...styleProps(!ready && styles.disabled)}>\n {children ?? <Timeline />}\n <div {...styleProps(styles.row)}>\n <BarButton\n label={paused ? t('video.play') : t('video.pause')}\n shortcut=\"K\"\n onClick={store.toggle}\n >\n <PlayPauseIcon paused={paused} />\n </BarButton>\n <BarButton\n label={muted ? t('video.unmute') : t('video.mute')}\n shortcut=\"M\"\n onClick={store.toggleMute}\n >\n {muted ? <VolumeX size={16} /> : <Volume2 size={16} />}\n </BarButton>\n {frameStep && (\n <>\n <BarButton\n label={t('video.previousFrame')}\n shortcut=\",\"\n onClick={() => store.step(-1)}\n >\n <ChevronLeft size={16} />\n </BarButton>\n <BarButton label={t('video.nextFrame')} shortcut=\".\" onClick={() => store.step(1)}>\n <ChevronRight size={16} />\n </BarButton>\n </>\n )}\n <TimeReadout />\n {frameStep && <FrameReadout />}\n <SectionMenu />\n <div {...styleProps(styles.spacer)} />\n {extra}\n {hasCaptions && (\n <BarButton\n active={captions}\n label={captions ? t('video.captionsHide') : t('video.captionsShow')}\n pressed={captions}\n shortcut=\"C\"\n onClick={() => store.setCaptions(!captions)}\n >\n <Captions size={16} />\n </BarButton>\n )}\n <RateMenu />\n <BarButton\n label={fullscreen ? t('video.exitFullscreen') : t('video.fullscreen')}\n shortcut=\"F\"\n onClick={store.toggleFullscreen}\n >\n {fullscreen ? <Minimize size={15} /> : <Maximize size={15} />}\n </BarButton>\n </div>\n </div>\n </div>\n );\n};\n\nControls.displayName = 'VideoControls';\n\nexport default Controls;\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAM,aAAa,EACjB,QACA,UACA,OACA,SACA,SACA,eASA,oBAAC,UAAD;CACE,cAAY;CACZ,gBAAc;CACd,OAAO,WAAW,GAAG,MAAM,IAAI,SAAS,KAAK;CAC7C,MAAK;CACL,GAAI,WAAW,CAAC,OAAO,WAAW,UAAU,OAAO,eAAe,CAAC;CAC1D;CAER;AACK,CAAA;AAIV,MAAM,oBAAoB;CACxB,MAAM,UAAU,UAAU,UAAU,KAAK,MAAM,MAAM,IAAI,CAAC;CAC1D,MAAM,WAAW,UAAU,UAAU,MAAM,QAAQ;CACnD,OACE,oBAAC,QAAD;EAAM,G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A;KACZ,CAAA;KAEb,oBAAC,UAAD,CAAW,CAAA;KACX,oBAAC,WAAD;MACE,OAAO,aAAa,EAAE,sBAAsB,IAAI,EAAE,kBAAkB;MACpE,UAAS;MACT,SAAS,MAAM;MAEd,UAAA,aAAa,oBAAC,UAAD,EAAU,MAAM,GAAK,CAAA,IAAI,oBAAC,UAAD,EAAU,MAAM,GAAK,CAAA;KACnD,CAAA;IACR;GACF,CAAA,CAAA;;CACF,CAAA;AAET;AAEA,SAAS,cAAc"}
@@ -0,0 +1,9 @@
1
+ import { VideoFrameProps } from "../type.mjs";
2
+ //#region src/Video/parts/Frame.d.ts
3
+ declare const Frame: {
4
+ ({ children, className, style }: VideoFrameProps): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ //#endregion
8
+ export { Frame as default };
9
+ //# sourceMappingURL=Frame.d.mts.map
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { FrameContext, useVideoContext } from "../context.mjs";
4
+ import { styles } from "../style.mjs";
5
+ import { useVideo } from "../useVideo.mjs";
6
+ import { useControlsIdle } from "../useControlsIdle.mjs";
7
+ import { useEffect, useMemo, useRef } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/Video/parts/Frame.tsx
10
+ const isFocusVisible = (element) => {
11
+ try {
12
+ return element.matches(":focus-visible");
13
+ } catch {
14
+ return true;
15
+ }
16
+ };
17
+ const Frame = ({ children, className, style }) => {
18
+ const { media, store } = useVideoContext();
19
+ const videoRef = useRef(null);
20
+ const pointerTypeRef = useRef("mouse");
21
+ const size = useVideo((state) => state.size);
22
+ const idleForced = useVideo((state) => state.paused || state.status !== "ready");
23
+ const idle = useControlsIdle(idleForced);
24
+ useEffect(() => {
25
+ const video = videoRef.current;
26
+ if (!video) return;
27
+ return store.attach(video);
28
+ }, [store, media.src]);
29
+ const frame = useMemo(() => ({
30
+ hold: idle.hold,
31
+ visible: idle.visible
32
+ }), [idle.hold, idle.visible]);
33
+ const aspectRatio = size?.height ? `${size.width} / ${size.height}` : "16 / 9";
34
+ return /* @__PURE__ */ jsx(FrameContext, {
35
+ value: frame,
36
+ children: /* @__PURE__ */ jsxs("div", {
37
+ ...styleProps(styles.frame, className, {
38
+ aspectRatio,
39
+ ...style
40
+ }),
41
+ onBlur: (event) => {
42
+ if (!event.currentTarget.contains(event.relatedTarget)) idle.setFocused(false);
43
+ },
44
+ onFocus: (event) => {
45
+ idle.setFocused(isFocusVisible(event.target));
46
+ },
47
+ onPointerDownCapture: (event) => {
48
+ pointerTypeRef.current = event.pointerType || "mouse";
49
+ },
50
+ onPointerLeave: (event) => {
51
+ if (event.pointerType !== "touch") idle.sleep();
52
+ },
53
+ onPointerMove: (event) => {
54
+ if (event.pointerType !== "touch") idle.wake();
55
+ },
56
+ children: [
57
+ /* @__PURE__ */ jsx("video", {
58
+ playsInline: true,
59
+ autoPlay: media.autoPlay,
60
+ loop: media.loop,
61
+ poster: media.poster,
62
+ preload: media.preload,
63
+ ref: videoRef,
64
+ src: media.src,
65
+ onEnded: media.onEnded,
66
+ onError: media.onError,
67
+ onPause: media.onPause,
68
+ onPlay: media.onPlay,
69
+ onTimeUpdate: media.onTimeUpdate,
70
+ ...styleProps(styles.video)
71
+ }),
72
+ /* @__PURE__ */ jsx("div", {
73
+ "data-video-surface": "",
74
+ ...styleProps(styles.surface),
75
+ onDoubleClick: () => store.toggleFullscreen(),
76
+ onClick: () => {
77
+ if (pointerTypeRef.current === "touch" && !idle.visible) {
78
+ idle.wake();
79
+ return;
80
+ }
81
+ if (pointerTypeRef.current === "touch") idle.wake();
82
+ store.toggle();
83
+ }
84
+ }),
85
+ children
86
+ ]
87
+ })
88
+ });
89
+ };
90
+ Frame.displayName = "VideoFrame";
91
+ //#endregion
92
+ export { Frame as default };
93
+
94
+ //# sourceMappingURL=Frame.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Frame.mjs","names":[],"sources":["../../../src/Video/parts/Frame.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { FrameContext, type FrameContextValue, useVideoContext } from '../context';\nimport { styles } from '../style';\nimport type { VideoFrameProps } from '../type';\nimport { useControlsIdle } from '../useControlsIdle';\nimport { useVideo } from '../useVideo';\n\nconst isFocusVisible = (element: Element) => {\n try {\n return element.matches(':focus-visible');\n } catch {\n return true;\n }\n};\n\nconst Frame = ({ children, className, style }: VideoFrameProps) => {\n const { media, store } = useVideoContext();\n const videoRef = useRef<HTMLVideoElement>(null);\n const pointerTypeRef = useRef('mouse');\n const size = useVideo((state) => state.size);\n const idleForced = useVideo((state) => state.paused || state.status !== 'ready');\n const idle = useControlsIdle(idleForced);\n\n useEffect(() => {\n const video = videoRef.current;\n if (!video) return;\n return store.attach(video);\n }, [store, media.src]);\n\n const frame = useMemo<FrameContextValue>(\n () => ({ hold: idle.hold, visible: idle.visible }),\n [idle.hold, idle.visible],\n );\n\n const aspectRatio = size?.height ? `${size.width} / ${size.height}` : '16 / 9';\n\n return (\n <FrameContext value={frame}>\n <div\n {...styleProps(styles.frame, className, { aspectRatio, ...style })}\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null))\n idle.setFocused(false);\n }}\n onFocus={(event) => {\n idle.setFocused(isFocusVisible(event.target));\n }}\n onPointerDownCapture={(event) => {\n pointerTypeRef.current = event.pointerType || 'mouse';\n }}\n onPointerLeave={(event) => {\n if (event.pointerType !== 'touch') idle.sleep();\n }}\n onPointerMove={(event) => {\n if (event.pointerType !== 'touch') idle.wake();\n }}\n >\n <video\n playsInline\n autoPlay={media.autoPlay}\n loop={media.loop}\n poster={media.poster}\n preload={media.preload}\n ref={videoRef}\n src={media.src}\n onEnded={media.onEnded}\n onError={media.onError}\n onPause={media.onPause}\n onPlay={media.onPlay}\n onTimeUpdate={media.onTimeUpdate}\n {...styleProps(styles.video)}\n />\n <div\n data-video-surface=\"\"\n {...styleProps(styles.surface)}\n onDoubleClick={() => store.toggleFullscreen()}\n onClick={() => {\n if (pointerTypeRef.current === 'touch' && !idle.visible) {\n idle.wake();\n return;\n }\n if (pointerTypeRef.current === 'touch') idle.wake();\n store.toggle();\n }}\n />\n {children}\n </div>\n </FrameContext>\n );\n};\n\nFrame.displayName = 'VideoFrame';\n\nexport default Frame;\n"],"mappings":";;;;;;;;;AAYA,MAAM,kBAAkB,YAAqB;CAC3C,IAAI;EACF,OAAO,QAAQ,QAAQ,gBAAgB;CACzC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAM,SAAS,EAAE,UAAU,WAAW,YAA6B;CACjE,MAAM,EAAE,OAAO,UAAU,gBAAgB;CACzC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,iBAAiB,OAAO,OAAO;CACrC,MAAM,OAAO,UAAU,UAAU,MAAM,IAAI;CAC3C,MAAM,aAAa,UAAU,UAAU,MAAM,UAAU,MAAM,WAAW,OAAO;CAC/E,MAAM,OAAO,gBAAgB,UAAU;CAEvC,gBAAgB;EACd,MAAM,QAAQ,SAAS;EACvB,IAAI,CAAC,OAAO;EACZ,OAAO,MAAM,OAAO,KAAK;CAC3B,GAAG,CAAC,OAAO,MAAM,GAAG,CAAC;CAErB,MAAM,QAAQ,eACL;EAAE,MAAM,KAAK;EAAM,SAAS,KAAK;CAAQ,IAChD,CAAC,KAAK,MAAM,KAAK,OAAO,CAC1B;CAEA,MAAM,cAAc,MAAM,SAAS,GAAG,KAAK,MAAM,KAAK,KAAK,WAAW;CAEtE,OACE,oBAAC,cAAD;EAAc,OAAO;EACnB,UAAA,qBAAC,OAAD;GACE,GAAI,WAAW,OAAO,OAAO,WAAW;IAAE;IAAa,GAAG;GAAM,CAAC;GACjE,SAAS,UAAU;IACjB,IAAI,CAAC,MAAM,cAAc,SAAS,MAAM,aAA4B,GAClE,KAAK,WAAW,KAAK;GACzB;GACA,UAAU,UAAU;IAClB,KAAK,WAAW,eAAe,MAAM,MAAM,CAAC;GAC9C;GACA,uBAAuB,UAAU;IAC/B,eAAe,UAAU,MAAM,eAAe;GAChD;GACA,iBAAiB,UAAU;IACzB,IAAI,MAAM,gBAAgB,SAAS,KAAK,MAAM;GAChD;GACA,gBAAgB,UAAU;IACxB,IAAI,MAAM,gBAAgB,SAAS,KAAK,KAAK;GAC/C;GAjBF,UAAA;IAmBE,oBAAC,SAAD;KACE,aAAA;KACA,UAAU,MAAM;KAChB,MAAM,MAAM;KACZ,QAAQ,MAAM;KACd,SAAS,MAAM;KACf,KAAK;KACL,KAAK,MAAM;KACX,SAAS,MAAM;KACf,SAAS,MAAM;KACf,SAAS,MAAM;KACf,QAAQ,MAAM;KACd,cAAc,MAAM;KACpB,GAAI,WAAW,OAAO,KAAK;IAC5B,CAAA;IACD,oBAAC,OAAD;KACE,sBAAmB;KACnB,GAAI,WAAW,OAAO,OAAO;KAC7B,qBAAqB,MAAM,iBAAiB;KAC5C,eAAe;MACb,IAAI,eAAe,YAAY,WAAW,CAAC,KAAK,SAAS;OACvD,KAAK,KAAK;OACV;MACF;MACA,IAAI,eAAe,YAAY,SAAS,KAAK,KAAK;MAClD,MAAM,OAAO;KACf;IACD,CAAA;IACA;GACE;;CACO,CAAA;AAElB;AAEA,MAAM,cAAc"}
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { markerColor, styles } from "../style.mjs";
4
+ import { formatTime } from "../time.mjs";
5
+ import { useEffect, useRef } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/Video/parts/HoverPreview.tsx
8
+ const Thumbnail = ({ src, time }) => {
9
+ const canvasRef = useRef(null);
10
+ const probeRef = useRef(null);
11
+ const pendingRef = useRef(null);
12
+ const busyRef = useRef(false);
13
+ useEffect(() => {
14
+ const probe = probeRef.current;
15
+ if (!probe) return;
16
+ const paint = () => {
17
+ const canvas = canvasRef.current;
18
+ try {
19
+ canvas?.getContext("2d")?.drawImage(probe, 0, 0, canvas.width, canvas.height);
20
+ } catch {}
21
+ busyRef.current = false;
22
+ if (pendingRef.current === null) return;
23
+ busyRef.current = true;
24
+ probe.currentTime = pendingRef.current;
25
+ pendingRef.current = null;
26
+ };
27
+ const reset = () => {
28
+ busyRef.current = false;
29
+ };
30
+ probe.addEventListener("seeked", paint);
31
+ probe.addEventListener("error", reset);
32
+ return () => {
33
+ probe.removeEventListener("seeked", paint);
34
+ probe.removeEventListener("error", reset);
35
+ probe.removeAttribute("src");
36
+ probe.load?.();
37
+ };
38
+ }, []);
39
+ useEffect(() => {
40
+ const probe = probeRef.current;
41
+ if (!probe) return;
42
+ if (busyRef.current) {
43
+ pendingRef.current = time;
44
+ return;
45
+ }
46
+ busyRef.current = true;
47
+ probe.currentTime = time;
48
+ }, [time]);
49
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("video", {
50
+ muted: true,
51
+ playsInline: true,
52
+ preload: "auto",
53
+ ref: probeRef,
54
+ src,
55
+ style: { display: "none" }
56
+ }), /* @__PURE__ */ jsx("canvas", {
57
+ height: 99,
58
+ ref: canvasRef,
59
+ width: 176,
60
+ ...styleProps(styles.previewCanvas)
61
+ })] });
62
+ };
63
+ const HoverPreview = ({ marker, section, src, thumbnail, time, visible, x }) => /* @__PURE__ */ jsxs("div", {
64
+ ...styleProps(styles.preview, void 0, {
65
+ display: visible ? void 0 : "none",
66
+ left: x
67
+ }),
68
+ children: [
69
+ thumbnail && /* @__PURE__ */ jsx(Thumbnail, {
70
+ src,
71
+ time
72
+ }),
73
+ (section || marker) && /* @__PURE__ */ jsxs("div", {
74
+ ...styleProps(styles.previewLabel),
75
+ children: [section && /* @__PURE__ */ jsx("div", {
76
+ ...styleProps(styles.previewTitle),
77
+ children: section.title
78
+ }), marker && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { ...styleProps(styles.dot, void 0, {
79
+ background: markerColor(marker.color),
80
+ display: "inline-block",
81
+ marginInlineEnd: 6
82
+ }) }), marker.content ?? marker.label] })]
83
+ }),
84
+ /* @__PURE__ */ jsx("div", {
85
+ ...styleProps(styles.previewTime),
86
+ children: formatTime(time)
87
+ })
88
+ ]
89
+ });
90
+ //#endregion
91
+ export { HoverPreview as default };
92
+
93
+ //# sourceMappingURL=HoverPreview.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverPreview.mjs","names":[],"sources":["../../../src/Video/parts/HoverPreview.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { markerColor, styles } from '../style';\nimport { formatTime } from '../time';\nimport type { VideoMarker, VideoSection } from '../type';\n\nexport interface HoverPreviewProps {\n marker?: VideoMarker;\n section?: VideoSection;\n src: string;\n thumbnail: boolean;\n time: number;\n visible: boolean;\n x: number;\n}\n\n// The frame comes from a hidden second <video>: seeking the one on screen\n// would move the playhead the viewer is holding. Seeks queue so a fast sweep\n// paints the latest position instead of stalling on stale frames.\nconst Thumbnail = ({ src, time }: { src: string; time: number }) => {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const probeRef = useRef<HTMLVideoElement>(null);\n const pendingRef = useRef<number | null>(null);\n const busyRef = useRef(false);\n\n useEffect(() => {\n const probe = probeRef.current;\n if (!probe) return;\n const paint = () => {\n const canvas = canvasRef.current;\n try {\n canvas?.getContext('2d')?.drawImage(probe, 0, 0, canvas.width, canvas.height);\n } catch {\n // A frame that cannot be decoded yet leaves the previous paint in place.\n }\n busyRef.current = false;\n if (pendingRef.current === null) return;\n busyRef.current = true;\n probe.currentTime = pendingRef.current;\n pendingRef.current = null;\n };\n const reset = () => {\n busyRef.current = false;\n };\n probe.addEventListener('seeked', paint);\n probe.addEventListener('error', reset);\n return () => {\n probe.removeEventListener('seeked', paint);\n probe.removeEventListener('error', reset);\n // An unmounted element with a src keeps downloading until it is collected.\n probe.removeAttribute('src');\n probe.load?.();\n };\n }, []);\n\n useEffect(() => {\n const probe = probeRef.current;\n if (!probe) return;\n if (busyRef.current) {\n pendingRef.current = time;\n return;\n }\n busyRef.current = true;\n probe.currentTime = time;\n }, [time]);\n\n return (\n <>\n <video\n muted\n playsInline\n preload=\"auto\"\n ref={probeRef}\n src={src}\n style={{ display: 'none' }}\n />\n <canvas height={99} ref={canvasRef} width={176} {...styleProps(styles.previewCanvas)} />\n </>\n );\n};\n\nconst HoverPreview = ({ marker, section, src, thumbnail, time, visible, x }: HoverPreviewProps) => (\n <div\n {...styleProps(styles.preview, undefined, { display: visible ? undefined : 'none', left: x })}\n >\n {thumbnail && <Thumbnail src={src} time={time} />}\n {(section || marker) && (\n <div {...styleProps(styles.previewLabel)}>\n {section && <div {...styleProps(styles.previewTitle)}>{section.title}</div>}\n {marker && (\n <div>\n <span\n {...styleProps(styles.dot, undefined, {\n background: markerColor(marker.color),\n display: 'inline-block',\n marginInlineEnd: 6,\n })}\n />\n {marker.content ?? marker.label}\n </div>\n )}\n </div>\n )}\n <div {...styleProps(styles.previewTime)}>{formatTime(time)}</div>\n </div>\n);\n\nexport default HoverPreview;\n"],"mappings":";;;;;;;AAuBA,MAAM,aAAa,EAAE,KAAK,WAA0C;CAClE,MAAM,YAAY,OAA0B,IAAI;CAChD,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,aAAa,OAAsB,IAAI;CAC7C,MAAM,UAAU,OAAO,KAAK;CAE5B,gBAAgB;EACd,MAAM,QAAQ,SAAS;EACvB,IAAI,CAAC,OAAO;EACZ,MAAM,cAAc;GAClB,MAAM,SAAS,UAAU;GACzB,IAAI;IACF,QAAQ,WAAW,IAAI,CAAC,EAAE,UAAU,OAAO,GAAG,GAAG,OAAO,OAAO,OAAO,MAAM;GAC9E,QAAQ,CAER;GACA,QAAQ,UAAU;GAClB,IAAI,WAAW,YAAY,MAAM;GACjC,QAAQ,UAAU;GAClB,MAAM,cAAc,WAAW;GAC/B,WAAW,UAAU;EACvB;EACA,MAAM,cAAc;GAClB,QAAQ,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B,CAAC,EACF,CAAA,GACA,OAAO,WAAW,OAAO,KACvB,EAAA,CAAA,CAEJ;;EAEP,oBAAC,OAAD;GAAK,GAAI,WAAW,OAAO,WAAW;GAAI,UAAA,WAAW,IAAI;EAAO,CAAA;CAC7D"}
@@ -0,0 +1,8 @@
1
+ //#region src/Video/parts/LoadError.d.ts
2
+ declare const LoadError: {
3
+ (): import("react").JSX.Element | null;
4
+ displayName: string;
5
+ };
6
+ //#endregion
7
+ export { LoadError as default };
8
+ //# sourceMappingURL=LoadError.d.mts.map
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { useTranslation } from "../../i18n/useTranslation.mjs";
4
+ import { useVideoContext } from "../context.mjs";
5
+ import { styles } from "../style.mjs";
6
+ import { useVideo } from "../useVideo.mjs";
7
+ import video_default from "../../i18n/resources/en/video.mjs";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { AlertTriangle, Download, RefreshCw } from "lucide-react";
10
+ //#region src/Video/parts/LoadError.tsx
11
+ const LoadError = () => {
12
+ const { config, media, store } = useVideoContext();
13
+ const { t } = useTranslation(video_default);
14
+ if (!useVideo((state) => state.status === "error")) return null;
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ role: "alert",
17
+ ...styleProps(styles.error),
18
+ onClick: (event) => event.stopPropagation(),
19
+ children: [
20
+ /* @__PURE__ */ jsx(AlertTriangle, { size: 22 }),
21
+ /* @__PURE__ */ jsx("span", { children: t("video.loadFailed") }),
22
+ /* @__PURE__ */ jsxs("div", {
23
+ ...styleProps(styles.errorActions),
24
+ children: [/* @__PURE__ */ jsxs("button", {
25
+ type: "button",
26
+ ...styleProps(styles.errorButton),
27
+ onClick: async () => {
28
+ await config.onRetry?.();
29
+ store.reload();
30
+ },
31
+ children: [/* @__PURE__ */ jsx(RefreshCw, { size: 14 }), t("video.reload")]
32
+ }), /* @__PURE__ */ jsxs("a", {
33
+ href: media.src,
34
+ rel: "noreferrer",
35
+ target: "_blank",
36
+ ...styleProps(styles.errorButton),
37
+ children: [/* @__PURE__ */ jsx(Download, { size: 14 }), t("video.download")]
38
+ })]
39
+ })
40
+ ]
41
+ });
42
+ };
43
+ LoadError.displayName = "VideoLoadError";
44
+ //#endregion
45
+ export { LoadError as default };
46
+
47
+ //# sourceMappingURL=LoadError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadError.mjs","names":["videoMessages"],"sources":["../../../src/Video/parts/LoadError.tsx"],"sourcesContent":["'use client';\n\nimport { AlertTriangle, Download, RefreshCw } from 'lucide-react';\n\nimport videoMessages from '@/i18n/resources/en/video';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { useVideoContext } from '../context';\nimport { styles } from '../style';\nimport { useVideo } from '../useVideo';\n\nconst LoadError = () => {\n const { config, media, store } = useVideoContext();\n const { t } = useTranslation(videoMessages);\n const failed = useVideo((state) => state.status === 'error');\n if (!failed) return null;\n\n return (\n <div role=\"alert\" {...styleProps(styles.error)} onClick={(event) => event.stopPropagation()}>\n <AlertTriangle size={22} />\n <span>{t('video.loadFailed')}</span>\n <div {...styleProps(styles.errorActions)}>\n <button\n type=\"button\"\n {...styleProps(styles.errorButton)}\n onClick={async () => {\n await config.onRetry?.();\n store.reload();\n }}\n >\n <RefreshCw size={14} />\n {t('video.reload')}\n </button>\n <a href={media.src} rel=\"noreferrer\" target=\"_blank\" {...styleProps(styles.errorButton)}>\n <Download size={14} />\n {t('video.download')}\n </a>\n </div>\n </div>\n );\n};\n\nLoadError.displayName = 'VideoLoadError';\n\nexport default LoadError;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,kBAAkB;CACtB,MAAM,EAAE,QAAQ,OAAO,UAAU,gBAAgB;CACjD,MAAM,EAAE,MAAM,eAAeA,aAAa;CAE1C,IAAI,CADW,UAAU,UAAU,MAAM,WAAW,OAC1C,GAAG,OAAO;CAEpB,OACE,qBAAC,OAAD;EAAK,MAAK;EAAQ,GAAI,WAAW,OAAO,KAAK;EAAG,UAAU,UAAU,MAAM,gBAAgB;EAA1F,UAAA;GACE,oBAAC,eAAD,EAAe,MAAM,GAAK,CAAA;GAC1B,oBAAC,QAAD,EAAA,UAAO,EAAE,kBAAkB,EAAQ,CAAA;GACnC,qBAAC,OAAD;IAAK,GAAI,WAAW,OAAO,YAAY;IAAvC,UAAA,CACE,qBAAC,UAAD;KACE,MAAK;KACL,GAAI,WAAW,OAAO,WAAW;KACjC,SAAS,YAAY;MACnB,MAAM,OAAO,UAAU;MACvB,MAAM,OAAO;KACf;KANF,UAAA,CAQE,oBAAC,WAAD,EAAW,MAAM,GAAK,CAAA,GACrB,EAAE,cAAc,CACX;IACR,CAAA,GAAA,qBAAC,KAAD;KAAG,MAAM,MAAM;KAAK,KAAI;KAAa,QAAO;KAAS,GAAI,WAAW,OAAO,WAAW;KAAtF,UAAA,CACE,oBAAC,UAAD,EAAU,MAAM,GAAK,CAAA,GACpB,EAAE,gBAAgB,CAClB;IACA,CAAA,CAAA;;EACF;;AAET;AAEA,UAAU,cAAc"}
@@ -0,0 +1,48 @@
1
+ import { styleProps } from "../../styles/stylex/props.mjs";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/Video/parts/PlayPauseIcon.tsx
4
+ const styles = {
5
+ half: {
6
+ kWkggS: "lbtwfq29",
7
+ kpwlN0: "lb10a8y8t",
8
+ kVAEAm: "lb10l6tqk",
9
+ kmkexE: "lbdn3phn lb9kvfbb",
10
+ $$css: true
11
+ },
12
+ leftPause: {
13
+ kz4h6p: "lb54tv3e",
14
+ $$css: true
15
+ },
16
+ leftPlay: {
17
+ kz4h6p: "lbw0i5o0",
18
+ $$css: true
19
+ },
20
+ rightPause: {
21
+ kz4h6p: "lbn4v9xm",
22
+ $$css: true
23
+ },
24
+ rightPlay: {
25
+ kz4h6p: "lb1qujkey",
26
+ $$css: true
27
+ },
28
+ root: {
29
+ k1xSpc: "lb1rg5ohu",
30
+ kUk6DE: "lb1okw0bk",
31
+ kVAEAm: "lb1n2onr6",
32
+ $$css: true
33
+ }
34
+ };
35
+ const PlayPauseIcon = ({ paused, size = 16 }) => /* @__PURE__ */ jsxs("span", {
36
+ "aria-hidden": "true",
37
+ "data-state": paused ? "play" : "pause",
38
+ "data-video-play-icon": "",
39
+ ...styleProps(styles.root, void 0, {
40
+ height: size,
41
+ width: size
42
+ }),
43
+ children: [/* @__PURE__ */ jsx("span", { ...styleProps([styles.half, paused ? styles.leftPlay : styles.leftPause]) }), /* @__PURE__ */ jsx("span", { ...styleProps([styles.half, paused ? styles.rightPlay : styles.rightPause]) })]
44
+ });
45
+ //#endregion
46
+ export { PlayPauseIcon as default };
47
+
48
+ //# sourceMappingURL=PlayPauseIcon.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayPauseIcon.mjs","names":[],"sources":["../../../src/Video/parts/PlayPauseIcon.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nconst reducedMotion = '@media (prefers-reduced-motion: reduce)';\n\n// Each half keeps four points in both states (TL, TR, BR, BL), so clip-path\n// interpolates the pause bars into the two halves of the play triangle.\nconst styles = stylex.create({\n half: {\n backgroundColor: 'currentColor',\n inset: 0,\n position: 'absolute',\n transition: {\n default: 'clip-path 200ms cubic-bezier(0.4, 0, 0.2, 1)',\n [reducedMotion]: 'none',\n },\n },\n leftPause: {\n clipPath: 'polygon(19% 12%, 41% 12%, 41% 88%, 19% 88%)',\n },\n leftPlay: {\n clipPath: 'polygon(22% 10%, 55% 30%, 55% 70%, 22% 90%)',\n },\n rightPause: {\n clipPath: 'polygon(59% 12%, 81% 12%, 81% 88%, 59% 88%)',\n },\n rightPlay: {\n clipPath: 'polygon(55% 30%, 88% 50%, 88% 50%, 55% 70%)',\n },\n root: {\n display: 'inline-block',\n flex: 'none',\n position: 'relative',\n },\n});\n\nconst PlayPauseIcon = ({ paused, size = 16 }: { paused: boolean; size?: number }) => (\n <span\n aria-hidden=\"true\"\n data-state={paused ? 'play' : 'pause'}\n data-video-play-icon=\"\"\n {...styleProps(styles.root, undefined, { height: size, width: size })}\n >\n <span {...styleProps([styles.half, paused ? styles.leftPlay : styles.leftPause])} />\n <span {...styleProps([styles.half, paused ? styles.rightPlay : styles.rightPause])} />\n </span>\n);\n\nexport default PlayPauseIcon;\n"],"mappings":";;;AAMA,MAAM,SAAS;CACb,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAM,iBAAiB,EACrB,QACA,OAAO,SAIH,qBAAC,QAAD;CAAM,eAAY;CAAO,cAAY,SAAS,SAAS;CAAS,wBAAqB;CAAG,GAAI,WAAW,OAAO,MAAM,KAAA,GAAW;EACnI,QAAQ;EACR,OAAO;CACT,CAAC;CAHK,UAAA,CAIF,oBAAC,QAAD,EAAM,GAAI,WAAW,CAAC,OAAO,MAAM,SAAS,OAAO,WAAW,OAAO,SAAS,CAAC,EAAI,CAAA,GACnF,oBAAC,QAAD,EAAM,GAAI,WAAW,CAAC,OAAO,MAAM,SAAS,OAAO,YAAY,OAAO,UAAU,CAAC,EAAI,CAAA,CACjF"}
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import DropdownMenu from "../../DropdownMenu/DropdownMenu.mjs";
4
+ import { useTranslation } from "../../i18n/useTranslation.mjs";
5
+ import { FrameContext, useVideoContext } from "../context.mjs";
6
+ import { styles } from "../style.mjs";
7
+ import { useVideo } from "../useVideo.mjs";
8
+ import video_default from "../../i18n/resources/en/video.mjs";
9
+ import { useFullscreen } from "../useFullscreen.mjs";
10
+ import { DEFAULT_PLAYBACK_RATES } from "../useKeyboard.mjs";
11
+ import { use } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { Check } from "lucide-react";
14
+ //#region src/Video/parts/RateMenu.tsx
15
+ const RateMenu = () => {
16
+ const { config, store } = useVideoContext();
17
+ const frame = use(FrameContext);
18
+ const fullscreen = useFullscreen(store);
19
+ const { t } = useTranslation(video_default);
20
+ const rate = useVideo((state) => state.rate);
21
+ const rates = config.playbackRates ?? DEFAULT_PLAYBACK_RATES;
22
+ return /* @__PURE__ */ jsx(DropdownMenu, {
23
+ portalProps: fullscreen && store.root ? { container: store.root } : void 0,
24
+ items: rates.map((value) => ({
25
+ extra: value === rate ? /* @__PURE__ */ jsx(Check, { size: 14 }) : void 0,
26
+ key: `${value}`,
27
+ label: `${value}×`,
28
+ onClick: () => store.setRate(value)
29
+ })),
30
+ onOpenChange: (open) => frame?.hold(open),
31
+ children: /* @__PURE__ */ jsxs("button", {
32
+ "aria-label": t("video.speed"),
33
+ title: `${t("video.speed")} (J / L)`,
34
+ type: "button",
35
+ ...styleProps([
36
+ styles.barButton,
37
+ styles.rateButton,
38
+ rate !== 1 && styles.barButtonActive
39
+ ]),
40
+ children: [rate, "×"]
41
+ })
42
+ });
43
+ };
44
+ RateMenu.displayName = "VideoRateMenu";
45
+ //#endregion
46
+ export { RateMenu as default };
47
+
48
+ //# sourceMappingURL=RateMenu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RateMenu.mjs","names":["videoMessages"],"sources":["../../../src/Video/parts/RateMenu.tsx"],"sourcesContent":["'use client';\n\nimport { Check } from 'lucide-react';\nimport { use } from 'react';\n\nimport DropdownMenu from '@/DropdownMenu';\nimport videoMessages from '@/i18n/resources/en/video';\nimport { useTranslation } from '@/i18n/useTranslation';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { FrameContext, useVideoContext } from '../context';\nimport { styles } from '../style';\nimport { useFullscreen } from '../useFullscreen';\nimport { DEFAULT_PLAYBACK_RATES } from '../useKeyboard';\nimport { useVideo } from '../useVideo';\n\nconst RateMenu = () => {\n const { config, store } = useVideoContext();\n const frame = use(FrameContext);\n const fullscreen = useFullscreen(store);\n const { t } = useTranslation(videoMessages);\n const rate = useVideo((state) => state.rate);\n const rates = config.playbackRates ?? DEFAULT_PLAYBACK_RATES;\n\n return (\n <DropdownMenu\n portalProps={fullscreen && store.root ? { container: store.root } : undefined}\n items={rates.map((value) => ({\n extra: value === rate ? <Check size={14} /> : undefined,\n key: `${value}`,\n label: `${value}×`,\n onClick: () => store.setRate(value),\n }))}\n onOpenChange={(open) => frame?.hold(open)}\n >\n <button\n aria-label={t('video.speed')}\n title={`${t('video.speed')} (J / L)`}\n type=\"button\"\n {...styleProps([styles.barButton, styles.rateButton, rate !== 1 && styles.barButtonActive])}\n >\n {rate}×\n </button>\n </DropdownMenu>\n );\n};\n\nRateMenu.displayName = 'VideoRateMenu';\n\nexport default RateMenu;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;CACrB,MAAM,EAAE,QAAQ,UAAU,gBAAgB;CAC1C,MAAM,QAAQ,IAAI,YAAY;CAC9B,MAAM,aAAa,cAAc,KAAK;CACtC,MAAM,EAAE,MAAM,eAAeA,aAAa;CAC1C,MAAM,OAAO,UAAU,UAAU,MAAM,IAAI;CAC3C,MAAM,QAAQ,OAAO,iBAAiB;CAEtC,OACE,oBAAC,cAAD;EACE,aAAa,cAAc,MAAM,OAAO,EAAE,WAAW,MAAM,KAAK,IAAI,KAAA;EACpE,OAAO,MAAM,KAAK,WAAW;GAC3B,OAAO,UAAU,OAAO,oBAAC,OAAD,EAAO,MAAM,GAAK,CAAA,IAAI,KAAA;GAC9C,KAAK,GAAG;GACR,OAAO,GAAG,MAAM;GAChB,eAAe,MAAM,QAAQ,KAAK;EACpC,EAAE;EACF,eAAe,SAAS,OAAO,KAAK,IAAI;EAExC,UAAA,qBAAC,UAAD;GACE,cAAY,EAAE,aAAa;GAC3B,OAAO,GAAG,EAAE,aAAa,EAAE;GAC3B,MAAK;GACL,GAAI,WAAW;IAAC,OAAO;IAAW,OAAO;IAAY,SAAS,KAAK,OAAO;GAAe,CAAC;GAJ5F,UAAA,CAMG,MAAK,GACA;;CACI,CAAA;AAElB;AAEA,SAAS,cAAc"}
@@ -0,0 +1,9 @@
1
+ import { VideoRootProps } from "../type.mjs";
2
+ //#region src/Video/parts/Root.d.ts
3
+ declare const Root: {
4
+ ({ ref, player, src, poster, autoPlay, loop, preload, onPlay, onPause, onEnded, onError, onTimeUpdate, sections, markers, fps, playbackRates, defaultPlaybackRate, muted, onMutedChange, onRateChange, onMarkerClick, onRetry, captions, width, height, maxHeight, className, style, children }: VideoRootProps): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ //#endregion
8
+ export { Root as default };
9
+ //# sourceMappingURL=Root.d.mts.map