@weing-dev/ui-kit-primitive 0.2.0 → 0.3.0

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 (44) hide show
  1. package/dist/components/Icon/Icon.constant.d.ts +1 -1
  2. package/dist/components/Icon/Icon.d.ts +1 -1
  3. package/dist/components/Icons/PictureQuality.d.ts +3 -0
  4. package/dist/components/Icons/Pip.d.ts +3 -0
  5. package/dist/components/Icons/PipExit.d.ts +3 -0
  6. package/dist/components/Icons/PlaybackSpeed.d.ts +3 -0
  7. package/dist/components/Icons/SubtitleFilled.d.ts +3 -0
  8. package/dist/components/Icons/SubtitleOutlined.d.ts +3 -0
  9. package/dist/components/Icons/index.d.ts +6 -0
  10. package/dist/components/VideoPlayer/VideoPlayer.d.ts +99 -92
  11. package/dist/components/VideoPlayer/VideoPlayer.utils.d.ts +45 -0
  12. package/dist/components/VideoPlayer/components/Error/Error.d.ts +0 -3
  13. package/dist/components/VideoPlayer/components/Frame/Frame.d.ts +0 -28
  14. package/dist/components/VideoPlayer/components/Loading/Loading.d.ts +0 -1
  15. package/dist/components/VideoPlayer/components/Player/Player.d.ts +6 -0
  16. package/dist/components/VideoPlayer/components/Player/index.d.ts +2 -0
  17. package/dist/components/VideoPlayer/components/Thumbnail/Thumbnail.d.ts +8 -0
  18. package/dist/components/VideoPlayer/components/Thumbnail/index.d.ts +2 -0
  19. package/dist/components/VideoPlayer/components/VideoOverlay/VideoOverlay.d.ts +1 -3
  20. package/dist/components/VideoPlayer/components/Widgets/Button/Button.d.ts +4 -2
  21. package/dist/components/VideoPlayer/components/Widgets/SpeedControl/SpeedControl.d.ts +0 -1
  22. package/dist/components/VideoPlayer/components/Widgets/VolumeControl/VolumeControl.d.ts +5 -5
  23. package/dist/components/VideoPlayer/components/Widgets/index.d.ts +0 -1
  24. package/dist/components/VideoPlayer/components/index.d.ts +4 -0
  25. package/dist/components/VideoPlayer/context/index.d.ts +3 -2
  26. package/dist/components/VideoPlayer/context/videoPlayer.context.d.ts +6 -9
  27. package/dist/components/VideoPlayer/context/videoPlayer.provider.d.ts +1 -6
  28. package/dist/components/VideoPlayer/context/videoPlayer.store.d.ts +25 -43
  29. package/dist/components/VideoPlayer/context/videoPlayer.types.d.ts +351 -0
  30. package/dist/components/VideoPlayer/index.d.ts +16 -2
  31. package/dist/components/VideoPlayer/videoPlayer.constants.d.ts +7 -0
  32. package/dist/entry/components.d.ts +2 -1
  33. package/dist/entry/types.d.ts +2 -2
  34. package/dist/index.css +2 -2
  35. package/dist/index.js +8496 -7949
  36. package/dist/index.umd.cjs +31 -23
  37. package/dist/static/icon/PictureQuality.svg +5 -0
  38. package/dist/static/icon/pip.svg +8 -0
  39. package/dist/static/icon/pip_exit.svg +8 -0
  40. package/dist/static/icon/playback_speed.svg +5 -0
  41. package/dist/static/icon/subtitle_filled.svg +1 -0
  42. package/dist/static/icon/subtitle_outlined.svg +1 -0
  43. package/dist/utils/common.utill.d.ts +1 -1
  44. package/package.json +1 -1
@@ -3,4 +3,4 @@
3
3
  * 이 파일은 scripts/icons/generate-icon-names.cjs 로 생성됩니다.
4
4
  * Icons/index.ts 를 수정한 뒤 pnpm build 전에 이 스크립트를 실행하세요.
5
5
  */
