@bylqwjc/media-editor-video 1.0.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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -0
  3. package/dist/chunk-EK7ODJWE.js +1 -0
  4. package/dist/index-CX2iAapm.d.ts +51 -0
  5. package/dist/index.d.ts +61 -0
  6. package/dist/index.js +2273 -0
  7. package/dist/lazy.d.ts +7 -0
  8. package/dist/lazy.js +1 -0
  9. package/dist/legacy.js +65 -0
  10. package/node_modules/@media-editor/client/LICENSE +21 -0
  11. package/node_modules/@media-editor/client/README.md +27 -0
  12. package/node_modules/@media-editor/client/dist/index.d.ts +24 -0
  13. package/node_modules/@media-editor/client/dist/index.js +1 -0
  14. package/node_modules/@media-editor/client/package.json +22 -0
  15. package/node_modules/@media-editor/core/LICENSE +21 -0
  16. package/node_modules/@media-editor/core/README.md +14 -0
  17. package/node_modules/@media-editor/core/dist/browser.d.ts +100 -0
  18. package/node_modules/@media-editor/core/dist/browser.js +3 -0
  19. package/node_modules/@media-editor/core/dist/chunk-MGKYVYOH.js +1 -0
  20. package/node_modules/@media-editor/core/dist/chunk-USY6UDGL.js +1 -0
  21. package/node_modules/@media-editor/core/dist/chunk-XCBM7P7N.js +1 -0
  22. package/node_modules/@media-editor/core/dist/engine.d.ts +359 -0
  23. package/node_modules/@media-editor/core/dist/engine.js +1 -0
  24. package/node_modules/@media-editor/core/dist/index.d.ts +264 -0
  25. package/node_modules/@media-editor/core/dist/index.js +1 -0
  26. package/node_modules/@media-editor/core/dist/platform-presets-B-o4C6uY.d.ts +80 -0
  27. package/node_modules/@media-editor/core/dist/state-B85vkf7_.d.ts +1027 -0
  28. package/node_modules/@media-editor/core/node_modules/zod/LICENSE +21 -0
  29. package/node_modules/@media-editor/core/node_modules/zod/README.md +208 -0
  30. package/node_modules/@media-editor/core/node_modules/zod/index.d.cts +4 -0
  31. package/node_modules/@media-editor/core/node_modules/zod/index.js +1 -0
  32. package/node_modules/@media-editor/core/node_modules/zod/package.json +74 -0
  33. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.cts +164 -0
  34. package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.js +1 -0
  35. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.cts +5 -0
  36. package/node_modules/@media-editor/core/node_modules/zod/v3/errors.js +1 -0
  37. package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.cts +6 -0
  38. package/node_modules/@media-editor/core/node_modules/zod/v3/external.js +1 -0
  39. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  40. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.js +0 -0
  41. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  42. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.js +1 -0
  43. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  44. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.js +1 -0
  45. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  46. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.js +0 -0
  47. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  48. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.js +0 -0
  49. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.cts +85 -0
  50. package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.js +1 -0
  51. package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.cts +4 -0
  52. package/node_modules/@media-editor/core/node_modules/zod/v3/index.js +1 -0
  53. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.cts +3 -0
  54. package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.js +1 -0
  55. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.cts +102 -0
  56. package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.js +0 -0
  57. package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.cts +1031 -0
  58. package/node_modules/@media-editor/core/node_modules/zod/v3/types.js +1 -0
  59. package/node_modules/@media-editor/core/package.json +34 -0
  60. package/package.json +33 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 media-editor-sdk contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @media-editor/video
