@weing-dev/ui-kit-primitive 0.1.2 → 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 (108) hide show
  1. package/README.md +9 -0
  2. package/dist/components/Accordion/Accordion.d.ts +3 -3
  3. package/dist/components/Avatar/Avatar.d.ts +2 -2
  4. package/dist/components/Badge/Badge.d.ts +2 -2
  5. package/dist/components/Breadcrumb/Breadcrumb.d.ts +5 -5
  6. package/dist/components/Button/Button.d.ts +4 -4
  7. package/dist/components/Button/button.augment.d.ts +17 -0
  8. package/dist/components/Calendar/Calendar.d.ts +6 -6
  9. package/dist/components/Cascader/Cascader.d.ts +4 -4
  10. package/dist/components/Chips/Chips.d.ts +2 -2
  11. package/dist/components/Comment/Comment.d.ts +2 -2
  12. package/dist/components/Editor/Editor.context.d.ts +2 -0
  13. package/dist/components/Editor/Editor.d.ts +17 -1
  14. package/dist/components/Editor/constants/editor.constants.d.ts +73 -24
  15. package/dist/components/Form/CheckBox/CheckBox.d.ts +4 -4
  16. package/dist/components/Form/Dropdown/Dropdown.d.ts +4 -4
  17. package/dist/components/Form/OTPInput/OTPInput.d.ts +2 -2
  18. package/dist/components/Form/Radio/Radio.d.ts +4 -4
  19. package/dist/components/Form/Switch/Switch.d.ts +3 -3
  20. package/dist/components/Form/TextArea/TextArea.d.ts +6 -6
  21. package/dist/components/Form/TextInput/TextInput.d.ts +5 -5
  22. package/dist/components/GlobalStyle/GlobalStyle.d.ts +2 -0
  23. package/dist/components/HelperText/HelperText.d.ts +3 -2
  24. package/dist/components/Icon/Icon.constant.d.ts +6 -0
  25. package/dist/components/Icon/Icon.d.ts +12 -9
  26. package/dist/components/Icon/context/icon.context.d.ts +5 -0
  27. package/dist/components/Icon/context/icon.provider.d.ts +8 -0
  28. package/dist/components/Icon/context/icon.store.d.ts +16 -0
  29. package/dist/components/Icon/context/index.d.ts +3 -0
  30. package/dist/components/Icon/icon.augment.d.ts +17 -0
  31. package/dist/components/Icons/BackButton.d.ts +3 -0
  32. package/dist/components/Icons/FullScreen.d.ts +3 -0
  33. package/dist/components/Icons/FullScreenClose.d.ts +3 -0
  34. package/dist/components/Icons/Pause.d.ts +3 -0
  35. package/dist/components/Icons/PictureQuality.d.ts +3 -0
  36. package/dist/components/Icons/Pip.d.ts +3 -0
  37. package/dist/components/Icons/PipExit.d.ts +3 -0
  38. package/dist/components/Icons/Play.d.ts +3 -0
  39. package/dist/components/Icons/PlaybackSpeed.d.ts +3 -0
  40. package/dist/components/Icons/Share.d.ts +3 -0
  41. package/dist/components/Icons/SubtitleFilled.d.ts +3 -0
  42. package/dist/components/Icons/SubtitleOutlined.d.ts +3 -0
  43. package/dist/components/Icons/VolumeOff.d.ts +3 -0
  44. package/dist/components/Icons/VolumeUp.d.ts +3 -0
  45. package/dist/components/Icons/index.d.ts +14 -0
  46. package/dist/components/LNB/LNB.d.ts +4 -4
  47. package/dist/components/Label/Label.d.ts +2 -2
  48. package/dist/components/List/List.d.ts +3 -3
  49. package/dist/components/Pagination/Pagination.d.ts +5 -5
  50. package/dist/components/Tab/Tab.d.ts +5 -5
  51. package/dist/components/Table/Table.d.ts +6 -6
  52. package/dist/components/TimeInput/TimeInput.d.ts +8 -8
  53. package/dist/components/VideoPlayer/VideoPlayer.d.ts +125 -0
  54. package/dist/components/VideoPlayer/VideoPlayer.utils.d.ts +45 -0
  55. package/dist/components/VideoPlayer/components/Error/Error.d.ts +15 -0
  56. package/dist/components/VideoPlayer/components/Error/index.d.ts +1 -0
  57. package/dist/components/VideoPlayer/components/Frame/Frame.d.ts +6 -0
  58. package/dist/components/VideoPlayer/components/Frame/index.d.ts +2 -0
  59. package/dist/components/VideoPlayer/components/Loading/Loading.d.ts +11 -0
  60. package/dist/components/VideoPlayer/components/Loading/index.d.ts +1 -0
  61. package/dist/components/VideoPlayer/components/Player/Player.d.ts +6 -0
  62. package/dist/components/VideoPlayer/components/Player/index.d.ts +2 -0
  63. package/dist/components/VideoPlayer/components/Thumbnail/Thumbnail.d.ts +8 -0
  64. package/dist/components/VideoPlayer/components/Thumbnail/index.d.ts +2 -0
  65. package/dist/components/VideoPlayer/components/VideoOverlay/VideoOverlay.d.ts +35 -0
  66. package/dist/components/VideoPlayer/components/VideoOverlay/index.d.ts +2 -0
  67. package/dist/components/VideoPlayer/components/Widgets/Button/Button.d.ts +13 -0
  68. package/dist/components/VideoPlayer/components/Widgets/Button/index.d.ts +2 -0
  69. package/dist/components/VideoPlayer/components/Widgets/ProgressBar/ProgressBar.d.ts +18 -0
  70. package/dist/components/VideoPlayer/components/Widgets/ProgressBar/index.d.ts +2 -0
  71. package/dist/components/VideoPlayer/components/Widgets/SpeedControl/SpeedControl.d.ts +21 -0
  72. package/dist/components/VideoPlayer/components/Widgets/SpeedControl/index.d.ts +1 -0
  73. package/dist/components/VideoPlayer/components/Widgets/Time/Time.d.ts +15 -0
  74. package/dist/components/VideoPlayer/components/Widgets/Time/index.d.ts +2 -0
  75. package/dist/components/VideoPlayer/components/Widgets/VolumeControl/VolumeControl.d.ts +34 -0
  76. package/dist/components/VideoPlayer/components/Widgets/VolumeControl/index.d.ts +2 -0
  77. package/dist/components/VideoPlayer/components/Widgets/index.d.ts +29 -0
  78. package/dist/components/VideoPlayer/components/index.d.ts +10 -0
  79. package/dist/components/VideoPlayer/context/index.d.ts +4 -0
  80. package/dist/components/VideoPlayer/context/videoPlayer.context.d.ts +15 -0
  81. package/dist/components/VideoPlayer/context/videoPlayer.provider.d.ts +3 -0
  82. package/dist/components/VideoPlayer/context/videoPlayer.store.d.ts +27 -0
  83. package/dist/components/VideoPlayer/context/videoPlayer.types.d.ts +351 -0
  84. package/dist/components/VideoPlayer/index.d.ts +18 -0
  85. package/dist/components/VideoPlayer/videoPlayer.constants.d.ts +55 -0
  86. package/dist/entry/augmentations.d.ts +4 -0
  87. package/dist/entry/components.d.ts +90 -0
  88. package/dist/entry/types.d.ts +36 -0
  89. package/dist/{index-BL3MWQXq.js → index-CsNmTnCb.js} +29 -38
  90. package/dist/index.css +2 -2
  91. package/dist/index.d.ts +3 -47
  92. package/dist/index.js +14884 -12979
  93. package/dist/index.umd.cjs +51 -15
  94. package/dist/static/icon/PictureQuality.svg +5 -0
  95. package/dist/static/icon/back_button.svg +8 -0
  96. package/dist/static/icon/full_screen.svg +3 -0
  97. package/dist/static/icon/full_screen_close.svg +1 -0
  98. package/dist/static/icon/pause.svg +1 -0
  99. package/dist/static/icon/pip.svg +8 -0
  100. package/dist/static/icon/pip_exit.svg +8 -0
  101. package/dist/static/icon/play.svg +3 -0
  102. package/dist/static/icon/playback_speed.svg +5 -0
  103. package/dist/static/icon/share.svg +1 -0
  104. package/dist/static/icon/subtitle_filled.svg +1 -0
  105. package/dist/static/icon/subtitle_outlined.svg +1 -0
  106. package/dist/static/icon/volume_off.svg +1 -0
  107. package/dist/static/icon/volume_up.svg +1 -0
  108. package/package.json +20 -19
