@webpacked-timeline/core 1.0.0-beta.1

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 (77) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +21 -0
  3. package/README.md +162 -0
  4. package/dist/chunk-27XCNVPR.js +5969 -0
  5. package/dist/chunk-6PDBJDHM.js +2263 -0
  6. package/dist/chunk-BWPS6NQT.js +7465 -0
  7. package/dist/chunk-FBOYSUYV.js +1280 -0
  8. package/dist/chunk-FR632TZX.js +1870 -0
  9. package/dist/chunk-HW4Z7YLJ.js +1242 -0
  10. package/dist/chunk-HWW62IFH.js +5424 -0
  11. package/dist/chunk-I2GZXRH4.js +4790 -0
  12. package/dist/chunk-JQZE3OK4.js +1255 -0
  13. package/dist/chunk-KF7JNK2F.js +1864 -0
  14. package/dist/chunk-KR3P2DYK.js +5655 -0
  15. package/dist/chunk-MO5DSFSW.js +2214 -0
  16. package/dist/chunk-MQAW33RJ.js +5530 -0
  17. package/dist/chunk-N4WUWZZX.js +2833 -0
  18. package/dist/chunk-NRJV7I4C.js +1331 -0
  19. package/dist/chunk-NXG52532.js +2230 -0
  20. package/dist/chunk-PVXF67CN.js +1278 -0
  21. package/dist/chunk-QSB6DHIF.js +5429 -0
  22. package/dist/chunk-QYWJT7HR.js +5837 -0
  23. package/dist/chunk-SWBRCMW7.js +7466 -0
  24. package/dist/chunk-TAT3ULSV.js +2214 -0
  25. package/dist/chunk-TTDP5JUM.js +2228 -0
  26. package/dist/chunk-UAGP4VPG.js +1739 -0
  27. package/dist/chunk-WIG6SY7A.js +1183 -0
  28. package/dist/chunk-YJ2K5N2R.js +6187 -0
  29. package/dist/index-3Lr_vKBd.d.cts +2810 -0
  30. package/dist/index-3Lr_vKBd.d.ts +2810 -0
  31. package/dist/index-7IPJn1yM.d.cts +1146 -0
  32. package/dist/index-7IPJn1yM.d.ts +1146 -0
  33. package/dist/index-B0xOv0V0.d.cts +3259 -0
  34. package/dist/index-B0xOv0V0.d.ts +3259 -0
  35. package/dist/index-B2m3zwg7.d.cts +1381 -0
  36. package/dist/index-B2m3zwg7.d.ts +1381 -0
  37. package/dist/index-B3sUrU_X.d.cts +1249 -0
  38. package/dist/index-B3sUrU_X.d.ts +1249 -0
  39. package/dist/index-B6wla7ZJ.d.cts +2751 -0
  40. package/dist/index-B6wla7ZJ.d.ts +2751 -0
  41. package/dist/index-BIv8RWWT.d.cts +1574 -0
  42. package/dist/index-BIv8RWWT.d.ts +1574 -0
  43. package/dist/index-BJv6hDHL.d.cts +3255 -0
  44. package/dist/index-BJv6hDHL.d.ts +3255 -0
  45. package/dist/index-BUCimS2e.d.cts +1393 -0
  46. package/dist/index-BUCimS2e.d.ts +1393 -0
  47. package/dist/index-Bw_nvNcG.d.cts +1275 -0
  48. package/dist/index-Bw_nvNcG.d.ts +1275 -0
  49. package/dist/index-ByG0gOtd.d.cts +1167 -0
  50. package/dist/index-ByG0gOtd.d.ts +1167 -0
  51. package/dist/index-CDGd2XXv.d.cts +2492 -0
  52. package/dist/index-CDGd2XXv.d.ts +2492 -0
  53. package/dist/index-CznAVeJ6.d.cts +1145 -0
  54. package/dist/index-CznAVeJ6.d.ts +1145 -0
  55. package/dist/index-DQD9IMh7.d.cts +2534 -0
  56. package/dist/index-DQD9IMh7.d.ts +2534 -0
  57. package/dist/index-Dl3qtJEI.d.cts +2178 -0
  58. package/dist/index-Dl3qtJEI.d.ts +2178 -0
  59. package/dist/index-DnE2A-Nz.d.cts +2603 -0
  60. package/dist/index-DnE2A-Nz.d.ts +2603 -0
  61. package/dist/index-DrOA6QmW.d.cts +2492 -0
  62. package/dist/index-DrOA6QmW.d.ts +2492 -0
  63. package/dist/index-Vpa3rPEM.d.cts +1402 -0
  64. package/dist/index-Vpa3rPEM.d.ts +1402 -0
  65. package/dist/index-jP6BomSd.d.cts +2640 -0
  66. package/dist/index-jP6BomSd.d.ts +2640 -0
  67. package/dist/index-wiGRwVyY.d.cts +3259 -0
  68. package/dist/index-wiGRwVyY.d.ts +3259 -0
  69. package/dist/index.cjs +7386 -0
  70. package/dist/index.d.cts +1 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.js +263 -0
  73. package/dist/internal.cjs +7721 -0
  74. package/dist/internal.d.cts +704 -0
  75. package/dist/internal.d.ts +704 -0
  76. package/dist/internal.js +405 -0
  77. package/package.json +58 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@webpacked-timeline/core` are documented here.
4
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
+
6
+ ## [1.0.0-beta.1] - 2026-03-07
7
+
8
+ ### Added
9
+ - Core state model: `Timeline`, `Track`, `Clip`, `Asset` with branded IDs (`ClipId`, `TrackId`, `AssetId`, `TimelineFrame`, `FrameRate`)
10
+ - Factory functions: `createTimeline`, `createTrack`, `createClip`, `createAsset`, `createTimelineState`
11
+ - Frame utilities: `toFrame`, `frameRate`, `framesToTimecode`, `framesToSeconds`, `secondsToFrames`, `FrameRates`, drop-frame support
12
+ - Atomic dispatcher with rolling-state validation (`dispatch`)
13
+ - 40+ operation primitives: `MOVE_CLIP`, `RESIZE_CLIP`, `SLICE_CLIP`, `DELETE_CLIP`, `INSERT_CLIP`, `SET_MEDIA_BOUNDS`, `SET_CLIP_ENABLED`, `SET_CLIP_SPEED`, `ADD_TRACK`, `DELETE_TRACK`, `REORDER_TRACK`, `REGISTER_ASSET`, `ADD_MARKER`, `MOVE_MARKER`, `DELETE_MARKER`, `SET_IN_POINT`, `SET_OUT_POINT`, `ADD_BEAT_GRID`, `INSERT_GENERATOR`, `ADD_CAPTION`, `EDIT_CAPTION`, `DELETE_CAPTION`, `ADD_EFFECT`, `REMOVE_EFFECT`, `ADD_KEYFRAME`, `MOVE_KEYFRAME`, `DELETE_KEYFRAME`, `SET_CLIP_TRANSFORM`, `SET_AUDIO_PROPERTIES`, `ADD_TRANSITION`, `DELETE_TRANSITION`, `LINK_CLIPS`, `UNLINK_CLIPS`, and more
14
+ - Invariant checker with 9 validation rules (`checkInvariants`)
15
+ - `HistoryStack` with undo/redo and configurable limit
16
+ - `TransactionCompressor` for merging rapid sequential edits
17
+ - Tool system: `ITool` interface, `ToolRegistry`, `ProvisionalManager` for drag previews
18
+ - 12 built-in tools: `SelectionTool`, `RazorTool`, `RippleTrimTool`, `RollTrimTool`, `SlipTool`, `SlideTool`, `RippleDeleteTool`, `RippleInsertTool`, `HandTool`, `TransitionTool`, `KeyframeTool`, `ZoomTool`
19
+ - Snap system: `SnapIndexManager`, `buildSnapIndex`, `nearest`
20
+ - `PlayheadController` with play/pause/seek and J/K/L shuttle
21
+ - `PlaybackEngine` with pipeline contracts (`VideoDecoder`, `AudioDecoder`, `Compositor`)
22
+ - `KeyboardHandler` with configurable key bindings
23
+ - Versioned JSON serialization: `serializeTimeline`, `deserializeTimeline` with automatic migration
24
+ - Export: `exportToOTIO`, `importFromOTIO`, `exportToEDL`, `exportToAAF`, `exportToFCPXML`
25
+ - SRT/VTT subtitle import: `parseSRT`, `parseVTT`, `subtitleImportToOps`
26
+ - Project model: `Project`, `Bin` with `addTimeline`, `addBin`, `serializeProject`, `deserializeProject`
27
+ - `IntervalTree` for O(log n) clip lookup
28
+ - `TrackIndex` for fast track-level queries
29
+ - `ThumbnailCache` (LRU) and `ThumbnailQueue` (priority)
30
+ - Virtual windowing: `getVisibleClips`, `getVisibleFrameRange`
31
+ - `diffStates` for efficient state change detection
32
+ - Effects, keyframes, easing curves, clip transforms, audio properties
33
+ - Transitions with alignment and duration controls
34
+ - Track groups and link groups
35
+ - Clock abstraction: `browserClock`, `nodeClock`, `createTestClock`
36
+ - 852 tests passing
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Timeline 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,162 @@
1
+ # @webpacked-timeline/core
2
+
3
+ Headless TypeScript engine for professional NLE timeline editing. Framework-agnostic, fully tested, zero dependencies.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @webpacked-timeline/core
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - **40+ atomic operations** — `MOVE_CLIP`, `RESIZE_CLIP`, `SLICE_CLIP`, `INSERT_CLIP`, `DELETE_CLIP`, `SET_MEDIA_BOUNDS`, `ADD_TRACK`, `DELETE_TRACK`, `ADD_MARKER`, `ADD_EFFECT`, `ADD_KEYFRAME`, `ADD_TRANSITION`, `LINK_CLIPS`, and more
14
+ - **Tool system** — Selection, Razor, Ripple Trim, Roll Trim, Slip, Slide, Ripple Delete, Ripple Insert, Hand, Transition, Keyframe, Zoom
15
+ - **Undo/redo** with transaction compression
16
+ - **Playback engine** with J/K/L shuttle control via `KeyboardHandler`
17
+ - **Snap system** — `SnapIndexManager` with configurable snap points
18
+ - **Virtual windowing** — `getVisibleClips()` / `getVisibleFrameRange()` for large timelines
19
+ - **Export** — OTIO, EDL (CMX 3600), AAF, FCP XML
20
+ - **Serialization** — versioned JSON with `serializeTimeline` / `deserializeTimeline`
21
+ - **Import** — SRT and VTT subtitle import
22
+ - **Project model** — multi-timeline container with bin/folder hierarchy
23
+ - **Interval tree** — O(log n) clip lookup via `IntervalTree` / `TrackIndex`
24
+ - **Branded types** — `TimelineFrame`, `ClipId`, `TrackId`, `FrameRate` are distinct at compile time
25
+ - **Zero dependencies**
26
+
27
+ ## Quick Start
28
+
29
+ ```typescript
30
+ import {
31
+ createTimelineState,
32
+ createTimeline,
33
+ createTrack,
34
+ createClip,
35
+ dispatch,
36
+ checkInvariants,
37
+ toFrame,
38
+ toTrackId,
39
+ toClipId,
40
+ toAssetId,
41
+ frameRate,
42
+ } from '@webpacked-timeline/core';
43
+
44
+ // 1. Build initial state
45
+ const state = createTimelineState({
46
+ timeline: createTimeline({
47
+ id: 'tl-1',
48
+ name: 'My Timeline',
49
+ fps: frameRate(30),
50
+ duration: toFrame(9000),
51
+ tracks: [
52
+ createTrack({ id: toTrackId('v1'), name: 'Video 1', type: 'video' }),
53
+ ],
54
+ }),
55
+ });
56
+
57
+ // 2. Dispatch an operation
58
+ const result = dispatch(state, {
59
+ id: 'tx-1',
60
+ label: 'Insert clip',
61
+ timestamp: Date.now(),
62
+ operations: [{
63
+ type: 'INSERT_CLIP',
64
+ trackId: toTrackId('v1'),
65
+ clip: createClip({
66
+ id: toClipId('clip-1'),
67
+ assetId: toAssetId('asset-1'),
68
+ trackId: toTrackId('v1'),
69
+ timelineStart: toFrame(0),
70
+ timelineEnd: toFrame(90),
71
+ mediaIn: toFrame(0),
72
+ mediaOut: toFrame(90),
73
+ name: 'Intro',
74
+ }),
75
+ }],
76
+ });
77
+
78
+ // 3. Validate
79
+ if (result.ok) {
80
+ const violations = checkInvariants(result.state);
81
+ console.log(violations); // []
82
+ }
83
+ ```
84
+
85
+ ## Playback
86
+
87
+ ```typescript
88
+ import { PlaybackEngine, browserClock } from '@webpacked-timeline/core';
89
+
90
+ const playback = new PlaybackEngine(
91
+ state,
92
+ { videoDecoder, compositor }, // PipelineConfig
93
+ { width: 1920, height: 1080 },
94
+ browserClock,
95
+ );
96
+
97
+ playback.play();
98
+ ```
99
+
100
+ ## Serialization
101
+
102
+ ```typescript
103
+ import {
104
+ serializeTimeline,
105
+ deserializeTimeline,
106
+ exportToOTIO,
107
+ exportToEDL,
108
+ exportToAAF,
109
+ exportToFCPXML,
110
+ } from '@webpacked-timeline/core';
111
+
112
+ // JSON round-trip
113
+ const json = serializeTimeline(state);
114
+ const restored = deserializeTimeline(json);
115
+
116
+ // Industry formats
117
+ const otio = exportToOTIO(state);
118
+ const edl = exportToEDL(state);
119
+ const aaf = exportToAAF(state);
120
+ const fcpxml = exportToFCPXML(state);
121
+ ```
122
+
123
+ ## Architecture
124
+
125
+ - **Immutable state** — every operation returns a new object; unchanged clips keep their reference identity
126
+ - **Rolling-state validation** — each op in a compound transaction is validated against the result of the previous op
127
+ - **Branded types** — `TimelineFrame`, `ClipId`, `TrackId` are distinct types at compile time
128
+ - **No DOM, no React** — safe to use in Workers, Node.js, or Electron main process
129
+
130
+ ## API Reference
131
+
132
+ ### Factories
133
+ `createTimeline`, `createTrack`, `createClip`, `createAsset`, `createTimelineState`
134
+
135
+ ### Frame Utilities
136
+ `toFrame`, `frameRate`, `framesToTimecode`, `framesToSeconds`, `secondsToFrames`, `FrameRates`
137
+
138
+ ### State Management
139
+ `dispatch`, `checkInvariants`, `HistoryStack`, `TransactionCompressor`
140
+
141
+ ### Tools
142
+ `SelectionTool`, `RazorTool`, `RippleTrimTool`, `RollTrimTool`, `SlipTool`, `SlideTool`, `RippleDeleteTool`, `RippleInsertTool`, `HandTool`, `TransitionTool`, `KeyframeTool`, `ZoomTool`
143
+
144
+ ### Playback
145
+ `PlaybackEngine`, `PlayheadController`, `KeyboardHandler`, `browserClock`, `nodeClock`
146
+
147
+ ### Serialization & Export
148
+ `serializeTimeline`, `deserializeTimeline`, `exportToOTIO`, `importFromOTIO`, `exportToEDL`, `exportToAAF`, `exportToFCPXML`
149
+
150
+ ### Performance
151
+ `IntervalTree`, `TrackIndex`, `SnapIndexManager`, `ThumbnailCache`, `ThumbnailQueue`, `getVisibleClips`
152
+
153
+ ## Tests
154
+
155
+ ```bash
156
+ pnpm --filter @webpacked-timeline/core test
157
+ # 852 tests, 0 TypeScript errors
158
+ ```
159
+
160
+ ## License
161
+
162
+ MIT