@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
package/README.md CHANGED
@@ -66,6 +66,8 @@ To install Lobe UI, run the following command:
66
66
  $ pnpm add @lobehub/ui
67
67
  ```
68
68
 
69
+ Upgrading from 5.x? Follow the [v6 migration guide](https://ui.lobehub.com/migration-v6) and run `npx @lobehub/ui-codemod@beta v6 .`.
70
+
69
71
  ### Compile with NextJS
70
72
 
71
73
  > \[!NOTE]\
@@ -126,7 +128,7 @@ With Tailwind v4, use one merged statement as the very first CSS, before `@impor
126
128
  @layer theme, base, lobe-base, lobe-popup, lobe-ui, components, utilities;
127
129
  ```
128
130
 
129
- The lobe layers sit after Tailwind's `base` (preflight), so preflight loses to Lobe UI, and before `components` / `utilities`, so Tailwind utilities still beat Lobe UI. These layering guarantees cover components already migrated to StyleX; the remaining components still inject runtime styles until the migration completes.
131
+ The lobe layers sit after Tailwind's `base` (preflight), so preflight loses to Lobe UI, and before `components` / `utilities`, so Tailwind utilities still beat Lobe UI.
130
132
 
131
133
  ### Theming
132
134
 
@@ -2,10 +2,10 @@ import "@stylexjs/stylex";
2
2
  //#region src/Accordion/style.d.ts
3
3
  export declare const accordionStyles: {
4
4
  panel: string;
5
- header: string;
6
5
  action: string;
7
6
  content: string;
8
7
  trigger: string;
8
+ header: string;
9
9
  root: string;
10
10
  indicator: string;
11
11
  item: string;
@@ -51,4 +51,5 @@ type BorderlessOutdentProps<V extends ActionIconVariant> = [V] extends ['borderl
51
51
  };
52
52
  export type ActionIconProps<V extends ActionIconVariant = ActionIconVariant> = BaseActionIconOwnProps & BorderlessOutdentProps<V>;
53
53
  //#endregion
54
+ export {};
54
55
  //# sourceMappingURL=type.d.mts.map
@@ -106,4 +106,5 @@ interface AlertOwnProps {
106
106
  type NativeAlertProps = Omit<HTMLAttributes<HTMLDivElement>, keyof AlertOwnProps | 'children' | 'title'>;
107
107
  export type AlertProps = AlertOwnProps & NativeAlertProps;
108
108
  //#endregion
109
+ export {};
109
110
  //# sourceMappingURL=type.d.mts.map
@@ -42,7 +42,7 @@ declare const styleArrays: {
42
42
  }> | Readonly<{
43
43
  readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "transparent">;
44
44
  readonly cursor: stylex.StyleXClassNameFor<"cursor", "default">;
45
- readonly display: stylex.StyleXClassNameFor<"display", "none" | "flex">;
45
+ readonly display: stylex.StyleXClassNameFor<"display", "flex" | "none">;
46
46
  }>)[];
47
47
  item: Readonly<{
48
48
  readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
@@ -103,4 +103,5 @@ declare const styleArrays: {
103
103
  };
104
104
  export declare const styles: Record<keyof typeof styleArrays, string>;
105
105
  //#endregion
106
+ export {};
106
107
  //# sourceMappingURL=style.d.mts.map
@@ -36,4 +36,5 @@ export interface AutoCompleteProps extends BaseAutocompleteProps {
36
36
  variant?: InputProps['variant'];
37
37
  }
38
38
  //#endregion
39
+ export {};
39
40
  //# sourceMappingURL=type.d.mts.map
@@ -50,4 +50,5 @@ type NativeButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof Bas
50
50
  type NativeAnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseButtonOwnProps | 'type' | 'outdent'>;
51
51
  export type ButtonProps<T extends ButtonType = ButtonType> = BaseButtonOwnProps & NativeButtonProps & Partial<NativeAnchorProps> & TextOutdentProps<T>;
52
52
  //#endregion
53
+ export {};
53
54
  //# sourceMappingURL=type.d.mts.map
@@ -49,4 +49,5 @@ export interface CheckboxGroupProps extends BaseCheckboxGroupProps, Pick<Flexbox
49
49
  textProps?: CheckboxProps['textProps'];
50
50
  }
51
51
  //#endregion
52
+ export {};
52
53
  //# sourceMappingURL=type.d.mts.map
@@ -23,4 +23,5 @@ export interface ColorSwatchesProps extends Omit<FlexboxProps, 'onChange'> {
23
23
  value?: string;
24
24
  }
25
25
  //#endregion
26
+ export {};
26
27
  //# sourceMappingURL=type.d.mts.map
@@ -55,4 +55,5 @@ export type DrawerTriggerProps = Omit<React.ComponentPropsWithRef<typeof Dialog.
55
55
  };
56
56
  export declare const DrawerTrigger: ({ children, className, nativeButton, ref: refProp, ...rest }: DrawerTriggerProps) => React.JSX.Element;
57
57
  //#endregion
58
+ export {};
58
59
  //# sourceMappingURL=atoms.d.mts.map
@@ -13,4 +13,5 @@ export declare const drawerBackdropTransition: {
13
13
  ease: CubicBezier;
14
14
  };
15
15
  //#endregion
16
+ export {};
16
17
  //# sourceMappingURL=constants.d.mts.map
@@ -12,4 +12,5 @@ export interface FileTypeIconProps extends IconProps {
12
12
  variant?: 'color' | 'mono';
13
13
  }
14
14
  //#endregion
15
+ export {};
15
16
  //# sourceMappingURL=type.d.mts.map
@@ -138,4 +138,5 @@ export interface FormContextValue {
138
138
  variant: FormVariant;
139
139
  }
140
140
  //#endregion
141
+ export {};
141
142
  //# sourceMappingURL=type.d.mts.map
@@ -14,4 +14,5 @@ export interface GroupAvatarProps extends Omit<BlockProps, 'width' | 'height' |
14
14
  size?: number;
15
15
  }
16
16
  //#endregion
17
+ export {};
17
18
  //# sourceMappingURL=type.d.mts.map
@@ -5,4 +5,5 @@ interface HighlighterThemeItem {
5
5
  }
6
6
  export declare const highlighterThemes: HighlighterThemeItem[];
7
7
  //#endregion
8
+ export {};
8
9
  //# sourceMappingURL=const.d.mts.map
@@ -37,4 +37,5 @@ export declare const inputClassNames: {
37
37
  textareaWithCount: string;
38
38
  };
39
39
  //#endregion
40
+ export {};
40
41
  //# sourceMappingURL=style.d.mts.map
@@ -128,4 +128,5 @@ export interface TextAreaProps extends Omit<ComponentProps<'textarea'>, 'prefix'
128
128
  styles?: Pick<InputStyles, 'input'>;
129
129
  }
130
130
  //#endregion
131
+ export {};
131
132
  //# sourceMappingURL=type.d.mts.map
@@ -16,4 +16,5 @@ interface RemarkColorOptions {
16
16
  */
17
17
  export declare const remarkColor: (options?: RemarkColorOptions) => (tree: any) => void;
18
18
  //#endregion
19
+ export {};
19
20
  //# sourceMappingURL=remarkColor.d.mts.map
@@ -4,4 +4,5 @@ interface RemarkGfmPlusOptions {
4
4
  }
5
5
  export declare const remarkGfmPlus: (options?: RemarkGfmPlusOptions) => (tree: any) => void;
6
6
  //#endregion
7
+ export {};
7
8
  //# sourceMappingURL=remarkGfmPlus.d.mts.map
@@ -16,4 +16,5 @@ interface RemarkVideoOptions {
16
16
  */
17
17
  export declare const remarkVideo: (options?: RemarkVideoOptions) => (tree: any) => void;
18
18
  //#endregion
19
+ export {};
19
20
  //# sourceMappingURL=remarkVideo.d.mts.map
@@ -6,4 +6,5 @@ interface MermaidThemeItem {
6
6
  }
7
7
  export declare const mermaidThemes: MermaidThemeItem[];
8
8
  //#endregion
9
+ export {};
9
10
  //# sourceMappingURL=const.d.mts.map
@@ -51,4 +51,5 @@ export type ModalTriggerProps = Omit<React.ComponentPropsWithRef<typeof Dialog.T
51
51
  };
52
52
  export declare const ModalTrigger: ({ children, className, nativeButton, ref: refProp, ...rest }: ModalTriggerProps) => React.JSX.Element;
53
53
  //#endregion
54
+ export {};
54
55
  //# sourceMappingURL=atoms.d.mts.map
@@ -7,4 +7,5 @@ export declare const backdropTransition: {
7
7
  ease: CubicBezier;
8
8
  };
9
9
  //#endregion
10
+ export {};
10
11
  //# sourceMappingURL=constants.d.mts.map
@@ -104,4 +104,5 @@ export interface ModalConfirmConfig {
104
104
  width?: number | string;
105
105
  }
106
106
  //#endregion
107
+ export {};
107
108
  //# sourceMappingURL=type.d.mts.map
@@ -55,4 +55,5 @@ export interface RadioGroupProps extends BaseRadioGroupProps {
55
55
  textProps?: RadioProps['textProps'];
56
56
  }
57
57
  //#endregion
58
+ export {};
58
59
  //# sourceMappingURL=type.d.mts.map
@@ -36,4 +36,5 @@ export interface SegmentedIndicatorProps {
36
36
  }
37
37
  export declare const SegmentedIndicator: FC<SegmentedIndicatorProps>;
38
38
  //#endregion
39
+ export {};
39
40
  //# sourceMappingURL=atoms.d.mts.map
@@ -44,4 +44,5 @@ export interface SliderWithInputProps extends Omit<SliderProps, 'classNames' | '
44
44
  variant?: InputVariant;
45
45
  }
46
46
  //#endregion
47
+ export {};
47
48
  //# sourceMappingURL=type.d.mts.map
@@ -33,4 +33,5 @@ export declare const switchStyles: {
33
33
  thumbSmall: string;
34
34
  };
35
35
  //#endregion
36
+ export {};
36
37
  //# sourceMappingURL=atoms.d.mts.map
@@ -15,8 +15,8 @@ export declare const textStyles: {
15
15
  disabled: string;
16
16
  danger: string;
17
17
  success: string;
18
- warning: string;
19
18
  info: string;
19
+ warning: string;
20
20
  delete: string;
21
21
  ellipsis: string;
22
22
  italic: string;
@@ -44,4 +44,5 @@ type TextVariantProps = {
44
44
  };
45
45
  export declare const variants: (props?: TextVariantProps) => string;
46
46
  //#endregion
47
+ export {};
47
48
  //# sourceMappingURL=style.d.mts.map
@@ -30,4 +30,5 @@ export declare const ToggleGroupItemIcon: FC<SimpleSpanProps>;
30
30
  export declare const ToggleGroupItemLabel: FC<SimpleSpanProps>;
31
31
  export declare const toggleGroupStyles: Record<keyof typeof styles, string>;
32
32
  //#endregion
33
+ export {};
33
34
  //# sourceMappingURL=atoms.d.mts.map
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { useVideo } from "./useVideo.mjs";
3
+ import Caption from "./parts/Caption.mjs";
4
+ import CenterPlay from "./parts/CenterPlay.mjs";
5
+ import Timeline from "./parts/Timeline.mjs";
6
+ import Controls from "./parts/Controls.mjs";
7
+ import Frame from "./parts/Frame.mjs";
8
+ import LoadError from "./parts/LoadError.mjs";
9
+ import Root from "./parts/Root.mjs";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import clsx from "clsx";
12
+ //#region src/Video/Video.tsx
13
+ const Overlay = ({ render }) => /* @__PURE__ */ jsx(Fragment, { children: render(useVideo()) });
14
+ const Video = ({ className, classNames, frameStep, overlay, style, styles: customStyles, thumbnails = true, ...rest }) => /* @__PURE__ */ jsx(Root, {
15
+ className: clsx(className, classNames?.root),
16
+ style: {
17
+ ...customStyles?.root,
18
+ ...style
19
+ },
20
+ ...rest,
21
+ children: /* @__PURE__ */ jsxs(Frame, {
22
+ className: classNames?.frame,
23
+ style: customStyles?.frame,
24
+ children: [
25
+ overlay && /* @__PURE__ */ jsx(Overlay, { render: overlay }),
26
+ /* @__PURE__ */ jsx(Caption, {}),
27
+ /* @__PURE__ */ jsx(CenterPlay, {}),
28
+ /* @__PURE__ */ jsx(Controls, {
29
+ className: classNames?.controls,
30
+ frameStep,
31
+ style: customStyles?.controls,
32
+ children: /* @__PURE__ */ jsx(Timeline, {
33
+ className: classNames?.timeline,
34
+ style: customStyles?.timeline,
35
+ thumbnails
36
+ })
37
+ }),
38
+ /* @__PURE__ */ jsx(LoadError, {})
39
+ ]
40
+ })
41
+ });
42
+ Video.displayName = "Video";
43
+ //#endregion
44
+ export { Video as default };
45
+
46
+ //# sourceMappingURL=Video.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Video.mjs","names":[],"sources":["../../src/Video/Video.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\n\nimport Caption from './parts/Caption';\nimport CenterPlay from './parts/CenterPlay';\nimport Controls from './parts/Controls';\nimport Frame from './parts/Frame';\nimport LoadError from './parts/LoadError';\nimport Root from './parts/Root';\nimport Timeline from './parts/Timeline';\nimport type { VideoProps, VideoState } from './type';\nimport { useVideo } from './useVideo';\n\nconst Overlay = ({ render }: { render: (state: VideoState) => React.ReactNode }) => (\n <>{render(useVideo())}</>\n);\n\nconst Video = ({\n className,\n classNames,\n frameStep,\n overlay,\n style,\n styles: customStyles,\n thumbnails = true,\n ...rest\n}: VideoProps) => (\n <Root\n className={clsx(className, classNames?.root)}\n style={{ ...customStyles?.root, ...style }}\n {...rest}\n >\n <Frame className={classNames?.frame} style={customStyles?.frame}>\n {overlay && <Overlay render={overlay} />}\n <Caption />\n <CenterPlay />\n <Controls\n className={classNames?.controls}\n frameStep={frameStep}\n style={customStyles?.controls}\n >\n <Timeline\n className={classNames?.timeline}\n style={customStyles?.timeline}\n thumbnails={thumbnails}\n />\n </Controls>\n <LoadError />\n </Frame>\n </Root>\n);\n\nVideo.displayName = 'Video';\n\nexport default Video;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,WAAW,EAAE,aACjB,oBAAA,UAAA,EAAA,UAAG,OAAO,SAAS,CAAC,EAAI,CAAA;AAG1B,MAAM,SAAS,EACb,WACA,YACA,WACA,SACA,OACA,QAAQ,cACR,aAAa,MACb,GAAG,WAEH,oBAAC,MAAD;CACE,WAAW,KAAK,WAAW,YAAY,IAAI;CAC3C,OAAO;EAAE,GAAG,cAAc;EAAM,GAAG;CAAM;CACzC,GAAI;CAEJ,UAAA,qBAAC,OAAD;EAAO,WAAW,YAAY;EAAO,OAAO,cAAc;EAA1D,UAAA;GACG,WAAW,oBAAC,SAAD,EAAS,QAAQ,QAAU,CAAA;GACvC,oBAAC,SAAD,CAAU,CAAA;GACV,oBAAC,YAAD,CAAa,CAAA;GACb,oBAAC,UAAD;IACE,WAAW,YAAY;IACZ;IACX,OAAO,cAAc;IAErB,UAAA,oBAAC,UAAD;KACE,WAAW,YAAY;KACvB,OAAO,cAAc;KACT;IACb,CAAA;GACO,CAAA;GACV,oBAAC,WAAD,CAAY,CAAA;EACP;;AACH,CAAA;AAGR,MAAM,cAAc"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { createContext, use } from "react";
3
+ //#region src/Video/context.ts
4
+ const VideoContext = createContext(null);
5
+ const useVideoContext = () => {
6
+ const value = use(VideoContext);
7
+ if (!value) throw new Error("Video parts must be rendered inside <Video.Root>.");
8
+ return value;
9
+ };
10
+ const FrameContext = createContext(null);
11
+ //#endregion
12
+ export { FrameContext, VideoContext, useVideoContext };
13
+
14
+ //# sourceMappingURL=context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.mjs","names":[],"sources":["../../src/Video/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, use } from 'react';\n\nimport type { VideoStore } from './store';\nimport type { VideoMarker, VideoMediaProps, VideoSection } from './type';\n\nexport interface VideoConfig {\n fps: number;\n markers: VideoMarker[];\n onMarkerClick?: (marker: VideoMarker) => void;\n onRetry?: () => Promise<unknown> | void;\n playbackRates?: number[];\n sections: VideoSection[];\n}\n\nexport interface VideoContextValue {\n config: VideoConfig;\n media: VideoMediaProps;\n store: VideoStore;\n}\n\nexport const VideoContext = createContext<VideoContextValue | null>(null);\n\nexport const useVideoContext = () => {\n const value = use(VideoContext);\n if (!value) throw new Error('Video parts must be rendered inside <Video.Root>.');\n return value;\n};\n\nexport interface FrameContextValue {\n hold: (held: boolean) => void;\n visible: boolean;\n}\n\nexport const FrameContext = createContext<FrameContextValue | null>(null);\n"],"mappings":";;;AAsBA,MAAa,eAAe,cAAwC,IAAI;AAExE,MAAa,wBAAwB;CACnC,MAAM,QAAQ,IAAI,YAAY;CAC9B,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,mDAAmD;CAC/E,OAAO;AACT;AAOA,MAAa,eAAe,cAAwC,IAAI"}
@@ -1,43 +1,27 @@
1
- import { FlexboxProps } from "../Flex/type.mjs";
2
- import "../Flex/index.mjs";
3
- import { VideoProps as VideoProps$1 } from "../types/index.mjs";
4
- import { CSSProperties, Ref } from "react";
1
+ import { VideoCaptionProps, VideoControlsProps, VideoFrameProps, VideoMarker, VideoMarkerColor, VideoMediaProps, VideoPlayer, VideoProps, VideoRootProps, VideoSection, VideoSectionListProps, VideoState, VideoStatus, VideoTimelineProps } from "./type.mjs";
2
+ import Caption from "./parts/Caption.mjs";
3
+ import CenterPlay from "./parts/CenterPlay.mjs";
4
+ import Controls from "./parts/Controls.mjs";
5
+ import Frame from "./parts/Frame.mjs";
6
+ import LoadError from "./parts/LoadError.mjs";
7
+ import Root from "./parts/Root.mjs";
8
+ import SectionList from "./parts/SectionList.mjs";
9
+ import Timeline from "./parts/Timeline.mjs";
10
+ import { useVideo, useVideoPlayer, useVideoState } from "./useVideo.mjs";
11
+ import { ReactNode } from "react";
5
12
  //#region src/Video/index.d.ts
6
- export interface VideoProps extends VideoProps$1, Pick<FlexboxProps, 'width' | 'height'> {
7
- autoPlay?: boolean;
8
- classNames?: {
9
- mask?: string;
10
- video?: string;
11
- wrapper?: string;
12
- };
13
- isLoading?: boolean;
14
- loop?: boolean;
15
- maxHeight?: number | string;
16
- maxWidth?: number | string;
17
- minHeight?: number | string;
18
- minWidth?: number | string;
19
- muted?: HTMLVideoElement['muted'];
20
- onEnded?: VideoProps$1['onEnded'];
21
- onMouseEnter?: VideoProps$1['onMouseEnter'];
22
- onMouseLeave?: VideoProps$1['onMouseLeave'];
23
- onPause?: VideoProps$1['onPause'];
24
- onPlay?: VideoProps$1['onPlay'];
25
- onPlaying?: VideoProps$1['onPlaying'];
26
- onProgress?: VideoProps$1['onProgress'];
27
- poster?: string;
28
- preload?: HTMLVideoElement['preload'];
29
- preview?: boolean;
30
- ref?: Ref<HTMLDivElement>;
31
- size?: number | string;
32
- src: string;
33
- styles?: {
34
- mask?: CSSProperties;
35
- video?: CSSProperties;
36
- wrapper?: CSSProperties;
37
- };
38
- variant?: 'borderless' | 'filled' | 'outlined';
13
+ export interface IVideo {
14
+ (props: VideoProps): ReactNode;
15
+ Caption: typeof Caption;
16
+ CenterPlay: typeof CenterPlay;
17
+ Controls: typeof Controls;
18
+ Frame: typeof Frame;
19
+ LoadError: typeof LoadError;
20
+ Root: typeof Root;
21
+ SectionList: typeof SectionList;
22
+ Timeline: typeof Timeline;
39
23
  }
40
- declare const Video: import("react").NamedExoticComponent<VideoProps>;
24
+ declare const Video: IVideo;
41
25
  //#endregion
42
- export { Video as default };
26
+ export { type VideoCaptionProps, type VideoControlsProps, type VideoFrameProps, type VideoMarker, type VideoMarkerColor, type VideoMediaProps, type VideoPlayer, type VideoProps, type VideoRootProps, type VideoSection, type VideoSectionListProps, type VideoState, type VideoStatus, type VideoTimelineProps, Video as default, useVideo, useVideoPlayer, useVideoState };
43
27
  //# sourceMappingURL=index.d.mts.map
@@ -1,114 +1,24 @@
1
- "use client";
2
- import { styleProps } from "../styles/stylex/props.mjs";
3
- import { cssVar } from "../styles/stylex/cssVar.stylex.mjs";
4
- import FlexBasic_default from "../Flex/FlexBasic.mjs";
5
- import { stylish } from "../styles/stylex/stylish.mjs";
6
- import ActionIcon from "../ActionIcon/ActionIcon.mjs";
7
- import Skeleton from "../Skeleton/index.mjs";
8
- import { videoMarker } from "./marker.stylex.mjs";
9
- import { styles } from "./style.mjs";
10
- import { memo, useMemo, useState } from "react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- import clsx from "clsx";
13
- import { PlayIcon } from "lucide-react";
14
- //#region src/Video/index.tsx
15
- const variantStyles = {
16
- borderless: stylish.variantBorderlessWithoutHover,
17
- filled: styles.filled,
18
- outlined: stylish.variantOutlinedWithoutHover
19
- };
20
- const Video = memo(({ ref, preload = "auto", src, style, classNames, className, maxHeight = "100%", maxWidth = "100%", minHeight, minWidth, onEnded, onPause, onPlay, onPlaying, width, height, onMouseEnter, styles: customStyles, onMouseLeave, preview = true, isLoading, variant = "filled", autoPlay, ...rest }) => {
21
- const [isPlaying, setIsPlaying] = useState(false);
22
- const [showControls, setShowControls] = useState(false);
23
- const cssVariables = useMemo(() => {
24
- const vars = {};
25
- if (maxHeight !== void 0) vars["--video-max-height"] = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
26
- if (maxWidth !== void 0) vars["--video-max-width"] = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
27
- if (minHeight !== void 0) vars["--video-min-height"] = typeof minHeight === "number" ? `${minHeight}px` : minHeight;
28
- if (minWidth !== void 0) vars["--video-min-width"] = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
29
- return vars;
30
- }, [
31
- maxHeight,
32
- maxWidth,
33
- minHeight,
34
- minWidth
35
- ]);
36
- if (isLoading) return /* @__PURE__ */ jsx(Skeleton, {
37
- radius: cssVar.borderRadiusLG,
38
- style: {
39
- height,
40
- maxHeight,
41
- maxWidth,
42
- minHeight,
43
- minWidth,
44
- width
45
- }
46
- });
47
- return /* @__PURE__ */ jsxs(FlexBasic_default, {
48
- height,
49
- ref,
50
- width,
51
- className: styleProps([
52
- styles.root,
53
- variantStyles[variant],
54
- videoMarker
55
- ], clsx(className, classNames?.wrapper)).className,
56
- style: {
57
- ...cssVariables,
58
- ...style,
59
- ...customStyles?.wrapper
60
- },
61
- children: [preview && !isPlaying && /* @__PURE__ */ jsx(FlexBasic_default, {
62
- align: "center",
63
- justify: "center",
64
- ...styleProps(styles.mask, clsx("lobe-video-mask", classNames?.mask), customStyles?.mask),
65
- children: /* @__PURE__ */ jsx(ActionIcon, {
66
- color: "#fff",
67
- icon: PlayIcon,
68
- variant: "filled"
69
- })
70
- }), /* @__PURE__ */ jsx("video", {
71
- autoPlay,
72
- controls: showControls,
73
- height,
74
- preload,
75
- width,
76
- ...styleProps(styles.video, classNames?.video, {
77
- height: "auto",
78
- maxWidth: "100%",
79
- ...customStyles?.video
80
- }),
81
- onEnded: (e) => {
82
- setIsPlaying(false);
83
- onEnded?.(e);
84
- },
85
- onMouseEnter: (e) => {
86
- setShowControls(true);
87
- onMouseEnter?.(e);
88
- },
89
- onMouseLeave: (e) => {
90
- setShowControls(false);
91
- onMouseLeave?.(e);
92
- },
93
- onPause: (e) => {
94
- setIsPlaying(false);
95
- onPause?.(e);
96
- },
97
- onPlay: (e) => {
98
- setIsPlaying(true);
99
- onPlay?.(e);
100
- },
101
- onPlaying: (e) => {
102
- setIsPlaying(true);
103
- onPlaying?.(e);
104
- },
105
- ...rest,
106
- children: /* @__PURE__ */ jsx("source", { src })
107
- })]
108
- });
109
- });
110
- Video.displayName = "Video";
1
+ import { useVideo, useVideoPlayer, useVideoState } from "./useVideo.mjs";
2
+ import Caption from "./parts/Caption.mjs";
3
+ import CenterPlay from "./parts/CenterPlay.mjs";
4
+ import Timeline from "./parts/Timeline.mjs";
5
+ import Controls from "./parts/Controls.mjs";
6
+ import Frame from "./parts/Frame.mjs";
7
+ import LoadError from "./parts/LoadError.mjs";
8
+ import Root from "./parts/Root.mjs";
9
+ import SectionList from "./parts/SectionList.mjs";
10
+ import Video$1 from "./Video.mjs";
11
+ //#region src/Video/index.ts
12
+ const Video = Video$1;
13
+ Video.Caption = Caption;
14
+ Video.CenterPlay = CenterPlay;
15
+ Video.Controls = Controls;
16
+ Video.Frame = Frame;
17
+ Video.LoadError = LoadError;
18
+ Video.Root = Root;
19
+ Video.SectionList = SectionList;
20
+ Video.Timeline = Timeline;
111
21
  //#endregion
112
- export { Video as default };
22
+ export { Video as default, useVideo, useVideoPlayer, useVideoState };
113
23
 
114
24
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["Flexbox"],"sources":["../../src/Video/index.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { PlayIcon } from 'lucide-react';\nimport { type CSSProperties, memo, type Ref, useMemo, useState } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { Flexbox, type FlexboxProps } from '@/Flex';\nimport Skeleton from '@/Skeleton';\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\nimport { styleProps } from '@/styles/stylex/props';\nimport { stylish } from '@/styles/stylex/stylish';\nimport { type VideoProps as VProps } from '@/types';\n\nimport { videoMarker } from './marker.stylex';\nimport { maskHoverCls, styles } from './style';\n\nconst variantStyles = {\n borderless: stylish.variantBorderlessWithoutHover,\n filled: styles.filled,\n outlined: stylish.variantOutlinedWithoutHover,\n};\n\nexport interface VideoProps extends VProps, Pick<FlexboxProps, 'width' | 'height'> {\n autoPlay?: boolean;\n classNames?: {\n mask?: string;\n video?: string;\n wrapper?: string;\n };\n isLoading?: boolean;\n loop?: boolean;\n maxHeight?: number | string;\n maxWidth?: number | string;\n minHeight?: number | string;\n minWidth?: number | string;\n muted?: HTMLVideoElement['muted'];\n onEnded?: VProps['onEnded'];\n onMouseEnter?: VProps['onMouseEnter'];\n onMouseLeave?: VProps['onMouseLeave'];\n onPause?: VProps['onPause'];\n onPlay?: VProps['onPlay'];\n onPlaying?: VProps['onPlaying'];\n onProgress?: VProps['onProgress'];\n poster?: string;\n preload?: HTMLVideoElement['preload'];\n preview?: boolean;\n ref?: Ref<HTMLDivElement>;\n size?: number | string;\n src: string;\n styles?: {\n mask?: CSSProperties;\n video?: CSSProperties;\n wrapper?: CSSProperties;\n };\n variant?: 'borderless' | 'filled' | 'outlined';\n}\n\nconst Video = memo<VideoProps>(\n ({\n ref,\n preload = 'auto',\n src,\n style,\n classNames,\n className,\n maxHeight = '100%',\n maxWidth = '100%',\n minHeight,\n minWidth,\n onEnded,\n onPause,\n onPlay,\n onPlaying,\n width,\n height,\n onMouseEnter,\n styles: customStyles,\n onMouseLeave,\n preview = true,\n isLoading,\n variant = 'filled',\n autoPlay,\n ...rest\n }) => {\n const [isPlaying, setIsPlaying] = useState(false);\n const [showControls, setShowControls] = useState(false);\n\n // Convert props to CSS variables\n const cssVariables = useMemo<Record<string, string>>(() => {\n const vars: Record<string, string> = {};\n if (maxHeight !== undefined) {\n vars['--video-max-height'] = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n }\n if (maxWidth !== undefined) {\n vars['--video-max-width'] = typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;\n }\n if (minHeight !== undefined) {\n vars['--video-min-height'] = typeof minHeight === 'number' ? `${minHeight}px` : minHeight;\n }\n if (minWidth !== undefined) {\n vars['--video-min-width'] = typeof minWidth === 'number' ? `${minWidth}px` : minWidth;\n }\n return vars;\n }, [maxHeight, maxWidth, minHeight, minWidth]);\n\n if (isLoading)\n return (\n <Skeleton\n radius={cssVar.borderRadiusLG}\n style={{\n height,\n maxHeight,\n maxWidth,\n minHeight,\n minWidth,\n width,\n }}\n />\n );\n\n return (\n <Flexbox\n height={height}\n ref={ref}\n width={width}\n className={\n styleProps(\n [styles.root, variantStyles[variant], videoMarker],\n clsx(className, classNames?.wrapper),\n ).className\n }\n style={{\n ...cssVariables,\n ...style,\n ...customStyles?.wrapper,\n }}\n >\n {preview && !isPlaying && (\n <Flexbox\n align={'center'}\n justify={'center'}\n {...styleProps(styles.mask, clsx(maskHoverCls, classNames?.mask), customStyles?.mask)}\n >\n <ActionIcon color={'#fff'} icon={PlayIcon} variant={'filled'} />\n </Flexbox>\n )}\n <video\n autoPlay={autoPlay}\n controls={showControls}\n height={height}\n preload={preload}\n width={width}\n {...styleProps(styles.video, classNames?.video, {\n height: 'auto',\n maxWidth: '100%',\n ...customStyles?.video,\n })}\n onEnded={(e) => {\n setIsPlaying(false);\n onEnded?.(e);\n }}\n onMouseEnter={(e) => {\n setShowControls(true);\n onMouseEnter?.(e);\n }}\n onMouseLeave={(e) => {\n setShowControls(false);\n onMouseLeave?.(e);\n }}\n onPause={(e) => {\n setIsPlaying(false);\n onPause?.(e);\n }}\n onPlay={(e) => {\n setIsPlaying(true);\n onPlay?.(e);\n }}\n onPlaying={(e) => {\n setIsPlaying(true);\n onPlaying?.(e);\n }}\n {...rest}\n >\n <source src={src} />\n </video>\n </Flexbox>\n );\n },\n);\n\nVideo.displayName = 'Video';\n\nexport default Video;\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,gBAAgB;CACpB,YAAY,QAAQ;CACpB,QAAQ,OAAO;CACf,UAAU,QAAQ;AACpB;AAqCA,MAAM,QAAQ,MACX,EACC,KACA,UAAU,QACV,KACA,OACA,YACA,WACA,YAAY,QACZ,WAAW,QACX,WACA,UACA,SACA,SACA,QACA,WACA,OACA,QACA,cACA,QAAQ,cACR,cACA,UAAU,MACV,WACA,UAAU,UACV,UACA,GAAG,WACC;CACJ,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAGtD,MAAM,eAAe,cAAsC;EACzD,MAAM,OAA+B,CAAC;EACtC,IAAI,cAAc,KAAA,GAChB,KAAK,wBAAwB,OAAO,cAAc,WAAW,GAAG,UAAU,MAAM;EAElF,IAAI,aAAa,KAAA,GACf,KAAK,uBAAuB,OAAO,aAAa,WAAW,GAAG,SAAS,MAAM;EAE/E,IAAI,cAAc,KAAA,GAChB,KAAK,wBAAwB,OAAO,cAAc,WAAW,GAAG,UAAU,MAAM;EAElF,IAAI,aAAa,KAAA,GACf,KAAK,uBAAuB,OAAO,aAAa,WAAW,GAAG,SAAS,MAAM;EAE/E,OAAO;CACT,GAAG;EAAC;EAAW;EAAU;EAAW;CAAQ,CAAC;CAE7C,IAAI,WACF,OACE,oBAAC,UAAD;EACE,QAAQ,OAAO;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;EACF;CACD,CAAA;CAGL,OACE,qBAACA,mBAAD;EACU;EACH;EACE;EACP,WACE,WACE;GAAC,OAAO;GAAM,cAAc;GAAU;EAAW,GACjD,KAAK,WAAW,YAAY,OAAO,CACrC,CAAC,CAAC;EAEJ,OAAO;GACL,GAAG;GACH,GAAG;GACH,GAAG,cAAc;EACnB;EAdF,UAAA,CAgBG,WAAW,CAAC,aACX,oBAACA,mBAAD;GACE,OAAO;GACP,SAAS;GACT,GAAI,WAAW,OAAO,MAAM,KAAA,mBAAmB,YAAY,IAAI,GAAG,cAAc,IAAI;GAEpF,UAAA,oBAAC,YAAD;IAAY,OAAO;IAAQ,MAAM;IAAU,SAAS;GAAW,CAAA;EACxD,CAAA,GAEX,oBAAC,SAAD;GACY;GACV,UAAU;GACF;GACC;GACF;GACP,GAAI,WAAW,OAAO,OAAO,YAAY,OAAO;IAC9C,QAAQ;IACR,UAAU;IACV,GAAG,cAAc;GACnB,CAAC;GACD,UAAU,MAAM;IACd,aAAa,KAAK;IAClB,UAAU,CAAC;GACb;GACA,eAAe,MAAM;IACnB,gBAAgB,IAAI;IACpB,eAAe,CAAC;GAClB;GACA,eAAe,MAAM;IACnB,gBAAgB,KAAK;IACrB,eAAe,CAAC;GAClB;GACA,UAAU,MAAM;IACd,aAAa,KAAK;IAClB,UAAU,CAAC;GACb;GACA,SAAS,MAAM;IACb,aAAa,IAAI;IACjB,SAAS,CAAC;GACZ;GACA,YAAY,MAAM;IAChB,aAAa,IAAI;IACjB,YAAY,CAAC;GACf;GACA,GAAI;GAEJ,UAAA,oBAAC,UAAD,EAAa,IAAM,CAAA;EACd,CAAA,CACA;;AAEb,CACF;AAEA,MAAM,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":["VideoPreset"],"sources":["../../src/Video/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport Caption from './parts/Caption';\nimport CenterPlay from './parts/CenterPlay';\nimport Controls from './parts/Controls';\nimport Frame from './parts/Frame';\nimport LoadError from './parts/LoadError';\nimport Root from './parts/Root';\nimport SectionList from './parts/SectionList';\nimport Timeline from './parts/Timeline';\nimport type { VideoProps } from './type';\nimport VideoPreset from './Video';\n\nexport interface IVideo {\n (props: VideoProps): ReactNode;\n Caption: typeof Caption;\n CenterPlay: typeof CenterPlay;\n Controls: typeof Controls;\n Frame: typeof Frame;\n LoadError: typeof LoadError;\n Root: typeof Root;\n SectionList: typeof SectionList;\n Timeline: typeof Timeline;\n}\n\nconst Video = VideoPreset as unknown as IVideo;\nVideo.Caption = Caption;\nVideo.CenterPlay = CenterPlay;\nVideo.Controls = Controls;\nVideo.Frame = Frame;\nVideo.LoadError = LoadError;\nVideo.Root = Root;\nVideo.SectionList = SectionList;\nVideo.Timeline = Timeline;\n\nexport default Video;\nexport type * from './type';\nexport { useVideo, useVideoPlayer, useVideoState } from './useVideo';\n"],"mappings":";;;;;;;;;;;AAyBA,MAAM,QAAQA;AACd,MAAM,UAAU;AAChB,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,WAAW"}
@@ -0,0 +1,9 @@
1
+ import { VideoCaptionProps } from "../type.mjs";
2
+ //#region src/Video/parts/Caption.d.ts
3
+ declare const Caption: {
4
+ ({ action, className, style }: VideoCaptionProps): import("react").JSX.Element | null;
5
+ displayName: string;
6
+ };
7
+ //#endregion
8
+ export { Caption as default };
9
+ //# sourceMappingURL=Caption.d.mts.map
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { styleProps } from "../../styles/stylex/props.mjs";
3
+ import { FrameContext } from "../context.mjs";
4
+ import { markerColor, styles } from "../style.mjs";
5
+ import { useVideo } from "../useVideo.mjs";
6
+ import { use } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/Video/parts/Caption.tsx
9
+ const Caption = ({ action, className, style }) => {
10
+ const frame = use(FrameContext);
11
+ const markers = useVideo((state) => state.captions ? state.activeMarkers : void 0);
12
+ if (!markers || markers.length === 0) return null;
13
+ return /* @__PURE__ */ jsx("div", {
14
+ ...styleProps([styles.caption, frame?.visible && styles.captionRaised], className, style),
15
+ onClick: (event) => event.stopPropagation(),
16
+ onPointerDown: (event) => event.stopPropagation(),
17
+ children: markers.map((marker, index) => /* @__PURE__ */ jsxs("div", {
18
+ ...styleProps(styles.captionItem),
19
+ children: [(marker.label !== void 0 || action) && /* @__PURE__ */ jsxs("div", {
20
+ ...styleProps(styles.captionTitle),
21
+ children: [
22
+ /* @__PURE__ */ jsx("span", { ...styleProps(styles.dot, void 0, { background: markerColor(marker.color) }) }),
23
+ marker.label,
24
+ action?.(marker)
25
+ ]
26
+ }), /* @__PURE__ */ jsx("div", { children: marker.content })]
27
+ }, marker.key ?? `${marker.time}-${index}`))
28
+ });
29
+ };
30
+ Caption.displayName = "VideoCaption";
31
+ //#endregion
32
+ export { Caption as default };
33
+
34
+ //# sourceMappingURL=Caption.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Caption.mjs","names":[],"sources":["../../../src/Video/parts/Caption.tsx"],"sourcesContent":["'use client';\n\nimport { use } from 'react';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { FrameContext } from '../context';\nimport { markerColor, styles } from '../style';\nimport type { VideoCaptionProps } from '../type';\nimport { useVideo } from '../useVideo';\n\nconst Caption = ({ action, className, style }: VideoCaptionProps) => {\n const frame = use(FrameContext);\n const markers = useVideo((state) => (state.captions ? state.activeMarkers : undefined));\n if (!markers || markers.length === 0) return null;\n\n return (\n <div\n {...styleProps([styles.caption, frame?.visible && styles.captionRaised], className, style)}\n onClick={(event) => event.stopPropagation()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n {markers.map((marker, index) => (\n <div key={marker.key ?? `${marker.time}-${index}`} {...styleProps(styles.captionItem)}>\n {(marker.label !== undefined || action) && (\n <div {...styleProps(styles.captionTitle)}>\n <span\n {...styleProps(styles.dot, undefined, { background: markerColor(marker.color) })}\n />\n {marker.label}\n {action?.(marker)}\n </div>\n )}\n <div>{marker.content}</div>\n </div>\n ))}\n </div>\n );\n};\n\nCaption.displayName = 'VideoCaption';\n\nexport default Caption;\n"],"mappings":";;;;;;;;AAWA,MAAM,WAAW,EAAE,QAAQ,WAAW,YAA+B;CACnE,MAAM,QAAQ,IAAI,YAAY;CAC9B,MAAM,UAAU,UAAU,UAAW,MAAM,WAAW,MAAM,gBAAgB,KAAA,CAAU;CACtF,IAAI,CAAC,WAAW,QAAQ,WAAW,GAAG,OAAO;CAE7C,OACE,oBAAC,OAAD;EACE,GAAI,WAAW,CAAC,OAAO,SAAS,OAAO,WAAW,OAAO,aAAa,GAAG,WAAW,KAAK;EACzF,UAAU,UAAU,MAAM,gBAAgB;EAC1C,gBAAgB,UAAU,MAAM,gBAAgB;EAE/C,UAAA,QAAQ,KAAK,QAAQ,UACpB,qBAAC,OAAD;GAAmD,GAAI,WAAW,OAAO,WAAW;GAApF,UAAA,EACI,OAAO,UAAU,KAAA,KAAa,WAC9B,qBAAC,OAAD;IAAK,GAAI,WAAW,OAAO,YAAY;IAAvC,UAAA;KACE,oBAAC,QAAD,EACE,GAAI,WAAW,OAAO,KAAK,KAAA,GAAW,EAAE,YAAY,YAAY,OAAO,KAAK,EAAE,CAAC,EAChF,CAAA;KACA,OAAO;KACP,SAAS,MAAM;IACb;GAEP,CAAA,GAAA,oBAAC,OAAD,EAAA,UAAM,OAAO,QAAa,CAAA,CACvB;EAXK,GAAA,OAAO,OAAO,GAAG,OAAO,KAAK,GAAG,OAWrC,CACN;CACE,CAAA;AAET;AAEA,QAAQ,cAAc"}
@@ -0,0 +1,8 @@
1
+ //#region src/Video/parts/CenterPlay.d.ts
2
+ declare const CenterPlay: {
3
+ (): import("react").JSX.Element | null;
4
+ displayName: string;
5
+ };
6
+ //#endregion
7
+ export { CenterPlay as default };
8
+ //# sourceMappingURL=CenterPlay.d.mts.map