@@ -0,0 +1,35 @@
1
+ import { default as React } from 'react';
2
+ type GridProps = {
3
+ className?: string;
4
+ children?: React.ReactNode;
5
+ } & React.JSX.IntrinsicElements["div"];
6
+ type SlotProps = {
7
+ className?: string;
8
+ children?: React.ReactNode;
9
+ } & React.JSX.IntrinsicElements["div"];
10
+ export type VideoOverlayRenderProps = {
11
+ showControls: boolean;
12
+ onMouseMove: () => void;
13
+ onMouseLeave: () => void;
14
+ onClick: (event: React.MouseEvent<Element>) => void;
15
+ isFullscreen: boolean;
16
+ isPictureInPicture: boolean;
17
+ };
18
+ export type VideoOverlayProps = {
19
+ className?: string;
20
+ onOverlayClick?: () => void;
21
+ children: (props: VideoOverlayRenderProps) => React.ReactNode;
22
+ };
23
+ declare const VideoOverlay: ((props: VideoOverlayProps) => import("react/jsx-runtime").JSX.Element) & {
24
+ Grid: (props: GridProps) => import("react/jsx-runtime").JSX.Element;
25
+ TopLeft: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
26
+ TopCenter: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
27
+ TopRight: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
28
+ MiddleLeft: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
29
+ MiddleCenter: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
30
+ MiddleRight: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
31
+ BottomLeft: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
32
+ BottomCenter: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
33
+ BottomRight: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
34
+ };
35
+ export default VideoOverlay;
@@ -0,0 +1,2 @@
1
+ export { default } from './VideoOverlay';
2
+ export type { VideoOverlayRenderProps } from './VideoOverlay';
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { Icon } from '../../../../Icon/Icon';
3
+ export type ButtonProps = {
4
+ /** Icon 컴포넌트에 전달할 props (name 필수, size·color 등 선택). children이 있으면 무시됨. */
5
+ icon?: React.ComponentProps<typeof Icon>;
6
+ /** 아이콘 대신 렌더할 내용 (예: SpeedControl의 "1x" 텍스트) */
7
+ children?: React.ReactNode;
8
+ onClick?: () => void;
9
+ ariaLabel?: string;
10
+ className?: string;
11
+ } & Omit<React.JSX.IntrinsicElements["button"], "onClick">;
12
+ declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
13
+ export default Button;
@@ -0,0 +1,2 @@
1
+ export { default } from './Button';
2
+ export type { ButtonProps } from './Button';
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ type ProgressBarAsProps = {
3
+ defaultClassName: string;
4
+ progress: number;
5
+ buffered: number;
6
+ ariaLabel: string;
7
+ onPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;
8
+ onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
9
+ trackRef: React.RefObject<HTMLDivElement | null>;
10
+ };
11
+ export type ProgressBarProps = {
12
+ className?: string;
13
+ onInteractionChange?: (isActive: boolean) => void;
14
+ ariaLabel?: string;
15
+ as?: (props: ProgressBarAsProps) => React.ReactNode;
16
+ };
17
+ declare const ProgressBar: (props: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default ProgressBar;
@@ -0,0 +1,2 @@
1
+ export { default } from './ProgressBar';
2
+ export type { ProgressBarProps } from './ProgressBar';
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ type SpeedControlAsProps = {
3
+ defaultClassName: string;
4
+ playbackRate: number;
5
+ speedOptions: readonly number[];
6
+ variant: "menu" | "cycle";
7
+ isOpen: boolean;
8
+ ariaLabel: string;
9
+ onButtonClick: () => void;
10
+ onSpeedSelect: (speed: number) => void;
11
+ onMouseEnter: () => void;
12
+ onMouseLeave: () => void;
13
+ };
14
+ type SpeedControlProps = {
15
+ className?: string;
16
+ variant?: "menu" | "cycle";
17
+ ariaLabel?: string;
18
+ as?: (props: SpeedControlAsProps) => React.ReactNode;
19
+ };
20
+ declare const SpeedControl: (props: SpeedControlProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default SpeedControl;
@@ -0,0 +1 @@
1
+ export { default } from './SpeedControl';
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ type TimeAsProps = {
3
+ defaultClassName: string;
4
+ currentTime: number;
5
+ duration: number;
6
+ formattedCurrentTime: string;
7
+ formattedDuration: string;
8
+ };
9
+ export type TimeProps = {
10
+ className?: string;
11
+ formatTime?: (time: number) => string;
12
+ as?: (props: TimeAsProps) => React.ReactNode;
13
+ };
14
+ declare const Time: (props: TimeProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default Time;
@@ -0,0 +1,2 @@
1
+ export { default } from './Time';
2
+ export type { TimeProps } from './Time';
@@ -0,0 +1,34 @@
1
+ import { default as React } from 'react';
2
+ import { IconName, StrictIconProps } from '../../../../Icon/Icon';
3
+ /** 아이콘: 이름만 주거나, name + 기타 Icon props 객체 */
4
+ type VolumeIconProp = IconName | (Pick<StrictIconProps, "name"> & Partial<Omit<StrictIconProps, "name">>);
5
+ type VolumeControlAsProps = {
6
+ defaultClassName: string;
7
+ volume: number;
8
+ isMuted: boolean;
9
+ ariaLabel: string;
10
+ onMuteToggle: () => void;
11
+ onVolumeChange: (volume: number) => void;
12
+ volumeOnIcon: IconName;
13
+ volumeOffIcon: IconName;
14
+ sliderVisible: boolean;
15
+ sliderValue: number;
16
+ onSliderFocus: (focused: boolean) => void;
17
+ onPointerDown: (event: React.PointerEvent<Element>) => void;
18
+ trackRef: React.RefObject<HTMLDivElement | null>;
19
+ };
20
+ export type VolumeControlProps = {
21
+ className?: string;
22
+ onInteractionChange?: (isActive: boolean) => void;
23
+ icons?: {
24
+ volumeOn?: VolumeIconProp;
25
+ volumeOff?: VolumeIconProp;
26
+ };
27
+ aria?: {
28
+ mute?: string;
29
+ unmute?: string;
30
+ };
31
+ as?: (props: VolumeControlAsProps) => React.ReactNode;
32
+ };
33
+ declare const VolumeControl: (props: VolumeControlProps) => import("react/jsx-runtime").JSX.Element;
34
+ export default VolumeControl;
@@ -0,0 +1,2 @@
1
+ export { default } from './VolumeControl';
2
+ export type { VolumeControlProps } from './VolumeControl';
@@ -0,0 +1,29 @@
1
+ export declare const Widgets: {
2
+ Button: (props: import('./Button').ButtonProps) => import("react/jsx-runtime").JSX.Element;
3
+ ProgressBar: (props: import('./ProgressBar').ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
4
+ VolumeControl: (props: import('./VolumeControl').VolumeControlProps) => import("react/jsx-runtime").JSX.Element;
5
+ SpeedControl: (props: {
6
+ className?: string;
7
+ variant?: "menu" | "cycle";
8
+ ariaLabel?: string;
9
+ as?: (props: {
10
+ defaultClassName: string;
11
+ playbackRate: number;
12
+ speedOptions: readonly number[];
13
+ variant: "menu" | "cycle";
14
+ isOpen: boolean;
15
+ ariaLabel: string;
16
+ onButtonClick: () => void;
17
+ onSpeedSelect: (speed: number) => void;
18
+ onMouseEnter: () => void;
19
+ onMouseLeave: () => void;
20
+ }) => React.ReactNode;
21
+ }) => import("react/jsx-runtime").JSX.Element;
22
+ Time: (props: import('./Time').TimeProps) => import("react/jsx-runtime").JSX.Element;
23
+ };
24
+ export { default as Button } from './Button';
25
+ export type { ButtonProps } from './Button';
26
+ export { default as ProgressBar } from './ProgressBar';
27
+ export { default as VolumeControl } from './VolumeControl';
28
+ export { default as SpeedControl } from './SpeedControl';
29
+ export { default as Time } from './Time';
@@ -0,0 +1,10 @@
1
+ export { default as VideoOverlay } from './VideoOverlay';
2
+ export { default as Loading } from './Loading';
3
+ export { default as Error } from './Error';
4
+ export { default as Frame } from './Frame';
5
+ export { default as Player } from './Player';
6
+ export { default as Thumbnail } from './Thumbnail';
7
+ export { Widgets } from './Widgets';
8
+ export type { ButtonProps } from './Widgets';
9
+ export type { PlayerProps } from './Player';
10
+ export type { ThumbnailProps } from './Thumbnail';
@@ -0,0 +1,4 @@
1
+ export { useVideoPlayerStore, useVideoPlayerShallow, VideoPlayerStoreContext, VideoPlayerImageContext, useVideoPlayerImage, DefaultImage, type VideoPlayerStoreApi, } from './videoPlayer.context';
2
+ export { default as VideoPlayerProvider } from './videoPlayer.provider';
3
+ export { createVideoPlayerStore, resolveVideoPlayerStoreConfig, } from './videoPlayer.store';
4
+ export type { VideoJsPlayer, VideoPlayerStoreConfig, VideoPlayerTextTrack, VideoPlayerEvents, VideoPlayerState, VideoPlayerActions, VideoPlayerStore, VideoPlayerExternalController, VideoPlayerImageProps, VideoPlayerImageComponent, VideoPlayerProviderProps, } from './videoPlayer.types';
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { createVideoPlayerStore } from './videoPlayer.store';
3
+ import { VideoPlayerStore, VideoPlayerImageProps, VideoPlayerImageComponent } from './videoPlayer.types';
4
+ /**
5
+ * VideoPlayer 스토어 API 타입 (createVideoPlayerStore의 반환 타입)
6
+ */
7
+ export type VideoPlayerStoreApi = ReturnType<typeof createVideoPlayerStore>;
8
+ export type { VideoPlayerImageProps, VideoPlayerImageComponent };
9
+ export declare const VideoPlayerStoreContext: React.Context<import('zustand').UseBoundStore<import('zustand').StoreApi<VideoPlayerStore>> | undefined>;
10
+ export declare const DefaultImage: (props: VideoPlayerImageProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const VideoPlayerImageContext: React.Context<VideoPlayerImageComponent>;
12
+ export declare const useVideoPlayerImage: () => VideoPlayerImageComponent;
13
+ export declare const useVideoPlayerStore: <R>(selector: (store: VideoPlayerStore) => R) => R;
14
+ export declare function useVideoPlayerShallow<R>(selector: (store: VideoPlayerStore) => R): R;
15
+ export declare function useVideoPlayerShallow<K extends keyof VideoPlayerStore>(keys: readonly K[]): Pick<VideoPlayerStore, K>;
@@ -0,0 +1,3 @@
1
+ import { VideoPlayerProviderProps } from './videoPlayer.types';
2
+ declare const VideoPlayerProvider: (props: VideoPlayerProviderProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default VideoPlayerProvider;
@@ -0,0 +1,27 @@
1
+ import { VideoPlayerStore, VideoPlayerStoreConfig, VideoPlayerEvents, VideoPlayerTextTrack } from './videoPlayer.types';
2
+ import { default as videojs } from 'video.js';
3
+ export declare const resolveVideoPlayerStoreConfig: (config?: Partial<VideoPlayerStoreConfig>) => VideoPlayerStoreConfig;
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>>;
@@ -0,0 +1,351 @@
1
+ import { default as React } from 'react';
2
+ import { default as videojs } from 'video.js';
3
+ /**
4
+ * Video.js 플레이어 인스턴스 타입
5
+ */
6
+ export type VideoJsPlayer = ReturnType<typeof videojs>;
7
+ /**
8
+ * VideoPlayer 스토어 설정 타입
9
+ */
10
+ export type VideoPlayerStoreConfig = {
11
+ /** 볼륨 값을 `localStorage` 등에 저장할지 여부 */
12
+ volumePersist: boolean;
13
+ /** 볼륨 영속화 시 사용하는 스토리지 키 */
14
+ volumeStorageKey: string;
15
+ /** 저장값이 없을 때 사용할 기본 볼륨(0~1) */
16
+ volumeFallback: number;
17
+ /** 최초(및 리셋 시) 재생 속도 배율 */
18
+ playbackRateDefault: number;
19
+ };
20
+ /**
21
+ * 자막 트랙 한 개 (HTML track / Video.js text track).
22
+ * Video.js에 넘기는 트랙의 `default` 여부는 여기서 받지 않고 `Player`가 `activeCaptionLang`·`srclang`으로 계산한다.
23
+ */
24
+ export type VideoPlayerTextTrack = {
25
+ /** 트랙 리소스 URL (VTT 등) */
26
+ src: string;
27
+ /** 트랙 종류. 미지정 시 플레이어/브라우저 기본에 따름 */
28
+ kind?: "subtitles" | "captions" | "descriptions" | "chapters" | "metadata";
29
+ /** BCP 47 언어 태그. 자막 on/off·선택에 사용 */
30
+ srclang?: string;
31
+ /** UI에 표시할 트랙 이름 */
32
+ label?: string;
33
+ };
34
+ /**
35
+ * VideoPlayer 이벤트 타입
36
+ */
37
+ export type VideoPlayerEvents = {
38
+ /** Video.js 인스턴스가 준비되었을 때 */
39
+ onReady?: (player: VideoJsPlayer) => void;
40
+ /** 미디어 로드가 시작되었을 때 */
41
+ onLoadStart?: () => void;
42
+ /** 재생을 시작할 수 있을 만큼 버퍼가 찼을 때 */
43
+ onCanPlay?: () => void;
44
+ /** 재생이 시작되었을 때 */
45
+ onPlay?: () => void;
46
+ /** 일시정지되었을 때 */
47
+ onPause?: () => void;
48
+ /**
49
+ * 재생 위치가 갱신될 때
50
+ * @param currentTime 초 단위 현재 재생 시각
51
+ */
52
+ onTimeUpdate?: (currentTime: number) => void;
53
+ /**
54
+ * 버퍼 진행이 갱신될 때
55
+ * @param buffered 초 단위로 해석 가능한 버퍼 관련 값(구현에 따름)
56
+ */
57
+ onProgress?: (buffered: number) => void;
58
+ /**
59
+ * 볼륨이 변경되었을 때
60
+ * @param volume 0~1
61
+ */
62
+ onVolumeChange?: (volume: number) => void;
63
+ /**
64
+ * 재생 배속이 변경되었을 때
65
+ * @param rate 배율(예: 1, 1.5)
66
+ */
67
+ onRateChange?: (rate: number) => void;
68
+ /**
69
+ * 전체화면 상태가 바뀌었을 때
70
+ * @param isFullscreen 전체화면이면 true
71
+ */
72
+ onFullscreenChange?: (isFullscreen: boolean) => void;
73
+ /**
74
+ * Picture-in-Picture 상태가 바뀌었을 때
75
+ * @param active PiP 모드이면 true
76
+ */
77
+ onPictureInPictureChange?: (active: boolean) => void;
78
+ /**
79
+ * 총 재생 길이가 확정·변경되었을 때
80
+ * @param duration 초 단위 길이
81
+ */
82
+ onDurationChange?: (duration: number) => void;
83
+ /** 재생이 끝까지 도달했을 때(video `ended`). 스토어의 `isPlaying`은 false로 맞춤 */
84
+ onEnded?: () => void;
85
+ /**
86
+ * 재생 또는 로드 중 오류가 났을 때
87
+ * @param error 원인 객체(플랫폼·Video.js에 따라 상이)
88
+ */
89
+ onError?: (error: unknown) => void;
90
+ };
91
+ /**
92
+ * VideoPlayer 스토어 상태 타입
93
+ */
94
+ export type VideoPlayerState = {
95
+ /** 미디어가 아직 재생 가능하지 않고 로딩 중인지 */
96
+ isLoading: boolean;
97
+ /** 재생/로드 오류가 발생한 상태인지 */
98
+ hasError: boolean;
99
+ /** 현재 재생 중인지 */
100
+ isPlaying: boolean;
101
+ /** 현재 재생 시각(초) */
102
+ currentTime: number;
103
+ /** 총 길이(초). 미확정 시 0에 가깝게 유지될 수 있음 */
104
+ duration: number;
105
+ /** 버퍼링 관련 진행 값(초 단위로 쓰는 흐름과 연동) */
106
+ buffered: number;
107
+ /** 볼륨 0~1 */
108
+ volume: number;
109
+ /** 현재 재생 배속 */
110
+ playbackRate: number;
111
+ /** 브라우저 전체화면 API 기준 전체화면 여부 */
112
+ isFullscreen: boolean;
113
+ /** Picture-in-Picture 모드 여부 */
114
+ isPictureInPicture: boolean;
115
+ /** 음소거 여부 */
116
+ isMuted: boolean;
117
+ /** 음소거 전 마지막 볼륨(토글 복원용) */
118
+ previousVolume: number;
119
+ /** Video.js 플레이어 인스턴스. 언마운트 전까지 null일 수 있음 */
120
+ player: VideoJsPlayer | null;
121
+ /** 플레이어 컨테이너 너비(CSS 값 또는 px 숫자) */
122
+ width: string | number;
123
+ /** 플레이어 컨테이너 높이(CSS 값 또는 px 숫자) */
124
+ height: string | number;
125
+ /** 단일 소스 URL. `sources`와 함께 쓰일 때 우선순위는 Player 구현에 따름 */
126
+ src: string | null;
127
+ /** 다중 소스(코덱/포맷별). null이면 미설정 */
128
+ sources: {
129
+ src: string;
130
+ type: string;
131
+ }[] | null;
132
+ /** 배속 선택 UI에 노출할 배율 목록 */
133
+ speedOptions: number[];
134
+ /** Video.js 생성자에 넘기는 옵션 */
135
+ playerOptions: Parameters<typeof videojs>[1] | null;
136
+ /** Root 등에서 주입한 이벤트 콜백 묶음 */
137
+ events: VideoPlayerEvents | null;
138
+ /** true면 Video.js 기본 스타일 주입을 생략 */
139
+ disableVideoJsStyles: boolean;
140
+ /** 로드할 텍스트 트랙(자막 등) 목록 */
141
+ tracks: VideoPlayerTextTrack[];
142
+ /**
143
+ * 현재 표시할 자막의 `srclang`. `null`이면 자막 끔.
144
+ * 외부에서 `activeCaptionLang`으로 제어하거나 스토어 내부에서 관리.
145
+ */
146
+ activeCaptionLang: string | null;
147
+ /**
148
+ * controlled 모드: 자막 언어가 바뀔 때 부모에 알림
149
+ * @param lang 선택된 `srclang`, 끔이면 null
150
+ */
151
+ onCaptionLangChange?: (lang: string | null) => void;
152
+ /** 오버레이 UI(그리드 영역)를 일정 시간 후 자동으로 숨길지 */
153
+ autoHide: boolean;
154
+ /** 자동 숨김까지 유휴 시간(ms) */
155
+ autoHideDelayMs: number;
156
+ /**
157
+ * 오버레이 빈 영역 클릭 시 동작.
158
+ * `toggle-play`: 재생/일시정지 토글, `none`: 토글 없음(전용 버튼만)
159
+ */
160
+ overlayClickAction: "toggle-play" | "none";
161
+ /** 오버레이 안의 컨트롤(슬롯 콘텐츠)가 보이는지 */
162
+ overlayControlsVisible: boolean;
163
+ /**
164
+ * true면 재생 중에도 자동 숨김 타이머를 돌리지 않음.
165
+ * 예: 설정 메뉴가 열린 동안 컨트롤을 유지할 때
166
+ */
167
+ overlayAutoHideSuspended: boolean;
168
+ /** 로딩 UI에 표시할 문구 */
169
+ loadingText: string;
170
+ /** 에러 UI 제목 */
171
+ errorTitle: string;
172
+ /** 에러 UI 본문 설명 */
173
+ errorDescription: string;
174
+ /** 에러 UI 재시도 버튼 라벨 */
175
+ errorRetry: string;
176
+ };
177
+ /**
178
+ * VideoPlayer 스토어 액션 타입
179
+ */
180
+ export type VideoPlayerActions = {
181
+ /**
182
+ * 상태를 부분 갱신. 단순 필드 덮어쓰기용
183
+ * @param updates 바꿀 필드만 담은 객체
184
+ */
185
+ setState: (updates: Partial<VideoPlayerState>) => void;
186
+ /** 오버레이 위에서 포인터가 움직임 → 자동 숨김 타이머 리셋, 필요 시 컨트롤 표시 */
187
+ notifyOverlayPointerActivity: () => void;
188
+ /** 오버레이 루트에서 포인터가 이탈했을 때 호출 */
189
+ notifyOverlayPointerLeave: () => void;
190
+ /** 예약된 오버레이 자동 숨김 타이머만 취소(언마운트 등) */
191
+ clearOverlayAutoHideTimer: () => void;
192
+ /** Video.js 인스턴스를 스토어에 연결하거나 해제 */
193
+ setPlayer: (player: VideoJsPlayer | null) => void;
194
+ /**
195
+ * 볼륨만 갱신(내부에서 음소거·previousVolume 등과 동기화)
196
+ * @param volume 0~1
197
+ */
198
+ setVolume: (volume: number) => void;
199
+ /** 재생 ↔ 일시정지 토글 */
200
+ handlePlayPause: () => void;
201
+ /**
202
+ * 지정 시각으로 시킹
203
+ * @param time 초
204
+ */
205
+ handleSeek: (time: number) => void;
206
+ /**
207
+ * 지정 시각으로 시킹한 뒤 재생을 시도한다.
208
+ * @param time 초
209
+ */
210
+ handleSeekAndPlay: (time: number) => void;
211
+ /**
212
+ * 볼륨 변경(슬라이더 등 UI에서 호출)
213
+ * @param volume 0~1
214
+ */
215
+ handleVolumeChange: (volume: number) => void;
216
+ /**
217
+ * 재생 배속 변경
218
+ * @param speed 배율(`speedOptions`에 포함된 값 권장)
219
+ */
220
+ handleSpeedChange: (speed: number) => void;
221
+ /** 전체화면 입·퇴장 토글 */
222
+ handleFullscreenToggle: () => void;
223
+ /** Picture-in-Picture 입·퇴장 토글 */
224
+ handlePictureInPictureToggle: () => void;
225
+ /** 음소거 토글 */
226
+ handleMuteToggle: () => void;
227
+ /** 자막 표시 토글(언어는 `activeCaptionLang` 흐름과 연동) */
228
+ handleCaptionToggle: () => void;
229
+ /**
230
+ * 표시할 자막 언어 설정
231
+ * @param lang `srclang` 또는 `null`(끔)
232
+ */
233
+ setActiveCaptionLang: (lang: string | null) => void;
234
+ };
235
+ /**
236
+ * VideoPlayer 스토어 전체 타입 (State + Actions)
237
+ */
238
+ export type VideoPlayerStore = VideoPlayerState & VideoPlayerActions;
239
+ /**
240
+ * VideoPlayer 외부 제어 API 타입.
241
+ * `VideoPlayer.Root`의 `controllerRef`로 받아 컨텍스트 밖에서도 안전하게 제어할 수 있다.
242
+ */
243
+ export type VideoPlayerExternalController = {
244
+ /** 현재 Video.js 플레이어 인스턴스 반환 (없으면 null) */
245
+ getPlayer: () => VideoJsPlayer | null;
246
+ /** 현재 재생 중 여부 */
247
+ isPlaying: () => boolean;
248
+ /** 현재 재생 시각(초) */
249
+ getCurrentTime: () => number;
250
+ /** 총 길이(초) */
251
+ getDuration: () => number;
252
+ /** 재생 */
253
+ play: () => void;
254
+ /** 일시정지 */
255
+ pause: () => void;
256
+ /** 재생/일시정지 토글 */
257
+ togglePlayPause: () => void;
258
+ /**
259
+ * 지정 시점으로 이동
260
+ * @param time - 초 단위 재생 위치
261
+ */
262
+ seek: (time: number) => void;
263
+ /**
264
+ * 지정 시점으로 이동 후 재생
265
+ * @param time - 초 단위 재생 위치
266
+ */
267
+ seekAndPlay: (time: number) => void;
268
+ /** Picture-in-Picture 토글 */
269
+ togglePictureInPicture: () => void;
270
+ /** 전체화면 토글 */
271
+ toggleFullscreen: () => void;
272
+ };
273
+ /**
274
+ * VideoPlayer 이미지 컴포넌트의 Props 타입
275
+ */
276
+ export type VideoPlayerImageProps = {
277
+ /** 이미지 URL */
278
+ src: string;
279
+ /** 대체 텍스트(접근성) */
280
+ alt: string;
281
+ /** 픽셀 너비(선택) */
282
+ width?: number;
283
+ /** 픽셀 높이(선택) */
284
+ height?: number;
285
+ /** 추가 CSS 클래스 */
286
+ className?: string;
287
+ };
288
+ /**
289
+ * VideoPlayer 이미지 컴포넌트 타입
290
+ */
291
+ export type VideoPlayerImageComponent = React.ComponentType<VideoPlayerImageProps>;
292
+ /**
293
+ * VideoPlayer Provider Props 타입
294
+ */
295
+ export type VideoPlayerProviderProps = {
296
+ /** Provider 하위 트리 */
297
+ children: React.ReactNode;
298
+ /** 스토어 기본 설정 일부만 덮어쓰기 */
299
+ storeConfig?: Partial<VideoPlayerStoreConfig>;
300
+ /** 플레이어 레이아웃 너비 */
301
+ width?: string | number;
302
+ /** 플레이어 레이아웃 높이 */
303
+ height?: string | number;
304
+ /** 단일 미디어 소스 URL */
305
+ src?: string;
306
+ /** 타입별 소스 배열(예: HLS + MP4) */
307
+ sources?: {
308
+ src: string;
309
+ type: string;
310
+ }[];
311
+ /** 배속 선택지 배열 */
312
+ speedOptions?: number[];
313
+ /** Video.js 옵션 */
314
+ playerOptions?: Parameters<typeof videojs>[1];
315
+ /** 재생·로드 라이프사이클 콜백 */
316
+ events?: VideoPlayerEvents;
317
+ /** Video.js 기본 스타일 비활성화 */
318
+ disableVideoJsStyles?: boolean;
319
+ /** 자막 등 텍스트 트랙 */
320
+ tracks?: VideoPlayerTextTrack[];
321
+ /** 마운트 시 초기 자막 언어(`srclang`). null이면 끔 */
322
+ initialActiveCaptionLang?: string | null;
323
+ /**
324
+ * controlled: 현재 자막 언어. 넣으면 스토어가 이 값을 따름
325
+ */
326
+ activeCaptionLang?: string | null;
327
+ /**
328
+ * controlled: 자막 언어 변경 시 부모 콜백
329
+ * @param lang 선택 언어 또는 null
330
+ */
331
+ onCaptionLangChange?: (lang: string | null) => void;
332
+ /** 오버레이 자동 숨김 사용 여부 */
333
+ autoHide?: boolean;
334
+ /** 자동 숨김 지연(ms) */
335
+ autoHideDelayMs?: number;
336
+ /** 오버레이 빈 영역 클릭 시 재생 토글 여부 */
337
+ overlayClickAction?: "toggle-play" | "none";
338
+ /** 로딩 오버레이 문구 */
339
+ loadingText?: string;
340
+ /** 에러 제목 */
341
+ errorTitle?: string;
342
+ /** 에러 설명 */
343
+ errorDescription?: string;
344
+ /** 에러 재시도 버튼 문구 */
345
+ errorRetry?: string;
346
+ /**
347
+ * 외부에서 재생·시킹·PiP 등을 제어할 때 사용.
348
+ * 마운트 후 `current`에 `VideoPlayerExternalController`가 채워지며, 언마운트 시 `null`로 비운다.
349
+ */
350
+ controllerRef?: React.MutableRefObject<VideoPlayerExternalController | null>;
351
+ };
@@ -0,0 +1,18 @@
1
+ export { default as VideoPlayer } from './VideoPlayer';
2
+ export type { VideoPlayerRootProps } from './VideoPlayer';
3
+ export { useVideoPlayerStore, useVideoPlayerShallow, VideoPlayerStoreContext, VideoPlayerImageContext, useVideoPlayerImage, DefaultImage, VideoPlayerProvider, createVideoPlayerStore, resolveVideoPlayerStoreConfig, } from './context';
4
+ export { VIDEO_PLAYER_DEFAULTS } from './videoPlayer.constants';
5
+ export { convertSrtToVtt, getHtmlVideoElementFromVideoJs, isSrtSubtitleSource, parseWebVttToCues, } from './VideoPlayer.utils';
6
+ export type { VttCue } from './VideoPlayer.utils';
7
+ export { convertSrtToVtt as videeoPlayerConvertSrtToVtt, parseWebVttToCues as videeoPlayerParseWebVttToCues, convertSrtToVtt as VideeoPlayerConvertSrtToVtt, parseWebVttToCues as VideeoPlayerParseWebVttToCues, } from './VideoPlayer.utils';
8
+ export type { VttCue as VideeoPlayerVttCue } from './VideoPlayer.utils';
9
+ export type { VideoPlayerStoreApi, VideoPlayerImageComponent, VideoPlayerImageProps, VideoPlayerStore, VideoPlayerState, VideoPlayerActions, VideoPlayerStoreConfig, VideoPlayerTextTrack, VideoPlayerEvents, VideoPlayerExternalController, VideoJsPlayer, VideoPlayerProviderProps, } from './context';
10
+ export type { IVideoPlayer, VideoPlayerRootProps as VideoPlayerProps, } from './VideoPlayer';
11
+ export type VideoPlayerControls = Record<string, never>;
12
+ export type VideoPlayerTexts = Record<string, never>;
13
+ export type VideoPlayerAria = Record<string, never>;
14
+ export type VideoPlayerIcons = Record<string, never>;
15
+ export type VideeoPlayerControls = VideoPlayerControls;
16
+ export type VideeoPlayerTexts = VideoPlayerTexts;
17
+ export type VideeoPlayerAria = VideoPlayerAria;
18
+ export type VideeoPlayerIcons = VideoPlayerIcons;