6
- export declare const ICON_NAMES: readonly ["Add", "AddOutlined", "AddAPhoto", "ApprovalInactive", "ArrowDown", "ArrowRight", "ArrowUp", "ArrowDropDown", "ArticleOutlined", "AttachFile", "BackButton", "CalendarMonth", "CalendarToday", "CancleFilled", "Cancle", "CartFilled", "Cart", "Category", "CategoryOutlined", "Celebration", "Check", "CheckBadge", "CheckBoxRound", "CheckList", "CheckCircle", "ChevronLeft", "ChromeReaderMode", "Close", "Company", "CreditCard", "CropOriginal", "DensityMediumRound", "DoubleArrowDown", "DoubleArrowUp", "Download", "DragHandle", "Eco", "EditSquare", "EditNoteOutlined", "ErrorFilled", "Error", "ExpandAll", "ExpandLess", "ExpandMore", "Factory", "FeedbackOutlined", "FileUpload", "FilecheckInactive", "FileDownloadDoneFilled", "FileDownloadOutlined", "FullScreen", "FullScreenClose", "GoBefore", "GoNext", "HamburgerMenu", "HandshakeRound", "Home", "ImagecheckPlay", "ImportExport", "InfoFilled", "Inventory", "KakaoTalk", "ListAll", "LocalActivityOutlined", "LocalHospital", "LocalShipping", "Logout", "Menu", "Minus", "MinusOutlined", "ModeEdit", "More", "NaverBlog", "Naver", "Notification", "OrderApprove", "OrderInactive", "OrderPlay", "Outward", "Pause", "PayApprove", "PayInactive", "Payment", "PersonAddAlt", "Personcard", "PersonFilled", "PersonOutline", "Play", "PrintInactive", "PrintPlay", "Product", "ScheduleRound", "Search", "Search2", "SettingFilled", "Settings", "Share", "ShippingDone", "SupportAgent", "SwapVert", "Task", "TrashOutlined", "Upload", "User", "VolumeOff", "VolumeUp", "WarningFilled", "Warning", "WarningAmber"];
6
+ export declare const ICON_NAMES: readonly ["Add", "AddOutlined", "AddAPhoto", "ApprovalInactive", "ArrowDown", "ArrowRight", "ArrowUp", "ArrowDropDown", "ArticleOutlined", "AttachFile", "BackButton", "CalendarMonth", "CalendarToday", "CancleFilled", "Cancle", "CartFilled", "Cart", "Category", "CategoryOutlined", "Celebration", "Check", "CheckBadge", "CheckBoxRound", "CheckList", "CheckCircle", "ChevronLeft", "ChromeReaderMode", "Close", "Company", "CreditCard", "CropOriginal", "DensityMediumRound", "DoubleArrowDown", "DoubleArrowUp", "Download", "DragHandle", "Eco", "EditSquare", "EditNoteOutlined", "ErrorFilled", "Error", "ExpandAll", "ExpandLess", "ExpandMore", "Factory", "FeedbackOutlined", "FileUpload", "FilecheckInactive", "FileDownloadDoneFilled", "FileDownloadOutlined", "FullScreen", "FullScreenClose", "GoBefore", "GoNext", "HamburgerMenu", "HandshakeRound", "Home", "ImagecheckPlay", "ImportExport", "InfoFilled", "Inventory", "KakaoTalk", "ListAll", "LocalActivityOutlined", "LocalHospital", "LocalShipping", "Logout", "Menu", "Minus", "MinusOutlined", "ModeEdit", "More", "NaverBlog", "Naver", "Notification", "OrderApprove", "OrderInactive", "OrderPlay", "Outward", "Pause", "PayApprove", "PayInactive", "Payment", "PersonAddAlt", "Personcard", "PersonFilled", "PersonOutline", "PictureQuality", "Pip", "PipExit", "Play", "PlaybackSpeed", "PrintInactive", "PrintPlay", "Product", "ScheduleRound", "Search", "Search2", "SettingFilled", "Settings", "Share", "ShippingDone", "SubtitleFilled", "SubtitleOutlined", "SupportAgent", "SwapVert", "Task", "TrashOutlined", "Upload", "User", "VolumeOff", "VolumeUp", "WarningFilled", "Warning", "WarningAmber"];
@@ -11,6 +11,6 @@ export type StrictIconProps = IconBaseProps & {
11
11
  };
12
12
  declare function IconComponent(props: StrictIconProps): import("react/jsx-runtime").JSX.Element;
