@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.
- package/README.md +3 -1
- package/es/Accordion/style.d.mts +1 -1
- package/es/ActionIcon/type.d.mts +1 -0
- package/es/Alert/type.d.mts +1 -0
- package/es/AutoComplete/style.d.mts +2 -1
- package/es/AutoComplete/type.d.mts +1 -0
- package/es/Button/type.d.mts +1 -0
- package/es/Checkbox/type.d.mts +1 -0
- package/es/ColorSwatches/type.d.mts +1 -0
- package/es/Drawer/atoms.d.mts +1 -0
- package/es/Drawer/constants.d.mts +1 -0
- package/es/FileTypeIcon/type.d.mts +1 -0
- package/es/Form/type.d.mts +1 -0
- package/es/GroupAvatar/type.d.mts +1 -0
- package/es/Highlighter/const.d.mts +1 -0
- package/es/Input/style.d.mts +1 -0
- package/es/Input/type.d.mts +1 -0
- package/es/Markdown/plugins/remarkColor.d.mts +1 -0
- package/es/Markdown/plugins/remarkGfmPlus.d.mts +1 -0
- package/es/Markdown/plugins/remarkVideo.d.mts +1 -0
- package/es/Mermaid/const.d.mts +1 -0
- package/es/Modal/atoms.d.mts +1 -0
- package/es/Modal/constants.d.mts +1 -0
- package/es/Modal/type.d.mts +1 -0
- package/es/Radio/type.d.mts +1 -0
- package/es/Segmented/atoms.d.mts +1 -0
- package/es/Slider/type.d.mts +1 -0
- package/es/Switch/atoms.d.mts +1 -0
- package/es/Text/style.d.mts +2 -1
- package/es/ToggleGroup/atoms.d.mts +1 -0
- package/es/Video/Video.mjs +46 -0
- package/es/Video/Video.mjs.map +1 -0
- package/es/Video/context.mjs +14 -0
- package/es/Video/context.mjs.map +1 -0
- package/es/Video/index.d.mts +23 -39
- package/es/Video/index.mjs +21 -111
- package/es/Video/index.mjs.map +1 -1
- package/es/Video/parts/Caption.d.mts +9 -0
- package/es/Video/parts/Caption.mjs +34 -0
- package/es/Video/parts/Caption.mjs.map +1 -0
- package/es/Video/parts/CenterPlay.d.mts +8 -0
- package/es/Video/parts/CenterPlay.mjs +34 -0
- package/es/Video/parts/CenterPlay.mjs.map +1 -0
- package/es/Video/parts/Controls.d.mts +9 -0
- package/es/Video/parts/Controls.mjs +123 -0
- package/es/Video/parts/Controls.mjs.map +1 -0
- package/es/Video/parts/Frame.d.mts +9 -0
- package/es/Video/parts/Frame.mjs +94 -0
- package/es/Video/parts/Frame.mjs.map +1 -0
- package/es/Video/parts/HoverPreview.mjs +93 -0
- package/es/Video/parts/HoverPreview.mjs.map +1 -0
- package/es/Video/parts/LoadError.d.mts +8 -0
- package/es/Video/parts/LoadError.mjs +47 -0
- package/es/Video/parts/LoadError.mjs.map +1 -0
- package/es/Video/parts/PlayPauseIcon.mjs +48 -0
- package/es/Video/parts/PlayPauseIcon.mjs.map +1 -0
- package/es/Video/parts/RateMenu.mjs +48 -0
- package/es/Video/parts/RateMenu.mjs.map +1 -0
- package/es/Video/parts/Root.d.mts +9 -0
- package/es/Video/parts/Root.mjs +110 -0
- package/es/Video/parts/Root.mjs.map +1 -0
- package/es/Video/parts/SectionList.d.mts +9 -0
- package/es/Video/parts/SectionList.mjs +32 -0
- package/es/Video/parts/SectionList.mjs.map +1 -0
- package/es/Video/parts/SectionMenu.mjs +63 -0
- package/es/Video/parts/SectionMenu.mjs.map +1 -0
- package/es/Video/parts/Timeline.d.mts +9 -0
- package/es/Video/parts/Timeline.mjs +169 -0
- package/es/Video/parts/Timeline.mjs.map +1 -0
- package/es/Video/store.mjs +241 -0
- package/es/Video/store.mjs.map +1 -0
- package/es/Video/style.mjs +393 -23
- package/es/Video/style.mjs.map +1 -1
- package/es/Video/time.mjs +60 -0
- package/es/Video/time.mjs.map +1 -0
- package/es/Video/type.d.mts +125 -0
- package/es/Video/useControlsIdle.mjs +39 -0
- package/es/Video/useControlsIdle.mjs.map +1 -0
- package/es/Video/useFullscreen.mjs +17 -0
- package/es/Video/useFullscreen.mjs.map +1 -0
- package/es/Video/useKeyboard.mjs +60 -0
- package/es/Video/useKeyboard.mjs.map +1 -0
- package/es/Video/useVideo.d.mts +9 -0
- package/es/Video/useVideo.mjs +17 -0
- package/es/Video/useVideo.mjs.map +1 -0
- package/es/color/types.d.mts +1 -0
- package/es/hooks/useMarkdown/utils.d.mts +1 -0
- package/es/i18n/resources/en/index.d.mts +3 -2
- package/es/i18n/resources/en/index.mjs +4 -2
- package/es/i18n/resources/en/index.mjs.map +1 -1
- package/es/i18n/resources/en/video.d.mts +23 -0
- package/es/i18n/resources/en/video.mjs +24 -0
- package/es/i18n/resources/en/video.mjs.map +1 -0
- package/es/i18n/resources/zhCn/index.d.mts +3 -2
- package/es/i18n/resources/zhCn/index.mjs +4 -2
- package/es/i18n/resources/zhCn/index.mjs.map +1 -1
- package/es/i18n/resources/zhCn/video.d.mts +23 -0
- package/es/i18n/resources/zhCn/video.mjs +24 -0
- package/es/i18n/resources/zhCn/video.mjs.map +1 -0
- package/es/i18n/types.d.mts +3 -1
- package/es/index.d.mts +4 -2
- package/es/index.mjs +2 -1
- package/es/internal/menu/itemInterface.d.mts +1 -0
- package/es/internal/menu/renderUtils.d.mts +1 -0
- package/es/mdx/mdxComponents/Video.d.mts +2 -1
- package/es/mdx/mdxComponents/Video.mjs +5 -3
- package/es/mdx/mdxComponents/Video.mjs.map +1 -1
- package/es/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.mts +1 -0
- 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
- package/es/style.css +263 -23
- package/es/styles/createGlobalStyle.d.mts +1 -0
- package/es/styles/theme/generateColorPalette.d.mts +1 -0
- package/es/styles/theme/scope.d.mts +1 -0
- package/es/types/customToken.d.mts +1 -0
- package/package.json +5 -5
- package/es/Video/marker.stylex.mjs +0 -9
- 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.
|
|
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
|
|
package/es/Accordion/style.d.mts
CHANGED
|
@@ -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;
|
package/es/ActionIcon/type.d.mts
CHANGED
|
@@ -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
|
package/es/Alert/type.d.mts
CHANGED
|
@@ -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", "
|
|
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
|
package/es/Button/type.d.mts
CHANGED
|
@@ -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
|
package/es/Checkbox/type.d.mts
CHANGED
package/es/Drawer/atoms.d.mts
CHANGED
|
@@ -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
|
package/es/Form/type.d.mts
CHANGED
package/es/Input/style.d.mts
CHANGED
package/es/Input/type.d.mts
CHANGED
package/es/Mermaid/const.d.mts
CHANGED
package/es/Modal/atoms.d.mts
CHANGED
|
@@ -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
|
package/es/Modal/constants.d.mts
CHANGED
package/es/Modal/type.d.mts
CHANGED
package/es/Radio/type.d.mts
CHANGED
package/es/Segmented/atoms.d.mts
CHANGED
package/es/Slider/type.d.mts
CHANGED
package/es/Switch/atoms.d.mts
CHANGED
package/es/Text/style.d.mts
CHANGED
|
@@ -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"}
|
package/es/Video/index.d.mts
CHANGED
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
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
|
package/es/Video/index.mjs
CHANGED
|
@@ -1,114 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
package/es/Video/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["
|
|
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"}
|