@elah/editor 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,133 @@
1
+ # Elah Community License (ECL) v1.0
2
+
3
+ Copyright (c) 2026 Elah Labs Private Limited
4
+
5
+ All rights reserved.
6
+
7
+ ---
8
+
9
+ ## 1. Purpose
10
+
11
+ The Elah Community License (ECL) is intended to support open development, community adoption, and commercial sustainability of the Elah video editing engine and related software.
12
+
13
+ This license allows developers and organizations to use, modify, and integrate the Software into their own applications while protecting the Software from unauthorized resale, rebranding, or competing hosted platforms.
14
+
15
+ ---
16
+
17
+ ## 2. Definitions
18
+
19
+ * **"Software"** means the source code, binaries, assets, examples, documentation, and related materials distributed under this license.
20
+ * **"Licensor"** means Elah Labs Private Limited and its contributors.
21
+ * **"You"** means any individual or legal entity using the Software.
22
+ * **"Derivative Work"** means any modified version, extension, adaptation, or enhancement of the Software.
23
+ * **"Hosted Service"** means a commercial product or platform where the Software itself is exposed as a primary service, editor, API, infrastructure layer, or SaaS offering to third parties over a network.
24
+
25
+ ---
26
+
27
+ ## 3. Permitted Uses
28
+
29
+ Subject to the terms of this license, you may:
30
+
31
+ * Use the Software for personal, educational, research, and commercial internal purposes.
32
+ * Modify and extend the Software.
33
+ * Integrate or embed the Software into your own applications, platforms, or workflows.
34
+ * Use the Software in commercial products that are not primarily competing video editing platforms.
35
+ * Self-host the Software for internal use.
36
+ * Create plugins, integrations, extensions, or tooling around the Software.
37
+ * Distribute Derivative Works under this same license.
38
+ * Provide consulting, support, training, or integration services related to the Software.
39
+
40
+ ---
41
+
42
+ ## 4. Restrictions
43
+
44
+ You may not:
45
+
46
+ * Sell, sublicense, or redistribute the Software as a standalone product.
47
+ * Rebrand the Software and present it as your own core editor engine or framework.
48
+ * Offer the Software, or substantially similar functionality derived from it, as a commercial Hosted Service or SaaS platform without prior written permission from the Licensor.
49
+ * Build or operate a competing commercial browser-based video editor primarily derived from the Software.
50
+ * Remove or alter copyright notices, attribution notices, or license terms included with the Software.
51
+ * Misrepresent your relationship with the Licensor or imply official partnership without permission.
52
+
53
+ ---
54
+
55
+ ## 5. Attribution
56
+
57
+ Any public distribution of the Software or Derivative Works must include:
58
+
59
+ * A copy of this license
60
+ * Appropriate copyright notices
61
+ * Clear indication of modifications made to the Software
62
+ * Attribution to Elah
63
+
64
+ Suggested attribution:
65
+
66
+ > Powered by Elah
67
+
68
+ ---
69
+
70
+ ## 6. Commercial Licensing
71
+
72
+ A separate commercial license is required for:
73
+
74
+ * Hosted editor platforms or SaaS offerings
75
+ * White-label editing platforms
76
+ * Commercial infrastructure services built primarily around the Software
77
+ * Enterprise redistribution agreements
78
+ * Uses outside the permissions granted by this license
79
+
80
+ Commercial licensing inquiries:
81
+
82
+ [paul@elah.dev](mailto:paul@elah.dev)
83
+
84
+ ---
85
+
86
+ ## 7. Contributions
87
+
88
+ Unless otherwise agreed in writing, any contribution intentionally submitted for inclusion in the Software shall be licensed under the terms of this license.
89
+
90
+ ---
91
+
92
+ ## 8. Disclaimer of Warranty
93
+
94
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
95
+
96
+ ---
97
+
98
+ ## 9. Limitation of Liability
99
+
100
+ IN NO EVENT SHALL THE LICENSOR OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
101
+
102
+ ---
103
+
104
+ ## 10. Termination
105
+
106
+ This license automatically terminates if you fail to comply with its terms. Upon termination, all rights granted under this license immediately cease.
107
+
108
+ ---
109
+
110
+ ## 11. Governing Law
111
+
112
+ This license shall be governed by the laws applicable in the Licensor's jurisdiction, without regard to conflict of law principles.
113
+
114
+ ---
115
+
116
+ ## 12. Entire Agreement
117
+
118
+ This license constitutes the complete agreement regarding the Software and supersedes all prior agreements relating to its subject matter.
119
+
120
+ ---
121
+
122
+ ## 13. License Updates
123
+
124
+ The Licensor may publish updated versions of this license in the future. Continued use of the Software after such updates constitutes acceptance of the updated license terms.
125
+
126
+ ---
127
+
128
+ ## 14. Contact
129
+
130
+ For licensing questions or commercial inquiries:
131
+
132
+ * Email: [paul@elah.dev](mailto:paul@elah.dev)
133
+ * Website: https://elah.dev
package/README.md CHANGED
@@ -1,127 +1,160 @@
1
- # @elah/editor
2
-
3
- The full Elah video editor SDK for React. Combines the core engine, timeline UI, WebGL2 renderer, media library, and export pipeline into a single package.
4
-
5
- [![npm](https://img.shields.io/npm/v/@elah/editor)](https://www.npmjs.com/package/@elah/editor)
6
- [![license](https://img.shields.io/badge/license-ECL--1.0-blue)](https://github.com/elahlabs/elah/blob/main/LICENSE)
7
-
8
- ---
9
-
10
- ## Install
11
-
12
- ```bash
13
- npm install @elah/editor
14
- ```
15
-
16
- Peer dependencies: `react`, `react-dom` >= 18.
17
-
18
- ---
19
-
20
- ## Quick start
21
-
22
- ```tsx
23
- import { EditorProvider, Timeline } from '@elah/editor'
24
-
25
- function App() {
26
- return (
27
- <EditorProvider fps={30}>
28
- <Timeline style={{ height: 300 }} />
29
- </EditorProvider>
30
- )
31
- }
32
- ```
33
-
34
- ---
35
-
36
- ## With preview and asset panel
37
-
38
- ```tsx
39
- import { EditorProvider, Timeline, Preview, AssetPanel, createMediabunnyBackend } from '@elah/editor'
40
- import * as mediabunny from 'mediabunny'
41
-
42
- const demuxerFactory = () =>
43
- createMediabunnyBackend(mediabunny, {
44
- blobResolver: (src) => fetch(src).then((r) => r.blob()),
45
- })
46
-
47
- function App() {
48
- return (
49
- <EditorProvider fps={30}>
50
- <div style={{ display: 'flex', height: '100vh' }}>
51
- <AssetPanel style={{ width: 220 }} />
52
- <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
53
- <Preview demuxerFactory={demuxerFactory} style={{ flex: 1 }} />
54
- <Timeline style={{ height: 300 }} />
55
- </div>
56
- </div>
57
- </EditorProvider>
58
- )
59
- }
60
- ```
61
-
62
- ---
63
-
64
- ## Import media
65
-
66
- ```ts
67
- import { importFiles, useMediaLibrary } from '@elah/editor'
68
-
69
- await importFiles(Array.from(fileList))
70
-
71
- // Subscribe in React
72
- const assets = useMediaLibrary(s => s.assets)
73
- ```
74
-
75
- ---
76
-
77
- ## Export to MP4
78
-
79
- ```ts
80
- import { exportVideo } from '@elah/editor'
81
-
82
- const blob = await exportVideo(engine.getProject(), {
83
- videoBitrate: 8_000_000,
84
- onProgress: ({ frame, totalFrames }) => {
85
- console.log(`${Math.round((frame / totalFrames) * 100)}%`)
86
- },
87
- })
88
- ```
89
-
90
- Runs in a web worker. Reuses `resolveTimeline` + the GPU renderer's placement math.
91
-
92
- ---
93
-
94
- ## Keyboard shortcuts
95
-
96
- | Key | Action |
97
- |---|---|
98
- | `Space` | Play / pause |
99
- | `S` | Split clip at playhead |
100
- | `Delete` / `Backspace` | Delete selected clip(s) |
101
- | `Ctrl/Cmd + C` | Copy |
102
- | `Ctrl/Cmd + V` | Paste at playhead |
103
- | `Ctrl/Cmd + Z` | Undo |
104
- | `Ctrl/Cmd + Shift + Z` | Redo |
105
- | `Ctrl/Cmd + scroll` | Zoom |
106
- | `← / →` | Step one frame |
107
-
108
- ---
109
-
110
- ## Package layers
111
-
112
- ```
113
- @elah/core — engine, playback, resolver, stores, media, export (framework-agnostic)
114
- @elah/timeline — React timeline UI components and hooks
115
- @elah/editor — EditorProvider, Preview, AssetPanel + re-exports everything above
116
- ```
117
-
118
- Use `@elah/editor` for the full experience. Use `@elah/core` directly for headless or custom rendering pipelines.
119
-
120
- ---
121
-
122
- ## Links
123
-
124
- - [Website](https://www.elah.dev)
125
- - [GitHub](https://github.com/elahlabs/elah)
126
- - [License](https://github.com/elahlabs/elah/blob/main/LICENSE)
127
- - [Commercial licensing](mailto:contact@elah.dev)
1
+ # @elah/editor
2
+
3
+ The full Elah video editor SDK for React. Combines the core engine, timeline UI, WebGL2 renderer, media library, and export pipeline into a single package.
4
+
5
+ Ships `EditorProvider`, `Preview` (WebGL2 canvas + interactive transform overlays), `Timeline`, `AssetPanel`, `SourcePanel`, and `ElementsPanel`, and re-exports the entire `@elah/core` and `@elah/timeline` API. Supports video, image, text, **shape**, and **freehand** clips, **multi-track audio**, and MP4 export.
6
+
7
+ [![npm](https://img.shields.io/npm/v/@elah/editor)](https://www.npmjs.com/package/@elah/editor)
8
+ [![gzip size](https://img.shields.io/badge/gzip-~63%20KiB%20full%20SDK-brightgreen)](../../BUNDLE_STRATEGY.md)
9
+ [![license](https://img.shields.io/badge/license-ECL--1.0-blue)](https://github.com/elahlabs/elah/blob/main/LICENSE)
10
+
11
+ ---
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @elah/editor
17
+ ```
18
+
19
+ Peer dependencies: `react`, `react-dom` >= 18.
20
+
21
+ **Bundle size:** ~10 KiB gzipped for the editor layer (51 KiB raw); ~63 KiB gzipped for the full SDK graph (`core` + `timeline` + `editor`, 330 KiB raw). `mediabunny` is injected, never bundled — see [BUNDLE_STRATEGY.md](../../BUNDLE_STRATEGY.md).
22
+
23
+ ---
24
+
25
+ ## Quick start
26
+
27
+ ```tsx
28
+ import { EditorProvider, Timeline } from '@elah/editor'
29
+
30
+ function App() {
31
+ return (
32
+ <EditorProvider fps={30}>
33
+ <Timeline style={{ height: 300 }} />
34
+ </EditorProvider>
35
+ )
36
+ }
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Styling
42
+
43
+ Import the compiled stylesheets once. They are plain CSS — your app does **not**
44
+ need Tailwind, and no utility class names leak into your global scope (preflight
45
+ is disabled, so nothing resets your elements):
46
+
47
+ ```ts
48
+ import '@elah/timeline/styles.css'
49
+ import '@elah/editor/styles.css'
50
+ import '@elah/editor/styles/tokens.css' // --elah-* dark defaults (standalone)
51
+ ```
52
+
53
+ When embedding inside an app that already defines `.elah-root` (mapping `--elah-*`
54
+ onto its own design system), skip `tokens.css`. Re-theme or white-label by
55
+ overriding `--elah-*` variables in your own `.elah-root` scope — see
56
+ [design-tokens.md](https://github.com/elahlabs/elah/blob/main/docs/design-tokens.md).
57
+
58
+ ---
59
+
60
+ ## With preview and asset panel
61
+
62
+ ```tsx
63
+ import { EditorProvider, Timeline, Preview, AssetPanel, createDefaultDemuxerFactory } from '@elah/editor'
64
+
65
+ const demuxerFactory = createDefaultDemuxerFactory()
66
+
67
+ function App() {
68
+ return (
69
+ <EditorProvider fps={30}>
70
+ <div style={{ display: 'flex', height: '100vh' }}>
71
+ <AssetPanel style={{ width: 220 }} />
72
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
73
+ <Preview demuxerFactory={demuxerFactory} style={{ flex: 1 }} />
74
+ <Timeline style={{ height: 300 }} />
75
+ </div>
76
+ </div>
77
+ </EditorProvider>
78
+ )
79
+ }
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Import media
85
+
86
+ ```ts
87
+ import { importFiles, importUrl, useMediaLibrary } from '@elah/editor'
88
+
89
+ await importFiles(Array.from(fileList)) // local files
90
+ await importUrl('https://example.com/clip.mp4') // remote URL (also importBlob for blobs)
91
+
92
+ // Subscribe in React — useMediaLibrary() takes no arguments and returns
93
+ // { assets, getAsset, removeAsset, updateAsset } with assets in insertion order.
94
+ const { assets } = useMediaLibrary()
95
+ ```
96
+
97
+ ### Programmatic insertion (no drag)
98
+
99
+ ```ts
100
+ import { insertMediaAsset } from '@elah/editor'
101
+
102
+ // Place an imported asset onto the timeline — powers tap-to-add on touch.
103
+ // Returns a typed InsertAssetResult ({ ok, kind, trackId, clipIds } | { ok:false, reason }).
104
+ const result = await insertMediaAsset(engine, assetId, { desiredStartFrame: 0 })
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Export to MP4
110
+
111
+ ```ts
112
+ import { exportVideo } from '@elah/editor'
113
+
114
+ const blob = await exportVideo(engine.getProject(), {
115
+ videoBitrate: 8_000_000,
116
+ onProgress: ({ frame, totalFrames }) => {
117
+ console.log(`${Math.round((frame / totalFrames) * 100)}%`)
118
+ },
119
+ })
120
+ ```
121
+
122
+ Runs in a web worker. Reuses `resolveTimeline` + the GPU renderer's placement math.
123
+
124
+ ---
125
+
126
+ ## Keyboard shortcuts
127
+
128
+ | Key | Action |
129
+ |---|---|
130
+ | `Space` | Play / pause |
131
+ | `S` | Split clip at playhead |
132
+ | `Delete` / `Backspace` | Delete selected clip(s) |
133
+ | `Ctrl/Cmd + C` | Copy |
134
+ | `Ctrl/Cmd + V` | Paste at playhead |
135
+ | `Ctrl/Cmd + Z` | Undo |
136
+ | `Ctrl/Cmd + Shift + Z` / `Ctrl/Cmd + Y` | Redo |
137
+ | `Ctrl/Cmd + scroll` | Zoom |
138
+ | `← / →` | Step one frame |
139
+
140
+ ---
141
+
142
+ ## Package layers
143
+
144
+ ```
145
+ @elah/core — engine, playback, resolver, stores, media, export (framework-agnostic)
146
+ @elah/timeline — React timeline UI components and hooks
147
+ @elah/editor — EditorProvider, Preview, AssetPanel + re-exports everything above
148
+ ```
149
+
150
+ Use `@elah/editor` for the full experience. Use `@elah/core` directly for headless or custom rendering pipelines.
151
+
152
+ ---
153
+
154
+ ## Links
155
+
156
+ - [Website](https://www.elah.dev)
157
+ - [GitHub](https://github.com/elahlabs/elah)
158
+ - [Discord](https://discord.gg/8CeZ2XbPy)
159
+ - [License](https://github.com/elahlabs/elah/blob/main/LICENSE)
160
+ - [Commercial licensing](mailto:paul@elah.dev)
@@ -1,6 +1,9 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { type AssetActivationHandler } from '../activation';
2
3
  export interface AssetPanelProps {
3
4
  style?: CSSProperties;
4
5
  className?: string;
6
+ activateOnTap?: boolean;
7
+ onAssetActivate?: AssetActivationHandler;
5
8
  }
6
- export declare function AssetPanel({ style, className }: AssetPanelProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function AssetPanel({ style, className, activateOnTap, onAssetActivate, }: AssetPanelProps): import("react/jsx-runtime").JSX.Element;