13
13
  export declare const Icon: typeof IconComponent & {
14
- ICON_NAMES: readonly ["Add", "AddOutlined", "AddAPhoto", "ApprovalInactive", "ArrowDown", "ArrowRight", "ArrowUp", "ArrowDropDown", "ArticleOutlined", "AttachFile", "BackButton", "CalendarMonth", "CalendarToday", "CancleFilled", "Cancle", "CartFilled", "Cart", "Category", "CategoryOutlined", "Celebration", "Check", "CheckBadge", "CheckBoxRound", "CheckList", "CheckCircle", "ChevronLeft", "ChromeReaderMode", "Close", "Company", "CreditCard", "CropOriginal", "DensityMediumRound", "DoubleArrowDown", "DoubleArrowUp", "Download", "DragHandle", "Eco", "EditSquare", "EditNoteOutlined", "ErrorFilled", "Error", "ExpandAll", "ExpandLess", "ExpandMore", "Factory", "FeedbackOutlined", "FileUpload", "FilecheckInactive", "FileDownloadDoneFilled", "FileDownloadOutlined", "FullScreen", "FullScreenClose", "GoBefore", "GoNext", "HamburgerMenu", "HandshakeRound", "Home", "ImagecheckPlay", "ImportExport", "InfoFilled", "Inventory", "KakaoTalk", "ListAll", "LocalActivityOutlined", "LocalHospital", "LocalShipping", "Logout", "Menu", "Minus", "MinusOutlined", "ModeEdit", "More", "NaverBlog", "Naver", "Notification", "OrderApprove", "OrderInactive", "OrderPlay", "Outward", "Pause", "PayApprove", "PayInactive", "Payment", "PersonAddAlt", "Personcard", "PersonFilled", "PersonOutline", "Play", "PrintInactive", "PrintPlay", "Product", "ScheduleRound", "Search", "Search2", "SettingFilled", "Settings", "Share", "ShippingDone", "SupportAgent", "SwapVert", "Task", "TrashOutlined", "Upload", "User", "VolumeOff", "VolumeUp", "WarningFilled", "Warning", "WarningAmber"];
14
+ ICON_NAMES: readonly ["Add", "AddOutlined", "AddAPhoto", "ApprovalInactive", "ArrowDown", "ArrowRight", "ArrowUp", "ArrowDropDown", "ArticleOutlined", "AttachFile", "BackButton", "CalendarMonth", "CalendarToday", "CancleFilled", "Cancle", "CartFilled", "Cart", "Category", "CategoryOutlined", "Celebration", "Check", "CheckBadge", "CheckBoxRound", "CheckList", "CheckCircle", "ChevronLeft", "ChromeReaderMode", "Close", "Company", "CreditCard", "CropOriginal", "DensityMediumRound", "DoubleArrowDown", "DoubleArrowUp", "Download", "DragHandle", "Eco", "EditSquare", "EditNoteOutlined", "ErrorFilled", "Error", "ExpandAll", "ExpandLess", "ExpandMore", "Factory", "FeedbackOutlined", "FileUpload", "FilecheckInactive", "FileDownloadDoneFilled", "FileDownloadOutlined", "FullScreen", "FullScreenClose", "GoBefore", "GoNext", "HamburgerMenu", "HandshakeRound", "Home", "ImagecheckPlay", "ImportExport", "InfoFilled", "Inventory", "KakaoTalk", "ListAll", "LocalActivityOutlined", "LocalHospital", "LocalShipping", "Logout", "Menu", "Minus", "MinusOutlined", "ModeEdit", "More", "NaverBlog", "Naver", "Notification", "OrderApprove", "OrderInactive", "OrderPlay", "Outward", "Pause", "PayApprove", "PayInactive", "Payment", "PersonAddAlt", "Personcard", "PersonFilled", "PersonOutline", "PictureQuality", "Pip", "PipExit", "Play", "PlaybackSpeed", "PrintInactive", "PrintPlay", "Product", "ScheduleRound", "Search", "Search2", "SettingFilled", "Settings", "Share", "ShippingDone", "SubtitleFilled", "SubtitleOutlined", "SupportAgent", "SwapVert", "Task", "TrashOutlined", "Upload", "User", "VolumeOff", "VolumeUp", "WarningFilled", "Warning", "WarningAmber"];
15
15
  };
16
16
  export {};
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgPictureQuality: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgPictureQuality;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgPip: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgPip;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgPipExit: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgPipExit;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgPlaybackSpeed: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgPlaybackSpeed;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgSubtitleFilled: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgSubtitleFilled;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+ declare const SvgSubtitleOutlined: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
3
+ export default SvgSubtitleOutlined;
@@ -85,7 +85,11 @@ export { default as PersonAddAlt } from './PersonAddAlt';
85
85
  export { default as Personcard } from './Personcard';
86
86
  export { default as PersonFilled } from './PersonFilled';
87
87
  export { default as PersonOutline } from './PersonOutline';
88
+ export { default as PictureQuality } from './PictureQuality';
89
+ export { default as Pip } from './Pip';
90
+ export { default as PipExit } from './PipExit';
88
91
  export { default as Play } from './Play';
92
+ export { default as PlaybackSpeed } from './PlaybackSpeed';
89
93
  export { default as PrintInactive } from './PrintInactive';
90
94
  export { default as PrintPlay } from './PrintPlay';
91
95
  export { default as Product } from './Product';
@@ -96,6 +100,8 @@ export { default as SettingFilled } from './SettingFilled';
96
100
  export { default as Settings } from './Settings';
97
101
  export { default as Share } from './Share';
98
102
  export { default as ShippingDone } from './ShippingDone';
103
+ export { default as SubtitleFilled } from './SubtitleFilled';
104
+ export { default as SubtitleOutlined } from './SubtitleOutlined';
99
105
  export { default as SupportAgent } from './SupportAgent';
100
106
  export { default as SwapVert } from './SwapVert';
101
107
  export { default as Task } from './Task';
@@ -1,118 +1,125 @@
1
1
  import { default as React } from 'react';