2
+
3
+ 框架无关视频编辑器运行时。内部封装 React 和完整视频编辑 UI,支持时间轴、剪辑、裁剪、调色、滤镜、标注、贴纸、比例、封面和导出。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @media-editor/video @media-editor/styles
9
+ ```
10
+
11
+ 视频导出需要后端接口,通常配合 `@media-editor/server`。
12
+
13
+ ## 使用
14
+
15
+ ```ts
16
+ import { mountVideoEditor } from '@media-editor/video';
17
+ import '@media-editor/styles/theme.css';
18
+
19
+ const handle = mountVideoEditor(el, {
20
+ source: videoFile,
21
+ baseUrl: '/api/editor',
22
+ locale: 'zh',
23
+ theme: 'dark',
24
+ onExported: async (blob, filename) => {
25
+ await saveVideoToYourApp(blob, filename);
26
+ },
27
+ onError: console.error,
28
+ });
29
+
30
+ handle.update({ locale: 'en' });
31
+ handle.destroy();
32
+ ```
33
+
34
+ `locale` 支持 `zh`、`en`、`es` 和 `zh-Hant`。
35
+
36
+ `source` 传 `File` 后,编辑器打开即导入该视频文件;用户不需要再在编辑器内点「+ 视频」。如果业务侧只有远程视频 URL,建议先由业务应用 fetch 成 `File` 再传入,保证导出时能上传原始源文件。
37
+
38
+ ## Lazy
39
+
40
+ ```ts
41
+ import { mountVideoEditorLazy, preloadVideoEditor } from '@media-editor/video/lazy';
42
+
43
+ preloadVideoEditor();
44
+ await mountVideoEditorLazy(el, options);
45
+ ```
46
+
47
+ ## 导出回调
48
+
49
+ 导出过程中编辑器会显示 loading。导出成功后触发:
50
+
51
+ ```ts
52
+ onExported: (blob: Blob, filename: string) => void
53
+ ```
54
+
55
+ 如果需要接入自定义鉴权或上传网关,可以传入 `client`,覆盖默认 `baseUrl + /api/editor/video` 行为。
@@ -0,0 +1 @@
1
+ var l=Object.create,a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,u=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,c=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),s=(r,e,t,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!O.call(r,o)&&o!==t&&a(r,o,{get:()=>e[o],enumerable:!(p=n(e,o))||p.enumerable});return r},v=(r,e,t)=>(t=r!=null?l(u(r)):{},s(e||!r||!r.__esModule?a(t,"default",{value:r,enumerable:!0}):t,r));export{c as a,v as b};
@@ -0,0 +1,51 @@
1
+ import { EditorLocale } from '@media-editor/core';
2
+ import { VideoEditorEngine } from '@media-editor/core/engine';
3
+ import { EditorClient } from '@media-editor/client';
4
+
5
+ interface FullscreenToggleOptions {
6
+ mode?: 'overlay' | 'inline';
7
+ className?: string;
8
+ }
9
+ type VideoEditorFullscreenOptions = false | (FullscreenToggleOptions & {
10
+ /** Element that should enter fullscreen. Defaults to the editor target. */
11
+ target?: HTMLElement;
12
+ /** Element that should receive the toggle button. Defaults to the editor target. */
13
+ buttonContainer?: HTMLElement | null;
14
+ });
15
+ interface MountVideoEditorOptions {
16
+ /** 初始视频文件;传入后会像图片编辑器一样打开即导入,无需用户再点一次「+ 视频」 */
17
+ source?: File;
18
+ /** 文案语言,默认 'zh' */
19
+ locale?: EditorLocale;
20
+ /** 明暗:'auto'(默认跟随系统)/ 'light' / 'dark' */
21
+ theme?: 'auto' | 'light' | 'dark';
22
+ /** 导出后端基址(未传 client 时建默认 client) */
23
+ baseUrl?: string;
24
+ /** 覆盖默认导出 client */
25
+ client?: EditorClient;
26
+ /** 复用外部引擎(跨组件共享);省略则内部自建 */
27
+ engine?: VideoEditorEngine;
28
+ /** 导出完成回调 */
29
+ onExported?: (blob: Blob, name: string) => void;
30
+ onError?: (err: Error) => void;
31
+ maxVideos?: number;
32
+ maxAudios?: number;
33
+ /** 全屏按钮配置;传 false 可关闭内置按钮,也可把按钮放进宿主返回栏 */
34
+ fullscreen?: VideoEditorFullscreenOptions;
35
+ }
36
+ interface VideoEditorHandle {
37
+ update(opts: MountVideoEditorOptions): void;
38
+ destroy(): void;
39
+ }
40
+ declare function mountVideoEditor(target: HTMLElement, opts?: MountVideoEditorOptions): VideoEditorHandle;
41
+
42
+ type __index_MountVideoEditorOptions = MountVideoEditorOptions;
43
+ declare const __index_VideoEditorEngine: typeof VideoEditorEngine;
44
+ type __index_VideoEditorFullscreenOptions = VideoEditorFullscreenOptions;
45
+ type __index_VideoEditorHandle = VideoEditorHandle;
46
+ declare const __index_mountVideoEditor: typeof mountVideoEditor;
47
+ declare namespace __index {
48
+ export { type __index_MountVideoEditorOptions as MountVideoEditorOptions, __index_VideoEditorEngine as VideoEditorEngine, type __index_VideoEditorFullscreenOptions as VideoEditorFullscreenOptions, type __index_VideoEditorHandle as VideoEditorHandle, __index_mountVideoEditor as mountVideoEditor };
49
+ }
50
+
51
+ export { type MountVideoEditorOptions as M, type VideoEditorHandle as V, __index as _, type VideoEditorFullscreenOptions as a, mountVideoEditor as m };
@@ -0,0 +1,61 @@
1
+ import type { EditorClient } from '@media-editor/client';
2
+ import type { EditorLocale } from '@media-editor/core';
3
+ import type { VideoEditorEngine } from '@media-editor/core/engine';
4
+ export { VideoEditorEngine } from '@media-editor/core/engine';
5
+
6
+ interface FullscreenToggleOptions {
7
+ mode?: 'overlay' | 'inline';
8
+ className?: string;
9
+ }
10
+
11
+ export type VideoEditorFullscreenOptions = false | (FullscreenToggleOptions & {
12
+ target?: HTMLElement;
13
+ buttonContainer?: HTMLElement | null;
14
+ });
15
+
16
+ export interface MountVideoEditorOptions {
17
+ source?: File;
18
+ locale?: EditorLocale;
19
+ theme?: 'auto' | 'light' | 'dark';
20
+ baseUrl?: string;
21
+ client?: EditorClient;
22
+ engine?: VideoEditorEngine;
23
+ onExported?: (blob: Blob, name: string) => void;
24
+ onError?: (err: Error) => void;
25
+ maxVideos?: number;
26
+ maxAudios?: number;
27
+ fullscreen?: VideoEditorFullscreenOptions;
28
+ [key: string]: unknown;
29
+ }
30
+
31
+ export interface VideoEditorHandle {
32
+ update(opts: MountVideoEditorOptions): void;
33
+ destroy(): void;
34
+ }
35
+
36
+ export interface FitVideoEditorShellOptions {
37
+ height?: string;
38
+ }
39
+
40
+ export interface VideoEditorShellOptions {
41
+ append?: boolean;
42
+ backButton?: HTMLElement | string | false;
43
+ className?: string;
44
+ fitToViewport?: boolean;
45
+ height?: string;
46
+ hostClassName?: string;
47
+ actionsClassName?: string;
48
+ onBack?: (event: MouseEvent) => void;
49
+ }
50
+
51
+ export interface VideoEditorShellHandle {
52
+ shell: HTMLDivElement;
53
+ actions: HTMLDivElement;
54
+ host: HTMLDivElement;
55
+ backButton: HTMLElement | null;
56
+ destroy(): void;
57
+ }
58
+
59
+ export declare function fitVideoEditorShellToViewport(shell: HTMLElement, options?: FitVideoEditorShellOptions): () => void;
60
+ export declare function createVideoEditorShell(parent: HTMLElement, options?: VideoEditorShellOptions): VideoEditorShellHandle;
61
+ export declare function mountVideoEditor(target: HTMLElement, options?: MountVideoEditorOptions): VideoEditorHandle;