@cut-workbench/workbench 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +90 -2
- package/dist/CutWorkbench.d.ts +37 -0
- package/dist/app/debug-bridge.d.ts +8 -0
- package/dist/assets/export.worker-BoHEWmFf.js +10177 -0
- package/dist/assets/export.worker-BoHEWmFf.js.map +1 -0
- package/dist/atoms-root.d.ts +46 -0
- package/dist/components/common/ConfirmDialog.d.ts +13 -0
- package/dist/components/common/EmptyState.d.ts +13 -0
- package/dist/components/common/LoadingOverlay.d.ts +14 -0
- package/dist/components/common/Timecode.d.ts +16 -0
- package/dist/components/common/UnsupportedBrowser.d.ts +9 -0
- package/dist/components/layout/AppShell.d.ts +26 -0
- package/dist/components/layout/CapabilityBadge.d.ts +7 -0
- package/dist/components/layout/PanelResizer.d.ts +22 -0
- package/dist/components/layout/WorkbenchToolbar.d.ts +24 -0
- package/dist/components/layout/use-capability-info.d.ts +11 -0
- package/dist/components/layout/use-panel-resize.d.ts +19 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/context-menu.d.ts +25 -0
- package/dist/components/ui/dialog.d.ts +30 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +9 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/context.d.ts +64 -0
- package/dist/cut-workbench.css +4152 -0
- package/dist/default-bridge.d.ts +18 -0
- package/dist/features/canvas-settings/components/CanvasSettingsDialog.d.ts +16 -0
- package/dist/features/canvas-settings/index.d.ts +4 -0
- package/dist/features/export/components/ExportDialog.d.ts +6 -0
- package/dist/features/export/components/ExportProgress.d.ts +8 -0
- package/dist/features/export/components/ExportResult.d.ts +15 -0
- package/dist/features/export/export-runner.d.ts +65 -0
- package/dist/features/export/export.worker.d.ts +7 -0
- package/dist/features/export/hooks/useExportState.d.ts +39 -0
- package/dist/features/export/index.d.ts +15 -0
- package/dist/features/export/worker-factory.d.ts +24 -0
- package/dist/features/export/worker-url.d.ts +1 -0
- package/dist/features/export/worker-url.umd.d.ts +8 -0
- package/dist/features/index.d.ts +13 -0
- package/dist/features/inspector/components/AudioProps.d.ts +13 -0
- package/dist/features/inspector/components/Field.d.ts +44 -0
- package/dist/features/inspector/components/ImageProps.d.ts +16 -0
- package/dist/features/inspector/components/InspectorPanel.d.ts +6 -0
- package/dist/features/inspector/components/SubtitleProps.d.ts +14 -0
- package/dist/features/inspector/components/TextProps.d.ts +16 -0
- package/dist/features/inspector/components/VideoProps.d.ts +17 -0
- package/dist/features/inspector/hooks/useClipInspector.d.ts +18 -0
- package/dist/features/inspector/index.d.ts +17 -0
- package/dist/features/lab/components/ChromakeyLab.d.ts +1 -0
- package/dist/features/lab/components/ConcatenateLab.d.ts +7 -0
- package/dist/features/lab/components/CustomClipLab.d.ts +10 -0
- package/dist/features/lab/components/LabCard.d.ts +12 -0
- package/dist/features/lab/components/LabPage.d.ts +6 -0
- package/dist/features/lab/components/RecorderLab.d.ts +9 -0
- package/dist/features/lab/components/RemuxLab.d.ts +6 -0
- package/dist/features/lab/components/SubtitleLab.d.ts +7 -0
- package/dist/features/lab/components/ThumbnailLab.d.ts +7 -0
- package/dist/features/lab/components/TrackSplitLab.d.ts +7 -0
- package/dist/features/lab/components/shared.d.ts +33 -0
- package/dist/features/lab/hooks/use-lab-action.d.ts +7 -0
- package/dist/features/lab/index.d.ts +4 -0
- package/dist/features/media-library/components/DropZone.d.ts +15 -0
- package/dist/features/media-library/components/MediaCard.d.ts +14 -0
- package/dist/features/media-library/components/MediaGrid.d.ts +16 -0
- package/dist/features/media-library/components/MediaLibraryPanel.d.ts +10 -0
- package/dist/features/media-library/hooks/useMediaImport.d.ts +22 -0
- package/dist/features/media-library/index.d.ts +14 -0
- package/dist/features/preview/components/CaptureButton.d.ts +13 -0
- package/dist/features/preview/components/PlaybackControls.d.ts +19 -0
- package/dist/features/preview/components/PreviewPanel.d.ts +14 -0
- package/dist/features/preview/components/PreviewStage.d.ts +30 -0
- package/dist/features/preview/components/SelectionOverlay.d.ts +21 -0
- package/dist/features/preview/hooks/useAvCanvas.d.ts +48 -0
- package/dist/features/preview/hooks/useCanvasInteraction.d.ts +66 -0
- package/dist/features/preview/hooks/usePlaybackClock.d.ts +36 -0
- package/dist/features/preview/hooks/usePreviewSync.d.ts +26 -0
- package/dist/features/preview/index.d.ts +13 -0
- package/dist/features/preview/lib/download.d.ts +2 -0
- package/dist/features/timeline/components/ClipBlock.d.ts +42 -0
- package/dist/features/timeline/components/ClipContextMenu.d.ts +17 -0
- package/dist/features/timeline/components/Marquee.d.ts +9 -0
- package/dist/features/timeline/components/Playhead.d.ts +8 -0
- package/dist/features/timeline/components/Ruler.d.ts +18 -0
- package/dist/features/timeline/components/Timeline.d.ts +14 -0
- package/dist/features/timeline/components/TimelineToolbar.d.ts +20 -0
- package/dist/features/timeline/components/TrackHeader.d.ts +18 -0
- package/dist/features/timeline/constants.d.ts +11 -0
- package/dist/features/timeline/hooks/useLazyVisibility.d.ts +11 -0
- package/dist/features/timeline/hooks/useSnap.d.ts +29 -0
- package/dist/features/timeline/hooks/useTimelineDrag.d.ts +50 -0
- package/dist/features/timeline/hooks/useTimelineZoom.d.ts +20 -0
- package/dist/features/timeline/index.d.ts +20 -0
- package/dist/hooks/use-capability.d.ts +13 -0
- package/dist/hooks/use-editor-actions.d.ts +15 -0
- package/dist/hooks/use-event-listener.d.ts +14 -0
- package/dist/hooks/use-keyboard-shortcuts.d.ts +20 -0
- package/dist/hooks/use-toast-safe.d.ts +21 -0
- package/dist/index.cjs +8979 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +8896 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +95 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/constants.d.ts +33 -0
- package/dist/lib/format.d.ts +12 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/portal-container.d.ts +21 -0
- package/dist/provider.d.ts +46 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/ui-store.d.ts +41 -0
- package/dist/theme-tokens.d.ts +83 -0
- package/dist/theme.d.ts +24 -0
- package/dist/umd/cut-workbench.umd.js +1 -0
- package/package.json +67 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cut Workbench 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
CHANGED
|
@@ -1,3 +1,91 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cut-workbench/workbench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
可嵌入的浏览器端剪辑台 UI:素材库、预览、时间轴、属性面板与导出对话框。
|
|
4
|
+
基于 React 19 + Tailwind CSS v4 + Radix,样式已作用域化,嵌进任何宿主都不污染。
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i @cut-workbench/workbench @cut-workbench/core @cut-workbench/react react react-dom
|
|
10
|
+
# 引擎依赖(预览 / 导出必需)
|
|
11
|
+
npm i @webav/av-cliper @webav/av-canvas @webav/av-recorder
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`@webav/*`、`react`、`react-dom`、`zustand` 是 peer 依赖,由宿主提供。
|
|
15
|
+
`@webav/*` 必须与 core 用同一份实例,否则 clip 状态会互相破坏。
|
|
16
|
+
|
|
17
|
+
## React 项目
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { createEditor } from '@cut-workbench/core/engine'
|
|
21
|
+
import { CutEditorProvider } from '@cut-workbench/react'
|
|
22
|
+
import { CutWorkbench, CutWorkbenchProvider } from '@cut-workbench/workbench'
|
|
23
|
+
import '@cut-workbench/workbench/style.css'
|
|
24
|
+
|
|
25
|
+
const editor = createEditor()
|
|
26
|
+
|
|
27
|
+
createRoot(el).render(
|
|
28
|
+
<CutEditorProvider editor={editor}>
|
|
29
|
+
<CutWorkbenchProvider theme="dark">
|
|
30
|
+
<CutWorkbench className="h-screen" onSaveProject={save} onOpenProject={open} />
|
|
31
|
+
</CutWorkbenchProvider>
|
|
32
|
+
</CutEditorProvider>,
|
|
33
|
+
)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 非 React 项目
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { initCutWorkbench } from '@cut-workbench/workbench'
|
|
40
|
+
import '@cut-workbench/workbench/style.css'
|
|
41
|
+
|
|
42
|
+
const wb = initCutWorkbench('#app', { theme: 'dark', namespace: 'my-project' })
|
|
43
|
+
await wb.whenReady()
|
|
44
|
+
wb.on('export:done', ({ blob, filename }) => upload(blob, filename))
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## script 标签 / 微前端
|
|
48
|
+
|
|
49
|
+
UMD 单文件已把 React、WebAV、Worker 与样式全部内联,暴露 `window.CutWorkbench`:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<script src="https://unpkg.com/@cut-workbench/workbench/dist/umd/cut-workbench.umd.js"></script>
|
|
53
|
+
<script>
|
|
54
|
+
const wb = CutWorkbench.initCutWorkbench('#app', { theme: 'dark' })
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> ⚠️ React 19 不再发布 UMD 产物,因此 UMD 版本内置了一份 React。有任何构建工具时
|
|
59
|
+
> 都优先选 ESM。
|
|
60
|
+
|
|
61
|
+
## 主题定制
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<CutWorkbenchProvider theme="inherit" /> // 跟随宿主 <html class="dark">
|
|
65
|
+
<CutWorkbenchProvider tokens={{ primary: '#4d6bfe', radius: '8px' }} />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
token 通过根节点 inline style 应用,优先级高于样式表,不依赖引入顺序;变量都带
|
|
69
|
+
`--cw-` 前缀且挂在 `.cw-root` 上,不污染宿主 `:root`。
|
|
70
|
+
|
|
71
|
+
## 样式隔离
|
|
72
|
+
|
|
73
|
+
- 不引 preflight,宿主 `h1` / `button` 默认样式不变;
|
|
74
|
+
- 每条 utility 前置 `.cw-root`,宿主的 `.flex` 与工作台的互不干扰;
|
|
75
|
+
- 不使用 `@layer`,避免被宿主未分层样式压过。
|
|
76
|
+
|
|
77
|
+
## 导出与 Worker
|
|
78
|
+
|
|
79
|
+
导出默认在 Web Worker 中执行,产物里的 `assets/export.worker-*.js` 由
|
|
80
|
+
`@cut-workbench/workbench` 自身携带。若宿主有严格 CSP,可用
|
|
81
|
+
`HostBridge.createExportWorker` 完全接管 Worker 的创建。
|
|
82
|
+
|
|
83
|
+
含文字片段的工程会自动回退主线程渲染(文字依赖 DOM)。
|
|
84
|
+
|
|
85
|
+
## 浏览器要求
|
|
86
|
+
|
|
87
|
+
仅支持 Chromium 内核(Chrome / Edge):WebAV 依赖 WebCodecs 与 OPFS。
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作台容器:把「三栏骨架 + 顶栏 + 弹窗」组装成一个可配置组件。
|
|
3
|
+
*
|
|
4
|
+
* 与旧 `App` 的区别:
|
|
5
|
+
* - 不自己创建编辑器(由外层 Provider 注入),因此支持多实例;
|
|
6
|
+
* - 顶栏的保存/打开走调用方传入的回调,不写死 IndexedDB;
|
|
7
|
+
* - 每个面板都可以被 `slots` 替换,宿主想换掉哪块就换哪块;
|
|
8
|
+
* - 不强制能力阻断页(宿主可自行决定)。
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from 'react';
|
|
11
|
+
export interface CutWorkbenchSlots {
|
|
12
|
+
/** 替换内置顶栏;传 `null` 表示不要顶栏 */
|
|
13
|
+
topBar?: ReactNode | null;
|
|
14
|
+
mediaLibrary?: ReactNode;
|
|
15
|
+
preview?: ReactNode;
|
|
16
|
+
inspector?: ReactNode;
|
|
17
|
+
timeline?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface CutWorkbenchProps {
|
|
20
|
+
slots?: CutWorkbenchSlots;
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 工程持久化回调。
|
|
24
|
+
*
|
|
25
|
+
* 不传则顶栏的「保存 / 打开」按钮隐藏 —— 库不假设宿主用 IndexedDB、文件还是云端。
|
|
26
|
+
*/
|
|
27
|
+
onSaveProject?: () => Promise<void> | void;
|
|
28
|
+
onOpenProject?: () => Promise<void> | void;
|
|
29
|
+
/** 是否在能力不足时显示阻断页(宿主自己负责环境校验时可关闭) */
|
|
30
|
+
enforceCapability?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 工作台主体。
|
|
34
|
+
*
|
|
35
|
+
* 必须在 `<WorkbenchProvider>` + `<CutEditorProvider>` 之内使用。
|
|
36
|
+
*/
|
|
37
|
+
export declare function CutWorkbench({ slots, className, onSaveProject, onOpenProject, enforceCapability, }: CutWorkbenchProps): import("react").JSX.Element;
|