2
- import { default as videojs } from 'video.js';
3
- import { VideoOverlay, Loading, Error, Frame, Widgets } from './components';
4
- import { VideoPlayerStoreContext, VideoPlayerImageContext, VideoPlayerProvider, useVideoPlayerStore, useVideoPlayerShallow, useVideoPlayerImage, createVideoPlayerStore, resolveVideoPlayerStoreConfig, VideoPlayerImageComponent, VideoPlayerStoreConfig } from './context';
5
- import { IconName } from '../Icon/Icon';
6
- type VideoJsPlayer = ReturnType<typeof videojs>;
7
- type VideoJsOptions = Parameters<typeof videojs>[1];
8
- export type VideoPlayerControls = {
9
- back?: boolean;
10
- share?: boolean;
11
- playPause?: boolean;
12
- progress?: boolean;
13
- time?: boolean;
14
- volume?: boolean;
15
- speed?: boolean;
16
- fullscreen?: boolean;
17
- };
18
- export type VideoPlayerTexts = {
19
- loading?: string;
20
- errorTitle?: string;
21
- errorDescription?: string;
22
- errorRetry?: string;
23
- };
24
- export type VideoPlayerAria = {
25
- progress?: string;
26
- play?: string;
27
- pause?: string;
28
- fullscreenEnter?: string;
29
- fullscreenExit?: string;
30
- speed?: string;
31
- mute?: string;
32
- unmute?: string;
33
- back?: string;
34
- share?: string;
35
- };
36
- export type VideoPlayerIcons = {
37
- play?: IconName | string;
38
- pause?: IconName | string;
39
- back?: IconName | string;
40
- share?: IconName | string;
41
- volumeOn?: IconName | string;
42
- volumeOff?: IconName | string;
43
- fullscreenEnter?: IconName | string;
44
- fullscreenExit?: IconName | string;
45
- };
46
- export type VideoPlayerEvents = {
47
- onReady?: (player: VideoJsPlayer) => void;
48
- onLoadStart?: () => void;
49
- onCanPlay?: () => void;
50
- onPlay?: () => void;
51
- onPause?: () => void;
52
- onTimeUpdate?: (currentTime: number) => void;
53
- onProgress?: (buffered: number) => void;
54
- onVolumeChange?: (volume: number) => void;
55
- onRateChange?: (rate: number) => void;
56
- onFullscreenChange?: (isFullscreen: boolean) => void;
57
- onDurationChange?: (duration: number) => void;
58
- onError?: (error: unknown) => void;
59
- };
60
- export type VideoPlayerProps = {
61
- src: string;
62
- poster?: string;
63
- className?: string;
64
- width?: string | number;
65
- height?: string | number;
66
- onBack?: () => void;
67
- onShare?: () => void;
68
- onRetry?: () => void;
69
- controls?: VideoPlayerControls;
70
- texts?: VideoPlayerTexts;
71
- aria?: VideoPlayerAria;
72
- icons?: VideoPlayerIcons;
73
- events?: VideoPlayerEvents;
74
- overlayClassName?: string;
75
- overlay?: {
76
- autoHide?: boolean;
77
- autoHideDelayMs?: number;
78
- overlayClickAction?: "toggle-play" | "none";
79
- onOverlayClick?: () => void;
80
- };
81
- playerOptions?: VideoJsOptions;
82
- sources?: {
83
- src: string;
84
- type: string;
85
- }[];
86
- speedOptions?: number[];
87
- disableVideoJsStyles?: boolean;
88
- controlVariants?: {
89
- speed?: "menu" | "cycle";
90
- };
2
+ import { VideoOverlay, Loading, Error, Frame, Player, Thumbnail, Widgets } from './components';
3
+ import { VideoPlayerStoreContext, VideoPlayerImageContext, DefaultImage, VideoPlayerProvider, useVideoPlayerStore, useVideoPlayerShallow, useVideoPlayerImage, createVideoPlayerStore, resolveVideoPlayerStoreConfig, VideoPlayerImageComponent, VideoPlayerProviderProps } from './context';
4
+ import { VIDEO_PLAYER_DEFAULTS } from './videoPlayer.constants';
5
+ import { convertSrtToVtt, isSrtSubtitleSource, parseWebVttToCues } from './VideoPlayer.utils';
6
+ /**
7
+ * `VideoPlayer.Root` props. `VideoPlayerProviderProps`와 같으나 `children`은 선택이고,
8
+ * 썸네일에 커스텀 이미지 컴포넌트를 `Image`로 넘길 수 있다.
9
+ */
10
+ export type RootProps = Omit<VideoPlayerProviderProps, "children"> & {
91
11
  children?: React.ReactNode;
92
- storeConfig?: VideoPlayerStoreConfig;
12
+ /** 썸네일·포스터 렌더에 사용. 미지정 시 HTML `img` 기본 구현 */
93
13
  Image?: VideoPlayerImageComponent;
94
14
  };
95
- export type RootProps = VideoPlayerProps & React.JSX.IntrinsicElements["div"];
96
15
  declare const Root: {
97
16
  (props: RootProps): import("react/jsx-runtime").JSX.Element;
98
17
  displayName: string;
99
18
  };
19
+ /**
20
+ * `VideoPlayer` 기본 export 객체의 타입.
21
+ * 컴파운드 컴포넌트, 훅, Context, 스토어 팩토리, 기본 상수, 자막 유틸을 한곳에서 접근한다.
22
+ */
100
23
  interface IVideoPlayer {
24
+ /**
25
+ * 플레이어 루트. 스토어(Provider)·레이아웃·자막·이벤트 등 초기 설정을 넘기고, 하위에 `Frame`·`Player`·`Overlay`를 조립한다.
26
+ * `children`만 비우면 UI가 렌더되지 않는다.
27
+ */
101
28
  Root: typeof Root;
29
+ /**
30
+ * 플레이어 영역 래퍼. Root의 `width`/`height`를 CSS 변수로 반영한다.
31
+ */
102
32
  Frame: typeof Frame;
33
+ /**
34
+ * `<video>`와 Video.js 인스턴스를 마운트한다. 소스·옵션·이벤트는 스토어(Root가 넣은 값)를 읽는다.
35
+ */
36
+ Player: typeof Player;
37
+ /**
38
+ * 재생 전·`currentTime === 0`일 때만 보이는 포스터(썸네일) 레이어. Root의 `Image` 슬롯으로 그린다.
39
+ */
40
+ Thumbnail: typeof Thumbnail;
41
+ /**
42
+ * 오버레이 루트. children은 렌더 프롭으로 `onMouseMove`·`showControls` 등을 받는다. `Overlay.Grid`와 9개 슬롯을 제공한다.
43
+ */
103
44
  Overlay: typeof VideoOverlay;
45
+ /**
46
+ * 로딩 오버레이. 스토어 `isLoading`이 true일 때만 표시된다.
47
+ */
104
48
  Loading: typeof Loading;
49
+ /**
50
+ * 에러 오버레이. 스토어 `hasError`가 true일 때만 표시된다.
51
+ */
105
52
  Error: typeof Error;
53
+ /**
54
+ * 컨트롤 위젯 묶음 (`Button`, `ProgressBar`, `VolumeControl`, `SpeedControl`, `Time`).
55
+ */
106
56
  Widgets: typeof Widgets;
57
+ /**
58
+ * Zustand 스토어에서 값을 구독한다. 반드시 Provider(`Root` 또는 `VideoPlayerProvider`) 하위에서 호출한다.
59
+ */
107
60
  useVideoPlayerStore: typeof useVideoPlayerStore;
61
+ /**
62
+ * 스토어에서 여러 필드를 얕게(shallow) 골라온다. 키 배열 또는 selector 함수를 넘길 수 있다.
63
+ */
108
64
  useVideoPlayerShallow: typeof useVideoPlayerShallow;
65
+ /**
66
+ * Root에 주입한 `Image` 컴포넌트 타입을 반환한다. `Thumbnail`이 이 구현으로 렌더된다.
67
+ */
109
68
  useVideoPlayerImage: typeof useVideoPlayerImage;
69
+ /**
70
+ * VideoPlayer Zustand 스토어용 React Context.
71
+ */
110
72
  VideoPlayerStoreContext: typeof VideoPlayerStoreContext;
73
+ /**
74
+ * 썸네일용 이미지 컴포넌트를 담는 Context.
75
+ */
111
76
  VideoPlayerImageContext: typeof VideoPlayerImageContext;
77
+ /**
78
+ * 스토어 Provider. `Root` 없이 커스텀 트리에 직접 감쌀 때 사용한다.
79
+ */
112
80
  VideoPlayerProvider: typeof VideoPlayerProvider;
81
+ /**
82
+ * Zustand 스토어 인스턴스를 생성한다. 고급 통합·테스트용.
83
+ */
113
84
  createVideoPlayerStore: typeof createVideoPlayerStore;
85
+ /**
86
+ * `storeConfig` 부분 객체를 패키지 기본값과 병합해 완전한 설정 객체로 만든다.
87
+ */
114
88
  resolveVideoPlayerStoreConfig: typeof resolveVideoPlayerStoreConfig;
89
+ /**
90
+ * 레이아웃·오버레이·볼륨·배속·문구·aria·아이콘 이름 등 패키지 기본 상수.
91
+ */
92
+ VIDEO_PLAYER_DEFAULTS: typeof VIDEO_PLAYER_DEFAULTS;
93
+ /**
94
+ * 기본 썸네일 이미지 구현(HTML `<img>`). Root `Image` 미지정 시 사용된다.
95
+ */
96
+ DefaultImage: typeof DefaultImage;
97
+ /**
98
+ * SRT 자막 텍스트를 WebVTT 텍스트로 변환한다.
99
+ *
100
+ * - 줄바꿈을 `\n`으로 정규화
101
+ * - 타임스탬프 구분자 `,`를 `.`으로 변환
102
+ * - 가능한 경우 cue id/설정 정보를 보존
103
+ *
104
+ * @param srt - 원본 SRT 문자열
105
+ * @returns `WEBVTT` 헤더가 포함된 VTT 문자열
106
+ */
107
+ convertSrtToVtt: typeof convertSrtToVtt;
108
+ /**
109
+ * 자막 URL/경로가 SRT 파일인지 판별한다.
110
+ *
111
+ * @param src - 자막 리소스 경로 또는 URL
112
+ * @returns `.srt` 확장자면 `true`
113
+ */
114
+ isSrtSubtitleSource: typeof isSrtSubtitleSource;
115
+ /**
116
+ * WebVTT 문자열을 파싱해 cue 배열로 반환한다 (간단한 파서; 복잡한 설정 라인은 무시).
117
+ *
118
+ * @param input - 전체 WebVTT 문자열
119
+ * @returns `{ start, end, text }[]` (초 단위 구간)
120
+ */
121
+ parseWebVttToCues: typeof parseWebVttToCues;
115
122
  }
116
- export type { RootProps as VideoPlayerRootProps };
123
+ export type { IVideoPlayer, RootProps as VideoPlayerRootProps };
117
124
  declare const VideoPlayer: IVideoPlayer;
118
125
  export default VideoPlayer;
@@ -0,0 +1,45 @@
1
+ import { VideoJsPlayer, VideoPlayerState } from './context/videoPlayer.types';
2
+ /**
3
+ * Video.js HTML5 tech에서 루트 `<video>` 요소를 가져온다.
4
+ */
5
+ export declare const getHtmlVideoElementFromVideoJs: (player: VideoJsPlayer) => HTMLVideoElement | null;
6
+ /** WebVTT cue 한 개 (초 단위 구간) */
7
+ export type VttCue = {
8
+ start: number;
9
+ end: number;
10
+ text: string;
11
+ };
12
+ /**
13
+ * WebVTT 문자열을 파싱해 cue 배열로 반환한다 (간단한 파서; 복잡한 설정 라인은 무시).
14
+ */
15
+ export declare const parseWebVttToCues: (input: string) => VttCue[];
16
+ /**
17
+ * SRT 자막 텍스트를 WebVTT 텍스트로 변환한다.
18
+ *
19
+ * - 줄바꿈을 `\n`으로 정규화
20
+ * - 타임스탬프 구분자 `,`를 `.`으로 변환
21
+ * - 가능한 경우 cue id/설정 정보를 보존
22
+ *
23
+ * @param srt - 원본 SRT 문자열
24
+ * @returns `WEBVTT` 헤더가 포함된 VTT 문자열
25
+ */
26
+ export declare const convertSrtToVtt: (srt: string) => string;
27
+ /**
28
+ * 자막 URL/경로가 SRT 파일인지 판별한다.
29
+ *
30
+ * @param src - 자막 리소스 경로 또는 URL
31
+ * @returns `.srt` 확장자면 `true`
32
+ */
33
+ export declare const isSrtSubtitleSource: (src: string) => boolean;
34
+ /**
35
+ * SRT 문자열을 VTT Blob URL로 변환해 브라우저 `track.src`에 바로 연결할 수 있게 만든다.
36
+ *
37
+ * @param srt - 원본 SRT 문자열
38
+ * @returns `URL.revokeObjectURL`로 해제가 필요한 Blob URL
39
+ */
40
+ export declare const createVttBlobUrlFromSrt: (srt: string) => string;
41
+ /**
42
+ * 스토어에 반영되는 `src` / `sources` 업데이트가 실제 미디어 소스 전환인지 판별한다.
43
+ * (썸네일만 바뀐 경우는 false)
44
+ */
45
+ export declare const isMediaSourceChange: (previous: Pick<VideoPlayerState, "src" | "sources">, updates: Partial<VideoPlayerState>) => boolean;
@@ -8,9 +8,6 @@ type ErrorAsProps = {
8
8
  };
9
9
  type ErrorProps = {
10
10
  className?: string;
11
- errorTitle?: string;
12
- errorDescription?: string;
13
- errorRetry?: string;
14
11
  onRetry?: () => void;
15
12
  as?: (props: ErrorAsProps) => React.ReactNode;
16
13
  };
@@ -1,34 +1,6 @@
1
1
  import { default as React } from 'react';
2
- import { default as videojs } from 'video.js';
3
- type VideoJsPlayer = ReturnType<typeof videojs>;
4
- type VideoJsOptions = Parameters<typeof videojs>[1];
5
2
  export type FrameProps = {
6
- src: string;
7
- poster?: string;
8
3
  className?: string;
9
- width?: string | number;
10
- height?: string | number;
11
- playerOptions?: VideoJsOptions;
12
- sources?: {
13
- src: string;
14
- type: string;
15
- }[];
16
- speedOptions?: number[];
17
- disableVideoJsStyles?: boolean;
18
- events?: {
19
- onReady?: (player: VideoJsPlayer) => void;
20
- onLoadStart?: () => void;
21
- onCanPlay?: () => void;
22
- onPlay?: () => void;
23
- onPause?: () => void;
24
- onTimeUpdate?: (currentTime: number) => void;
25
- onProgress?: (buffered: number) => void;
26
- onVolumeChange?: (volume: number) => void;
27
- onRateChange?: (rate: number) => void;
28
- onFullscreenChange?: (isFullscreen: boolean) => void;
29
- onDurationChange?: (duration: number) => void;
30
- onError?: (error: unknown) => void;
31
- };
32
4
  } & React.JSX.IntrinsicElements["div"];
33
5
  declare const Frame: (props: FrameProps) => import("react/jsx-runtime").JSX.Element;
34
6
  export default Frame;
@@ -5,7 +5,6 @@ type LoadingAsProps = {
5
5
  };
6
6
  type LoadingProps = {
7
7
  className?: string;
8
- loadingText?: string;
9
8
  as?: (props: LoadingAsProps) => React.ReactNode;
10
9
  };
11
10
  declare const Loading: (props: LoadingProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export type PlayerProps = {
3
+ className?: string;
4
+ } & React.JSX.IntrinsicElements["video"];
5
+ declare const Player: (props: PlayerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default Player;
@@ -0,0 +1,2 @@
1
+ export { default } from './Player';
2
+ export type { PlayerProps } from './Player';
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export type ThumbnailProps = {
3
+ src: string;
4
+ alt?: string;
5
+ className?: string;
6
+ } & React.JSX.IntrinsicElements["div"];
7
+ declare const Thumbnail: (props: ThumbnailProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export default Thumbnail;
@@ -0,0 +1,2 @@
1
+ export { default } from './Thumbnail';
2
+ export type { ThumbnailProps } from './Thumbnail';
@@ -13,12 +13,10 @@ export type VideoOverlayRenderProps = {
13
13
  onMouseLeave: () => void;
14
14
  onClick: (event: React.MouseEvent<Element>) => void;
15
15
  isFullscreen: boolean;
16
+ isPictureInPicture: boolean;
16
17
  };
17
18
  export type VideoOverlayProps = {
18
19
  className?: string;
19
- autoHide?: boolean;
20
- autoHideDelayMs?: number;
21
- overlayClickAction?: "toggle-play" | "none";
22
20
  onOverlayClick?: () => void;
23
21
  children: (props: VideoOverlayRenderProps) => React.ReactNode;
24
22
  };
@@ -1,8 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { Icon } from '../../../../Icon/Icon';
3
3
  export type ButtonProps = {
4
- /** Icon 컴포넌트에 전달할 props (name 필수, size·color 등 선택) */
5
- icon: React.ComponentProps<typeof Icon>;
4
+ /** Icon 컴포넌트에 전달할 props (name 필수, size·color 등 선택). children이 있으면 무시됨. */
5
+ icon?: React.ComponentProps<typeof Icon>;
6
+ /** 아이콘 대신 렌더할 내용 (예: SpeedControl의 "1x" 텍스트) */
7
+ children?: React.ReactNode;
6
8
  onClick?: () => void;
7
9
  ariaLabel?: string;
8
10
  className?: string;
@@ -14,7 +14,6 @@ type SpeedControlAsProps = {
14
14
  type SpeedControlProps = {
15
15
  className?: string;
16
16
  variant?: "menu" | "cycle";
17
- speedOptions?: number[];
18
17
  ariaLabel?: string;
19
18
  as?: (props: SpeedControlAsProps) => React.ReactNode;
20
19
  };
@@ -1,5 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { IconName } from '../../../../Icon/Icon';
2
+ import { IconName, StrictIconProps } from '../../../../Icon/Icon';
3
+ /** 아이콘: 이름만 주거나, name + 기타 Icon props 객체 */
4
+ type VolumeIconProp = IconName | (Pick<StrictIconProps, "name"> & Partial<Omit<StrictIconProps, "name">>);
3
5
  type VolumeControlAsProps = {
4
6
  defaultClassName: string;
5
7
  volume: number;
@@ -12,8 +14,6 @@ type VolumeControlAsProps = {
12
14
  sliderVisible: boolean;
13
15
  sliderValue: number;
14
16
  onSliderFocus: (focused: boolean) => void;
15
- onMouseEnter: () => void;
16
- onMouseLeave: () => void;
17
17
  onPointerDown: (event: React.PointerEvent<Element>) => void;
18
18
  trackRef: React.RefObject<HTMLDivElement | null>;
19
19
  };
@@ -21,8 +21,8 @@ export type VolumeControlProps = {
21
21
  className?: string;
22
22
  onInteractionChange?: (isActive: boolean) => void;
23
23
  icons?: {
24
- volumeOn?: IconName;
25
- volumeOff?: IconName;
24
+ volumeOn?: VolumeIconProp;
25
+ volumeOff?: VolumeIconProp;
26
26
  };
27
27
  aria?: {
28
28
  mute?: string;
@@ -5,7 +5,6 @@ export declare const Widgets: {
5
5
  SpeedControl: (props: {
6
6
  className?: string;
7
7
  variant?: "menu" | "cycle";
8
- speedOptions?: number[];
9
8
  ariaLabel?: string;
10
9
  as?: (props: {
11
10
  defaultClassName: string;
@@ -2,5 +2,9 @@ export { default as VideoOverlay } from './VideoOverlay';
2
2
  export { default as Loading } from './Loading';
3
3
  export { default as Error } from './Error';
4
4
  export { default as Frame } from './Frame';
5
+ export { default as Player } from './Player';
6
+ export { default as Thumbnail } from './Thumbnail';
5
7
  export { Widgets } from './Widgets';
6
8
  export type { ButtonProps } from './Widgets';
9
+ export type { PlayerProps } from './Player';
10
+ export type { ThumbnailProps } from './Thumbnail';
@@ -1,3 +1,4 @@
1
- export { useVideoPlayerStore, useVideoPlayerShallow, VideoPlayerStoreContext, VideoPlayerImageContext, useVideoPlayerImage, DefaultImage, type VideoPlayerStoreApi, type VideoPlayerImageComponent, type VideoPlayerImageProps, } from './videoPlayer.context';
1
+ export { useVideoPlayerStore, useVideoPlayerShallow, VideoPlayerStoreContext, VideoPlayerImageContext, useVideoPlayerImage, DefaultImage, type VideoPlayerStoreApi, } from './videoPlayer.context';
2
2
  export { default as VideoPlayerProvider } from './videoPlayer.provider';
3
- export { createVideoPlayerStore, resolveVideoPlayerStoreConfig, type VideoPlayerStore, type VideoPlayerState, type VideoPlayerActions, type VideoPlayerStoreConfig, } from './videoPlayer.store';
3
+ export { createVideoPlayerStore, resolveVideoPlayerStoreConfig, } from './videoPlayer.store';
4
+ export type { VideoJsPlayer, VideoPlayerStoreConfig, VideoPlayerTextTrack, VideoPlayerEvents, VideoPlayerState, VideoPlayerActions, VideoPlayerStore, VideoPlayerExternalController, VideoPlayerImageProps, VideoPlayerImageComponent, VideoPlayerProviderProps, } from './videoPlayer.types';
@@ -1,15 +1,12 @@
1
1
  import { default as React } from 'react';
2
- import { createVideoPlayerStore, VideoPlayerStore } from './videoPlayer.store';
2
+ import { createVideoPlayerStore } from './videoPlayer.store';
3
+ import { VideoPlayerStore, VideoPlayerImageProps, VideoPlayerImageComponent } from './videoPlayer.types';
4
+ /**
5
+ * VideoPlayer 스토어 API 타입 (createVideoPlayerStore의 반환 타입)
6
+ */
3
7
  export type VideoPlayerStoreApi = ReturnType<typeof createVideoPlayerStore>;
8
+ export type { VideoPlayerImageProps, VideoPlayerImageComponent };
4
9
  export declare const VideoPlayerStoreContext: React.Context<import('zustand').UseBoundStore<import('zustand').StoreApi<VideoPlayerStore>> | undefined>;
5
- export type VideoPlayerImageProps = {
6
- src: string;
7
- alt: string;
8
- width?: number;
9
- height?: number;
10
- className?: string;
11
- };
12
- export type VideoPlayerImageComponent = React.ComponentType<VideoPlayerImageProps>;
13
10
  export declare const DefaultImage: (props: VideoPlayerImageProps) => import("react/jsx-runtime").JSX.Element;
14
11
  export declare const VideoPlayerImageContext: React.Context<VideoPlayerImageComponent>;
15
12
  export declare const useVideoPlayerImage: () => VideoPlayerImageComponent;
@@ -1,8 +1,3 @@
1
- import { default as React } from 'react';
2
- import { VideoPlayerStoreConfig } from './videoPlayer.store';
3
- type VideoPlayerProviderProps = {
4
- children: React.ReactNode;
5
- storeConfig?: Partial<VideoPlayerStoreConfig>;
6
- };
1
+ import { VideoPlayerProviderProps } from './videoPlayer.types';
7
2
  declare const VideoPlayerProvider: (props: VideoPlayerProviderProps) => import("react/jsx-runtime").JSX.Element;
8
3
  export default VideoPlayerProvider;
@@ -1,45 +1,27 @@
1
+ import { VideoPlayerStore, VideoPlayerStoreConfig, VideoPlayerEvents, VideoPlayerTextTrack } from './videoPlayer.types';
1
2
  import { default as videojs } from 'video.js';
2
- type VideoJsPlayer = ReturnType<typeof videojs>;
3
- export type VideoPlayerStoreConfig = {
4
- volumePersist: boolean;
5
- volumeStorageKey: string;
6
- volumeFallback: number;
7
- playbackRateDefault: number;
8
- };
9
- export type VideoPlayerState = {
10
- isLoading: boolean;
11
- hasError: boolean;
12
- isPlaying: boolean;
13
- currentTime: number;
14
- duration: number;
15
- buffered: number;
16
- volume: number;
17
- playbackRate: number;
18
- isFullscreen: boolean;
19
- isMuted: boolean;
20
- previousVolume: number;
21
- player: VideoJsPlayer | null;
22
- };
23
- export type VideoPlayerActions = {
24
- setPlayer: (player: VideoJsPlayer | null) => void;
25
- setLoading: (isLoading: boolean) => void;
26
- setError: (hasError: boolean) => void;
27
- setPlaying: (isPlaying: boolean) => void;
28
- setCurrentTime: (currentTime: number) => void;
29
- setDuration: (duration: number) => void;
30
- setBuffered: (buffered: number) => void;
31
- setVolume: (volume: number) => void;
32
- setPlaybackRate: (playbackRate: number) => void;
33
- setFullscreen: (isFullscreen: boolean) => void;
34
- setMuted: (isMuted: boolean) => void;
35
- handlePlayPause: () => void;
36
- handleSeek: (time: number) => void;
37
- handleVolumeChange: (volume: number) => void;
38
- handleSpeedChange: (speed: number) => void;
39
- handleFullscreenToggle: () => void;
40
- handleMuteToggle: () => void;
41
- };
42
- export type VideoPlayerStore = VideoPlayerState & VideoPlayerActions;
43
3
  export declare const resolveVideoPlayerStoreConfig: (config?: Partial<VideoPlayerStoreConfig>) => VideoPlayerStoreConfig;
44
- export declare const createVideoPlayerStore: (config?: Partial<VideoPlayerStoreConfig>) => import('zustand').UseBoundStore<import('zustand').StoreApi<VideoPlayerStore>>;
45
- export {};
4
+ export declare const createVideoPlayerStore: (config?: Partial<VideoPlayerStoreConfig>, videoProps?: {
5
+ width?: string | number;
6
+ height?: string | number;
7
+ src?: string;
8
+ sources?: {
9
+ src: string;
10
+ type: string;
11
+ }[];
12
+ speedOptions?: number[];
13
+ playerOptions?: Parameters<typeof videojs>[1];
14
+ events?: VideoPlayerEvents;
15
+ disableVideoJsStyles?: boolean;
16
+ tracks?: VideoPlayerTextTrack[];
17
+ initialActiveCaptionLang?: string | null;
18
+ activeCaptionLang?: string | null;
19
+ onCaptionLangChange?: (lang: string | null) => void;
20
+ autoHide?: boolean;
21
+ autoHideDelayMs?: number;
22
+ overlayClickAction?: "toggle-play" | "none";
23
+ loadingText?: string;
24
+ errorTitle?: string;
25
+ errorDescription?: string;
26
+ errorRetry?: string;
27
+ }) => import('zustand').UseBoundStore<import('zustand').StoreApi<VideoPlayerStore>>;