@molecule/app-feature-video-timeline-solid 0.0.0-stage → 0.0.1-stage

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,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @molecule/app-feature-video-timeline-solid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Multi-track video timeline composing track-lane rows with a time ruler, playhead, zoom controls, and ripple/insert edit modes
4
+
5
+ ```
6
+ npm install @molecule/app-feature-video-timeline-solid
7
+ ```
8
+
9
+ Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
10
+
11
+ License: Apache-2.0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Solid multi-track video timeline: one `<TrackLane>` row per track with a
3
+ * shared time ruler, playhead, zoom slider + Ctrl+wheel zoom, and ripple /
4
+ * insert edit modes.
5
+ *
6
+ * Solid counterpart of `@molecule/app-feature-video-timeline-react`'s
7
+ * `VideoTimeline` — the same props (React names), the same DOM for the same
8
+ * input, and the same callback calls.
9
+ *
10
+ * @module
11
+ */
12
+ import { type Component } from 'solid-js';
13
+ import type { VideoTimelineProps } from './types.js';
14
+ /**
15
+ * Multi-track video timeline. Composes one `<TrackLane>` per track with
16
+ * a shared time ruler at the top, a vertical playhead, and a zoom slider
17
+ * row. Pointer-down on the ruler scrubs `onSeek`; Ctrl+wheel anywhere
18
+ * over the body changes zoom; the slider is keyboard-accessible.
19
+ *
20
+ * In `'ripple'` mode (default), dragging a clip on a lane shifts every
21
+ * subsequent clip on that lane by the same delta — `onClipMove` is
22
+ * called once per affected clip. In `'insert'` mode, only the dragged
23
+ * clip moves.
24
+ *
25
+ * React keys each track row by its `id` value, so a re-passed or re-ordered
26
+ * array keeps the rendered rows per id. Solid's `For` keys by reference, so
27
+ * the rows are keyed through stable per-id records: the record for an id is
28
+ * created once and reused, while the row's content reads the CURRENT track
29
+ * for that id reactively.
30
+ *
31
+ * @param props - Component props (see {@link VideoTimelineProps}).
32
+ * @returns The multi-track timeline.
33
+ */
34
+ export declare const VideoTimeline: Component<VideoTimelineProps>;
35
+ //# sourceMappingURL=VideoTimeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoTimeline.d.ts","sourceRoot":"","sources":["../src/VideoTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAiD,MAAM,UAAU,CAAA;AAoBxF,OAAO,KAAK,EAAuC,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAazF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,kBAAkB,CA+cvD,CAAA"}
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Solid multi-track video timeline: one `<TrackLane>` row per track with a
3
+ * shared time ruler, playhead, zoom slider + Ctrl+wheel zoom, and ripple /
4
+ * insert edit modes.
5
+ *
6
+ * Solid counterpart of `@molecule/app-feature-video-timeline-react`'s
7
+ * `VideoTimeline` — the same props (React names), the same DOM for the same
8
+ * input, and the same callback calls.
9
+ *
10
+ * @module
11
+ */
12
+ import { createEffect, createMemo, For, Show } from 'solid-js';
13
+ import { clipToPixels, pixelsToTime, TrackLane } from '@molecule/app-feature-track-lane-solid';
14
+ import { useTranslation } from '@molecule/app-solid';
15
+ import { getClassMap } from '@molecule/app-ui';
16
+ import { clampZoom, computeRippleUpdates, computeRulerTicks, DEFAULT_LANE_HEADER_WIDTH, DEFAULT_PIXELS_PER_SECOND, DEFAULT_RULER_HEIGHT, DEFAULT_TRACK_HEIGHT, DEFAULT_ZOOM_MAX, DEFAULT_ZOOM_MIN, formatTickTime, ZOOM_WHEEL_FACTOR, zoomFromWheelDelta, } from './timeline.js';
17
+ /**
18
+ * Multi-track video timeline. Composes one `<TrackLane>` per track with
19
+ * a shared time ruler at the top, a vertical playhead, and a zoom slider
20
+ * row. Pointer-down on the ruler scrubs `onSeek`; Ctrl+wheel anywhere
21
+ * over the body changes zoom; the slider is keyboard-accessible.
22
+ *
23
+ * In `'ripple'` mode (default), dragging a clip on a lane shifts every
24
+ * subsequent clip on that lane by the same delta — `onClipMove` is
25
+ * called once per affected clip. In `'insert'` mode, only the dragged
26
+ * clip moves.
27
+ *
28
+ * React keys each track row by its `id` value, so a re-passed or re-ordered
29
+ * array keeps the rendered rows per id. Solid's `For` keys by reference, so
30
+ * the rows are keyed through stable per-id records: the record for an id is
31
+ * created once and reused, while the row's content reads the CURRENT track
32
+ * for that id reactively.
33
+ *
34
+ * @param props - Component props (see {@link VideoTimelineProps}).
35
+ * @returns The multi-track timeline.
36
+ */
37
+ export const VideoTimeline = (props) => {
38
+ const cm = getClassMap();
39
+ const { t } = useTranslation();
40
+ /** The ruler body element, for the pointer-to-time math. */
41
+ let rulerBody;
42
+ /** The zoom slider element, for React's controlled-value restore. */
43
+ let sliderEl;
44
+ /** The ruler scrub in progress, or null. */
45
+ let seekDrag = null;
46
+ /** The duration clamped to >= 0 (React's `safeDuration`). */
47
+ const safeDuration = () => (props.duration > 0 ? props.duration : 0);
48
+ /** The horizontal scale in effect (default 20). */
49
+ const scaleOf = () => props.pixelsPerSecond ?? DEFAULT_PIXELS_PER_SECOND;
50
+ /** The scale clamped to >= 1 (React's `safeScale`). */
51
+ const safeScale = () => (scaleOf() > 0 ? scaleOf() : 1);
52
+ /** The lower zoom bound in effect (default 2). */
53
+ const zoomMinOf = () => props.zoomMin ?? DEFAULT_ZOOM_MIN;
54
+ /** The upper zoom bound in effect (default 200). */
55
+ const zoomMaxOf = () => props.zoomMax ?? DEFAULT_ZOOM_MAX;
56
+ /** The edit mode in effect (default `'ripple'`). */
57
+ const modeOf = () => props.mode ?? 'ripple';
58
+ /** The lane row height in effect (default 44). */
59
+ const trackHeightOf = () => props.trackHeight ?? DEFAULT_TRACK_HEIGHT;
60
+ /** The lane-header column width in effect (default 120). */
61
+ const laneHeaderWidthOf = () => props.laneHeaderWidth ?? DEFAULT_LANE_HEADER_WIDTH;
62
+ /** The ruler row height in effect (default 28). */
63
+ const rulerHeightOf = () => props.rulerHeight ?? DEFAULT_RULER_HEIGHT;
64
+ /** The scrollable body's content width in pixels (React's `bodyWidth`). */
65
+ const bodyWidth = () => Math.max(0, safeDuration() * safeScale());
66
+ /** The ruler ticks, recomputed only when the duration or scale changes. */
67
+ const ticks = createMemo(() => computeRulerTicks(safeDuration(), safeScale()));
68
+ /** One stable record per track id, created on first sight. */
69
+ const records = new Map();
70
+ /**
71
+ * The rows to render, keyed by their stable per-id records.
72
+ *
73
+ * @returns One record per current track, in display order.
74
+ */
75
+ const keyedTracks = () => {
76
+ const seen = new Set();
77
+ const rows = (props.tracks ?? []).map((track) => {
78
+ seen.add(track.id);
79
+ let row = records.get(track.id);
80
+ if (!row) {
81
+ row = { id: track.id };
82
+ records.set(track.id, row);
83
+ }
84
+ return row;
85
+ });
86
+ for (const id of [...records.keys()])
87
+ if (!seen.has(id))
88
+ records.delete(id);
89
+ return rows;
90
+ };
91
+ /**
92
+ * The current track for one row id.
93
+ *
94
+ * @param id - The track id.
95
+ * @returns The track, or undefined while it is absent.
96
+ */
97
+ const trackFor = (id) => (props.tracks ?? []).find((track) => track.id === id);
98
+ /** The playhead's pixel offset on the time axis (React's `playheadPx`). */
99
+ const playheadPx = () => clipToPixels({ startTime: props.currentTime, duration: 0 }, safeScale()).left;
100
+ /** The displayed zoom slider value (React's rounded, clamped scale). */
101
+ const sliderValue = () => Math.round(clampZoom(safeScale(), zoomMinOf(), zoomMaxOf()));
102
+ /** The translated ruler label (React's `videoTimeline.aria.ruler`). */
103
+ const rulerLabel = () => t('videoTimeline.aria.ruler', {}, { defaultValue: 'Time ruler' });
104
+ /** The translated playhead label (React's `videoTimeline.aria.playhead`). */
105
+ const playheadLabel = () => t('videoTimeline.aria.playhead', { time: props.currentTime.toFixed(2) }, { defaultValue: 'Playhead at {{time}}s' });
106
+ /** The translated zoom slider label (React's `videoTimeline.aria.zoom`). */
107
+ const zoomLabel = () => t('videoTimeline.aria.zoom', {}, { defaultValue: 'Timeline zoom' });
108
+ /** The translated zoom-in label (React's `videoTimeline.zoom.in`). */
109
+ const zoomInLabel = () => t('videoTimeline.zoom.in', {}, { defaultValue: 'Zoom in' });
110
+ /** The translated zoom-out label (React's `videoTimeline.zoom.out`). */
111
+ const zoomOutLabel = () => t('videoTimeline.zoom.out', {}, { defaultValue: 'Zoom out' });
112
+ /** The translated mode label (React's `videoTimeline.aria.mode`). */
113
+ const modeLabel = () => t('videoTimeline.aria.mode', {}, { defaultValue: 'Edit mode' });
114
+ /** The translated root label (React's `videoTimeline.aria.root`). */
115
+ const rootLabel = () => t('videoTimeline.aria.root', {}, { defaultValue: 'Video timeline' });
116
+ /** The visible mode text (React's ripple/insert branch). */
117
+ const modeText = () => modeOf() === 'ripple'
118
+ ? t('videoTimeline.mode.ripple', {}, { defaultValue: 'Ripple' })
119
+ : t('videoTimeline.mode.insert', {}, { defaultValue: 'Insert' });
120
+ /** The translated zoom-out glyph (React's `videoTimeline.zoom.out.icon`). */
121
+ const zoomOutIcon = () => t('videoTimeline.zoom.out.icon', {}, { defaultValue: '−' });
122
+ /** The translated zoom-in glyph (React's `videoTimeline.zoom.in.icon`). */
123
+ const zoomInIcon = () => t('videoTimeline.zoom.in.icon', {}, { defaultValue: '+' });
124
+ /**
125
+ * The translated label of one track kind (React's `trackKindLabel`).
126
+ *
127
+ * @param kind - The track kind.
128
+ * @returns The translated kind label.
129
+ */
130
+ const trackKindLabel = (kind) => {
131
+ switch (kind) {
132
+ case 'video':
133
+ return t('videoTimeline.trackKind.video', {}, { defaultValue: 'Video' });
134
+ case 'audio':
135
+ return t('videoTimeline.trackKind.audio', {}, { defaultValue: 'Audio' });
136
+ case 'subtitle':
137
+ return t('videoTimeline.trackKind.subtitle', {}, { defaultValue: 'Subtitle' });
138
+ }
139
+ };
140
+ /**
141
+ * The lane name React passes to `<TrackLane>`: the track's name, or the
142
+ * translated kind label.
143
+ *
144
+ * @param track - The track row.
145
+ * @returns The lane name.
146
+ */
147
+ const laneName = (track) => track.name ?? trackKindLabel(track.kind);
148
+ /**
149
+ * Convert a pointer's clientX (relative to the ruler body) to a time
150
+ * value, clamped into `[0, duration]`.
151
+ *
152
+ * @param clientX - Pointer clientX in viewport coordinates.
153
+ * @returns The seek time in seconds.
154
+ */
155
+ function clientXToTime(clientX) {
156
+ const el = rulerBody;
157
+ if (!el)
158
+ return 0;
159
+ const rect = el.getBoundingClientRect();
160
+ const px = clientX - rect.left;
161
+ const time = pixelsToTime(px, safeScale());
162
+ if (time < 0)
163
+ return 0;
164
+ if (time > safeDuration())
165
+ return safeDuration();
166
+ return time;
167
+ }
168
+ /**
169
+ * Begin a ruler scrub. Subsequent pointermove events while the pointer
170
+ * is captured will continue to fire `onSeek`.
171
+ *
172
+ * @param event - The pointer event from the ruler body.
173
+ */
174
+ function onRulerPointerDown(event) {
175
+ if (event.button !== undefined && event.button !== 0)
176
+ return;
177
+ if (!props.onSeek)
178
+ return;
179
+ seekDrag = { pointerId: event.pointerId };
180
+ try {
181
+ ;
182
+ event.currentTarget.setPointerCapture(event.pointerId);
183
+ }
184
+ catch (_error) {
185
+ // jsdom doesn't always implement setPointerCapture; ignore.
186
+ }
187
+ props.onSeek(clientXToTime(event.clientX));
188
+ }
189
+ /**
190
+ * Continue a ruler scrub.
191
+ *
192
+ * @param event - The pointer event from the ruler body.
193
+ */
194
+ function onRulerPointerMove(event) {
195
+ const drag = seekDrag;
196
+ if (!drag || drag.pointerId !== event.pointerId)
197
+ return;
198
+ props.onSeek?.(clientXToTime(event.clientX));
199
+ }
200
+ /**
201
+ * Finish a ruler scrub.
202
+ *
203
+ * @param event - The pointer event from the ruler body.
204
+ */
205
+ function onRulerPointerUp(event) {
206
+ const drag = seekDrag;
207
+ if (!drag || drag.pointerId !== event.pointerId)
208
+ return;
209
+ seekDrag = null;
210
+ try {
211
+ ;
212
+ event.currentTarget.releasePointerCapture(event.pointerId);
213
+ }
214
+ catch (_error) {
215
+ // releasePointerCapture may throw in jsdom/headless; pointer state already cleared above.
216
+ }
217
+ }
218
+ /**
219
+ * Handle Ctrl+wheel zoom. Plain wheel scrolls the body; Ctrl+wheel
220
+ * (or pinch-zoom on macOS, which surfaces as ctrlKey) zooms.
221
+ *
222
+ * @param event - The wheel event from the tracks area.
223
+ */
224
+ function onBodyWheel(event) {
225
+ if (!event.ctrlKey)
226
+ return;
227
+ if (!props.onZoomChange)
228
+ return;
229
+ event.preventDefault();
230
+ const next = zoomFromWheelDelta(safeScale(), event.deltaY, zoomMinOf(), zoomMaxOf());
231
+ if (next !== safeScale())
232
+ props.onZoomChange(next);
233
+ }
234
+ /**
235
+ * Forward a track-lane clip move to `onClipMove`, fanning out via
236
+ * `computeRippleUpdates` when in `'ripple'` mode.
237
+ *
238
+ * @param trackId - The track id forwarded as the lane id.
239
+ * @param clipId - The id of the dragged clip.
240
+ * @param proposedStartTime - The candidate new `startTime`.
241
+ */
242
+ function handleClipMove(trackId, clipId, proposedStartTime) {
243
+ if (!props.onClipMove)
244
+ return;
245
+ const track = (props.tracks ?? []).find((tr) => tr.id === trackId);
246
+ if (!track) {
247
+ props.onClipMove(clipId, proposedStartTime, trackId);
248
+ return;
249
+ }
250
+ if (modeOf() === 'insert') {
251
+ props.onClipMove(clipId, proposedStartTime, trackId);
252
+ return;
253
+ }
254
+ const updates = computeRippleUpdates(track.clips, clipId, proposedStartTime);
255
+ for (const u of updates)
256
+ props.onClipMove(u.id, u.startTime, trackId);
257
+ }
258
+ /**
259
+ * The zoom slider's `input` handler: emits the clamped value, then
260
+ * applies React's controlled-input restore (the DOM value returns to
261
+ * the prop).
262
+ *
263
+ * @param event - The native input event.
264
+ */
265
+ function handleZoomInput(event) {
266
+ const element = event.target;
267
+ props.onZoomChange?.(clampZoom(Number(element.value), zoomMinOf(), zoomMaxOf()));
268
+ element.value = String(sliderValue());
269
+ }
270
+ // React's controlled `value` on the zoom slider: the property AND the
271
+ // `value` attribute (its `defaultValue`), re-applied whenever the scale
272
+ // or the bounds change.
273
+ createEffect(() => {
274
+ const element = sliderEl;
275
+ if (!element)
276
+ return;
277
+ const text = String(sliderValue());
278
+ if (element.value !== text)
279
+ element.value = text;
280
+ if (element.defaultValue !== text)
281
+ element.defaultValue = text;
282
+ });
283
+ /** The playhead's shared inline geometry (position + fill). */
284
+ const playheadShared = {
285
+ position: 'absolute',
286
+ top: '0px',
287
+ bottom: '0px',
288
+ width: '2px',
289
+ background: 'var(--mol-video-timeline-playhead, #ff3b30)',
290
+ 'pointer-events': 'none',
291
+ };
292
+ return (<div role="group" aria-label={rootLabel()} data-mol-id="video-timeline" data-mode={modeOf()} class={cm.cn(props.className)} style={{ width: '100%', overflow: 'hidden' }}>
293
+ {/* Zoom + mode controls row */}
294
+ <div data-mol-id="video-timeline-controls" class={cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('p', 2))}>
295
+ <span data-mol-id="video-timeline-mode">
296
+ {/* A generic span may not carry aria-label; the label is visually hidden text. */}
297
+ <span class={cm.cn(cm.srOnly)}>{modeLabel()}</span>
298
+ {modeText()}
299
+ </span>
300
+ <button type="button" data-mol-id="video-timeline-zoom-out" aria-label={zoomOutLabel()} class={cm.cn(cm.cursorPointer)} onClick={() => props.onZoomChange?.(clampZoom(safeScale() / ZOOM_WHEEL_FACTOR, zoomMinOf(), zoomMaxOf()))}>
301
+ {zoomOutIcon()}
302
+ </button>
303
+ <input ref={(element) => {
304
+ sliderEl = element;
305
+ }} type="range" data-mol-id="video-timeline-zoom-slider" aria-label={zoomLabel()} min={zoomMinOf()} max={zoomMaxOf()} step={1} onInput={handleZoomInput}/>
306
+ <button type="button" data-mol-id="video-timeline-zoom-in" aria-label={zoomInLabel()} class={cm.cn(cm.cursorPointer)} onClick={() => props.onZoomChange?.(clampZoom(safeScale() * ZOOM_WHEEL_FACTOR, zoomMinOf(), zoomMaxOf()))}>
307
+ {zoomInIcon()}
308
+ </button>
309
+ </div>
310
+
311
+ {/* Ruler row */}
312
+ <div data-mol-id="video-timeline-ruler-row" style={{
313
+ display: 'flex',
314
+ 'align-items': 'stretch',
315
+ height: `${rulerHeightOf()}px`,
316
+ 'min-height': `${rulerHeightOf()}px`,
317
+ position: 'relative',
318
+ }}>
319
+ <div data-mol-id="video-timeline-ruler-header" style={{
320
+ width: `${laneHeaderWidthOf()}px`,
321
+ 'min-width': `${laneHeaderWidthOf()}px`,
322
+ 'box-sizing': 'border-box',
323
+ }}/>
324
+ <div ref={(element) => {
325
+ rulerBody = element;
326
+ }} role="slider" tabIndex={0} aria-label={rulerLabel()} aria-valuemin={0} aria-valuemax={safeDuration()} aria-valuenow={props.currentTime} aria-valuetext={playheadLabel()} data-mol-id="video-timeline-ruler" style={{
327
+ flex: '1 1 auto',
328
+ position: 'relative',
329
+ height: `${rulerHeightOf()}px`,
330
+ 'min-width': `${bodyWidth()}px`,
331
+ overflow: 'hidden',
332
+ cursor: props.onSeek ? 'pointer' : 'default',
333
+ 'touch-action': 'none',
334
+ }} onPointerDown={onRulerPointerDown} onPointerMove={onRulerPointerMove} onPointerUp={onRulerPointerUp} onPointerCancel={onRulerPointerUp}>
335
+ <For each={ticks()}>
336
+ {(tk) => (<div>
337
+ <div data-mol-id="video-timeline-tick" data-time={tk.time} style={{
338
+ position: 'absolute',
339
+ left: `${tk.pixel}px`,
340
+ top: '0px',
341
+ bottom: '0px',
342
+ width: '1px',
343
+ background: 'var(--mol-video-timeline-tick, rgba(127, 127, 127, 0.5))',
344
+ 'pointer-events': 'none',
345
+ }}/>
346
+ <span data-mol-id="video-timeline-tick-label" data-time={tk.time} style={{
347
+ position: 'absolute',
348
+ left: `${tk.pixel + 2}px`,
349
+ top: '2px',
350
+ 'font-size': '10px',
351
+ 'pointer-events': 'none',
352
+ }}>
353
+ {formatTickTime(tk.time)}
354
+ </span>
355
+ </div>)}
356
+ </For>
357
+ <div data-mol-id="video-timeline-playhead-ruler" aria-hidden="true" style={{ ...playheadShared, left: `${playheadPx()}px` }}/>
358
+ </div>
359
+ </div>
360
+
361
+ {/* Tracks (scrollable) */}
362
+ <div data-mol-id="video-timeline-tracks" style={{
363
+ position: 'relative',
364
+ 'overflow-x': 'auto',
365
+ 'overflow-y': 'auto',
366
+ width: '100%',
367
+ }} onWheel={onBodyWheel}>
368
+ <div style={{ position: 'relative', 'min-width': `${bodyWidth() + laneHeaderWidthOf()}px` }}>
369
+ <For each={keyedTracks()}>
370
+ {(row) => (<Show when={trackFor(row.id)}>
371
+ {(track) => (<div data-mol-id="video-timeline-track" data-track-id={track().id} data-track-kind={track().kind}>
372
+ <TrackLane name={laneName(track())} clips={track().clips} pixelsPerSecond={safeScale()} height={trackHeightOf()} lane={track().id} selectedClipId={props.selectedClipId} onClipMove={(clipId, startTime) => handleClipMove(track().id, clipId, startTime)} onClipResize={(clipId, dur) => props.onClipResize?.(clipId, dur, track().id)} onClipClick={(clipId) => props.onClipClick?.(clipId, track().id)}/>
373
+ </div>)}
374
+ </Show>)}
375
+ </For>
376
+ <div data-mol-id="video-timeline-playhead" aria-hidden="true" style={{
377
+ ...playheadShared,
378
+ left: `${playheadPx() + laneHeaderWidthOf()}px`,
379
+ 'z-index': '2',
380
+ }}/>
381
+ </div>
382
+ </div>
383
+ </div>);
384
+ };
385
+ //# sourceMappingURL=VideoTimeline.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoTimeline.jsx","sourceRoot":"","sources":["../src/VideoTimeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAkB,YAAY,EAAE,UAAU,EAAE,GAAG,EAAY,IAAI,EAAE,MAAM,UAAU,CAAA;AAExF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAC9F,OA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EAAE,CAAC,CAC7B,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC,CACxB,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CACjB,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CACrC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAChC,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAC9C,CAAC,CACD,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAC7E,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAErE;kBAAA,EAAE,GAAG,CAAC,CACP,CACH;cAAA,EAAE,IAAI,CAAC,CACR,CACH;UAAA,EAAE,GAAG,CACL;UAAA,CAAC,GAAG,CACF,WAAW,CAAC,yBAAyB,CACrC,WAAW,CAAC,MAAM,CAClB,KAAK,CAAC,CAAC;YACL,GAAG,cAAc;YACjB,IAAI,EAAE,GAAG,UAAU,EAAE,GAAG,iBAAiB,EAAE,IAAI;YAC/C,SAAS,EAAE,GAAG;SACf,CAAC,EAEN;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Solid multi-track video timeline for video editors, DAWs and animation
3
+ * tools. Composes one `<TrackLane>` per track row with a shared time ruler,
4
+ * playhead, zoom slider + Ctrl+wheel zoom, and ripple/insert edit modes.
5
+ *
6
+ * Solid counterpart of `@molecule/app-feature-video-timeline-react`: the same
7
+ * props (React names), the same DOM for the same input, and the same callback
8
+ * calls, so an app switches framework by changing only the package name it
9
+ * imports.
10
+ *
11
+ * Exports `<VideoTimeline>`, the `Track` and `VideoTimelineMode` types,
12
+ * and the pure-function helpers `clampZoom`, `zoomFromWheelDelta`,
13
+ * `computeRulerTicks`, `computeRippleUpdates`, and `formatTickTime`
14
+ * that back the zoom math, ruler tick generation, and ripple-mode
15
+ * fan-out.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { createSignal } from 'solid-js'
20
+ * import { VideoTimeline } from '@molecule/app-feature-video-timeline-solid'
21
+ *
22
+ * export function Editor() {
23
+ * const [currentTime, setCurrentTime] = createSignal(3.2)
24
+ * const [zoom, setZoom] = createSignal(20)
25
+ * return (
26
+ * <VideoTimeline
27
+ * tracks={[
28
+ * {
29
+ * id: 'v1',
30
+ * kind: 'video',
31
+ * clips: [{ id: 'a', startTime: 0, duration: 5, label: 'Intro' }],
32
+ * },
33
+ * {
34
+ * id: 'a1',
35
+ * kind: 'audio',
36
+ * clips: [{ id: 'b', startTime: 0, duration: 12 }],
37
+ * },
38
+ * ]}
39
+ * currentTime={currentTime()}
40
+ * duration={60}
41
+ * pixelsPerSecond={zoom()}
42
+ * mode="ripple"
43
+ * onSeek={(t) => setCurrentTime(t)}
44
+ * onClipMove={(id, startTime, trackId) => updateClip(trackId, id, { startTime })}
45
+ * onClipResize={(id, duration, trackId) => updateClip(trackId, id, { duration })}
46
+ * onZoomChange={(pps) => setZoom(pps)}
47
+ * />
48
+ * )
49
+ * }
50
+ * ```
51
+ *
52
+ * @remarks
53
+ * - Requires a bonded ClassMap (`cm.flex`, `cm.cn`, …) and the binding's i18n
54
+ * provider for the translated labels — rendering throws without a ClassMap.
55
+ * - Ripple mode (default) shifts all later clips on the same lane by the same
56
+ * delta when a clip is dragged, preserving inter-clip gaps. Switch to
57
+ * `mode="insert"` to drop the dragged clip at its new position without
58
+ * disturbing the rest of the lane.
59
+ * - Every visible string comes from `useTranslation()` (`videoTimeline.aria.*`,
60
+ * `videoTimeline.trackKind.*`, `videoTimeline.mode.*`, `videoTimeline.zoom.*`),
61
+ * so a locale switch re-renders the timeline.
62
+ *
63
+ * @module
64
+ */
65
+ export * from './timeline.js';
66
+ export * from './types.js';
67
+ export * from './VideoTimeline.jsx';
68
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Solid multi-track video timeline for video editors, DAWs and animation
3
+ * tools. Composes one `<TrackLane>` per track row with a shared time ruler,
4
+ * playhead, zoom slider + Ctrl+wheel zoom, and ripple/insert edit modes.
5
+ *
6
+ * Solid counterpart of `@molecule/app-feature-video-timeline-react`: the same
7
+ * props (React names), the same DOM for the same input, and the same callback
8
+ * calls, so an app switches framework by changing only the package name it
9
+ * imports.
10
+ *
11
+ * Exports `<VideoTimeline>`, the `Track` and `VideoTimelineMode` types,
12
+ * and the pure-function helpers `clampZoom`, `zoomFromWheelDelta`,
13
+ * `computeRulerTicks`, `computeRippleUpdates`, and `formatTickTime`
14
+ * that back the zoom math, ruler tick generation, and ripple-mode
15
+ * fan-out.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { createSignal } from 'solid-js'
20
+ * import { VideoTimeline } from '@molecule/app-feature-video-timeline-solid'
21
+ *
22
+ * export function Editor() {
23
+ * const [currentTime, setCurrentTime] = createSignal(3.2)
24
+ * const [zoom, setZoom] = createSignal(20)
25
+ * return (
26
+ * <VideoTimeline
27
+ * tracks={[
28
+ * {
29
+ * id: 'v1',
30
+ * kind: 'video',
31
+ * clips: [{ id: 'a', startTime: 0, duration: 5, label: 'Intro' }],
32
+ * },
33
+ * {
34
+ * id: 'a1',
35
+ * kind: 'audio',
36
+ * clips: [{ id: 'b', startTime: 0, duration: 12 }],
37
+ * },
38
+ * ]}
39
+ * currentTime={currentTime()}
40
+ * duration={60}
41
+ * pixelsPerSecond={zoom()}
42
+ * mode="ripple"
43
+ * onSeek={(t) => setCurrentTime(t)}
44
+ * onClipMove={(id, startTime, trackId) => updateClip(trackId, id, { startTime })}
45
+ * onClipResize={(id, duration, trackId) => updateClip(trackId, id, { duration })}
46
+ * onZoomChange={(pps) => setZoom(pps)}
47
+ * />
48
+ * )
49
+ * }
50
+ * ```
51
+ *
52
+ * @remarks
53
+ * - Requires a bonded ClassMap (`cm.flex`, `cm.cn`, …) and the binding's i18n
54
+ * provider for the translated labels — rendering throws without a ClassMap.
55
+ * - Ripple mode (default) shifts all later clips on the same lane by the same
56
+ * delta when a clip is dragged, preserving inter-clip gaps. Switch to
57
+ * `mode="insert"` to drop the dragged clip at its new position without
58
+ * disturbing the rest of the lane.
59
+ * - Every visible string comes from `useTranslation()` (`videoTimeline.aria.*`,
60
+ * `videoTimeline.trackKind.*`, `videoTimeline.mode.*`, `videoTimeline.zoom.*`),
61
+ * so a locale switch re-renders the timeline.
62
+ *
63
+ * @module
64
+ */
65
+ export * from './timeline.js';
66
+ export * from './types.js';
67
+ export * from './VideoTimeline.jsx';
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Pure helpers of the video timeline: the same constants and the same math
3
+ * `@molecule/app-feature-video-timeline-react` exports — the zoom clamping,
4
+ * the Ctrl+wheel zoom step, the ruler tick generation, the ripple-mode
5
+ * fan-out and the tick time formatting.
6
+ *
7
+ * @module
8
+ */
9
+ import type { Clip } from '@molecule/app-feature-track-lane-solid';
10
+ /** Default horizontal scale. */
11
+ export declare const DEFAULT_PIXELS_PER_SECOND = 20;
12
+ /** Default lower zoom bound. */
13
+ export declare const DEFAULT_ZOOM_MIN = 2;
14
+ /** Default upper zoom bound. */
15
+ export declare const DEFAULT_ZOOM_MAX = 200;
16
+ /** Default per-track row height. */
17
+ export declare const DEFAULT_TRACK_HEIGHT = 44;
18
+ /** Default lane-header column width. */
19
+ export declare const DEFAULT_LANE_HEADER_WIDTH = 120;
20
+ /** Default ruler height. */
21
+ export declare const DEFAULT_RULER_HEIGHT = 28;
22
+ /** Multiplier per Ctrl+wheel notch (positive deltaY zooms out). */
23
+ export declare const ZOOM_WHEEL_FACTOR = 1.1;
24
+ /** Minimum spacing (px) between adjacent ruler ticks. */
25
+ export declare const MIN_TICK_PIXEL_SPACING = 60;
26
+ /**
27
+ * Clamp a candidate `pixelsPerSecond` value into `[min, max]`. Used by
28
+ * the zoom slider, Ctrl+wheel, and any external zoom button that calls
29
+ * `onZoomChange`.
30
+ *
31
+ * @param value - Candidate horizontal scale in px/sec.
32
+ * @param min - Lower bound (inclusive).
33
+ * @param max - Upper bound (inclusive).
34
+ * @returns The clamped value.
35
+ */
36
+ export declare function clampZoom(value: number, min: number, max: number): number;
37
+ /**
38
+ * Compute the next zoom value for a Ctrl+wheel notch. Negative `deltaY`
39
+ * (scroll-up) zooms in; positive zooms out. Result is clamped into
40
+ * `[min, max]`.
41
+ *
42
+ * @param current - Current `pixelsPerSecond`.
43
+ * @param deltaY - Wheel `deltaY` (sign-only — magnitude is ignored).
44
+ * @param min - Lower zoom bound.
45
+ * @param max - Upper zoom bound.
46
+ * @returns The clamped next zoom value.
47
+ */
48
+ export declare function zoomFromWheelDelta(current: number, deltaY: number, min: number, max: number): number;
49
+ /**
50
+ * Compute time tick marks for the ruler. Picks an interval (1, 2, 5, 10,
51
+ * 30, or 60 seconds, etc.) so that adjacent ticks are at least
52
+ * `MIN_TICK_PIXEL_SPACING` apart on screen. Always emits a tick at 0 and
53
+ * stops at the last tick `<= duration`.
54
+ *
55
+ * @param duration - Total duration in seconds.
56
+ * @param pixelsPerSecond - Horizontal scale.
57
+ * @returns Tick descriptors with `{ time, pixel }`.
58
+ */
59
+ export declare function computeRulerTicks(duration: number, pixelsPerSecond: number): {
60
+ time: number;
61
+ pixel: number;
62
+ }[];
63
+ /**
64
+ * Compute the ripple-mode update for a clip drag on a single lane.
65
+ * Returns one update per affected clip — at minimum the dragged clip,
66
+ * plus every clip whose original `startTime` is strictly greater (which
67
+ * shifts by the same `delta`).
68
+ *
69
+ * Negative deltas are clamped so no clip's `startTime` goes below 0
70
+ * (the dragged clip is the limiting factor — later clips can never
71
+ * cross zero before it does, since they all started later).
72
+ *
73
+ * @param clips - All clips on the lane (any order).
74
+ * @param draggedClipId - The id of the clip being dragged.
75
+ * @param proposedStartTime - The candidate new `startTime` for the dragged clip.
76
+ * @returns Array of `{ id, startTime }` updates to apply.
77
+ */
78
+ export declare function computeRippleUpdates(clips: Clip[], draggedClipId: string, proposedStartTime: number): {
79
+ id: string;
80
+ startTime: number;
81
+ }[];
82
+ /**
83
+ * Format a tick time for the ruler — `mm:ss` over a minute, `s.s` below.
84
+ *
85
+ * @param seconds - Time in seconds.
86
+ * @returns Formatted string for the tick label.
87
+ */
88
+ export declare function formatTickTime(seconds: number): string;
89
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAA;AAElE,gCAAgC;AAChC,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,MAAM,CAAA;AAEnC,oCAAoC;AACpC,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC,wCAAwC;AACxC,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C,4BAA4B;AAC5B,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,CAIR;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAwBnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,IAAI,EAAE,EACb,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,GACxB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,CAiBrC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOtD"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Pure helpers of the video timeline: the same constants and the same math
3
+ * `@molecule/app-feature-video-timeline-react` exports — the zoom clamping,
4
+ * the Ctrl+wheel zoom step, the ruler tick generation, the ripple-mode
5
+ * fan-out and the tick time formatting.
6
+ *
7
+ * @module
8
+ */
9
+ /** Default horizontal scale. */
10
+ export const DEFAULT_PIXELS_PER_SECOND = 20;
11
+ /** Default lower zoom bound. */
12
+ export const DEFAULT_ZOOM_MIN = 2;
13
+ /** Default upper zoom bound. */
14
+ export const DEFAULT_ZOOM_MAX = 200;
15
+ /** Default per-track row height. */
16
+ export const DEFAULT_TRACK_HEIGHT = 44;
17
+ /** Default lane-header column width. */
18
+ export const DEFAULT_LANE_HEADER_WIDTH = 120;
19
+ /** Default ruler height. */
20
+ export const DEFAULT_RULER_HEIGHT = 28;
21
+ /** Multiplier per Ctrl+wheel notch (positive deltaY zooms out). */
22
+ export const ZOOM_WHEEL_FACTOR = 1.1;
23
+ /** Minimum spacing (px) between adjacent ruler ticks. */
24
+ export const MIN_TICK_PIXEL_SPACING = 60;
25
+ /**
26
+ * Clamp a candidate `pixelsPerSecond` value into `[min, max]`. Used by
27
+ * the zoom slider, Ctrl+wheel, and any external zoom button that calls
28
+ * `onZoomChange`.
29
+ *
30
+ * @param value - Candidate horizontal scale in px/sec.
31
+ * @param min - Lower bound (inclusive).
32
+ * @param max - Upper bound (inclusive).
33
+ * @returns The clamped value.
34
+ */
35
+ export function clampZoom(value, min, max) {
36
+ if (!Number.isFinite(value))
37
+ return min;
38
+ if (value < min)
39
+ return min;
40
+ if (value > max)
41
+ return max;
42
+ return value;
43
+ }
44
+ /**
45
+ * Compute the next zoom value for a Ctrl+wheel notch. Negative `deltaY`
46
+ * (scroll-up) zooms in; positive zooms out. Result is clamped into
47
+ * `[min, max]`.
48
+ *
49
+ * @param current - Current `pixelsPerSecond`.
50
+ * @param deltaY - Wheel `deltaY` (sign-only — magnitude is ignored).
51
+ * @param min - Lower zoom bound.
52
+ * @param max - Upper zoom bound.
53
+ * @returns The clamped next zoom value.
54
+ */
55
+ export function zoomFromWheelDelta(current, deltaY, min, max) {
56
+ if (deltaY === 0)
57
+ return clampZoom(current, min, max);
58
+ const factor = deltaY < 0 ? ZOOM_WHEEL_FACTOR : 1 / ZOOM_WHEEL_FACTOR;
59
+ return clampZoom(current * factor, min, max);
60
+ }
61
+ /**
62
+ * Compute time tick marks for the ruler. Picks an interval (1, 2, 5, 10,
63
+ * 30, or 60 seconds, etc.) so that adjacent ticks are at least
64
+ * `MIN_TICK_PIXEL_SPACING` apart on screen. Always emits a tick at 0 and
65
+ * stops at the last tick `<= duration`.
66
+ *
67
+ * @param duration - Total duration in seconds.
68
+ * @param pixelsPerSecond - Horizontal scale.
69
+ * @returns Tick descriptors with `{ time, pixel }`.
70
+ */
71
+ export function computeRulerTicks(duration, pixelsPerSecond) {
72
+ if (duration <= 0 || pixelsPerSecond <= 0)
73
+ return [{ time: 0, pixel: 0 }];
74
+ const targetPx = MIN_TICK_PIXEL_SPACING;
75
+ const minSecondsBetween = targetPx / pixelsPerSecond;
76
+ // 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 1800, 3600
77
+ const candidates = [0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 1800, 3600];
78
+ let interval = candidates[candidates.length - 1];
79
+ for (const c of candidates) {
80
+ if (c >= minSecondsBetween) {
81
+ interval = c;
82
+ break;
83
+ }
84
+ }
85
+ const ticks = [];
86
+ // Use integer step counter to avoid floating-point drift.
87
+ let step = 0;
88
+ while (true) {
89
+ const time = step * interval;
90
+ if (time > duration + 1e-9)
91
+ break;
92
+ ticks.push({ time, pixel: time * pixelsPerSecond });
93
+ step += 1;
94
+ if (step > 10000)
95
+ break; // hard safety cap
96
+ }
97
+ return ticks;
98
+ }
99
+ /**
100
+ * Compute the ripple-mode update for a clip drag on a single lane.
101
+ * Returns one update per affected clip — at minimum the dragged clip,
102
+ * plus every clip whose original `startTime` is strictly greater (which
103
+ * shifts by the same `delta`).
104
+ *
105
+ * Negative deltas are clamped so no clip's `startTime` goes below 0
106
+ * (the dragged clip is the limiting factor — later clips can never
107
+ * cross zero before it does, since they all started later).
108
+ *
109
+ * @param clips - All clips on the lane (any order).
110
+ * @param draggedClipId - The id of the clip being dragged.
111
+ * @param proposedStartTime - The candidate new `startTime` for the dragged clip.
112
+ * @returns Array of `{ id, startTime }` updates to apply.
113
+ */
114
+ export function computeRippleUpdates(clips, draggedClipId, proposedStartTime) {
115
+ const dragged = clips.find((c) => c.id === draggedClipId);
116
+ if (!dragged)
117
+ return [];
118
+ const clamped = proposedStartTime < 0 ? 0 : proposedStartTime;
119
+ const delta = clamped - dragged.startTime;
120
+ if (delta === 0) {
121
+ return [{ id: dragged.id, startTime: clamped }];
122
+ }
123
+ const updates = [{ id: dragged.id, startTime: clamped }];
124
+ for (const c of clips) {
125
+ if (c.id === dragged.id)
126
+ continue;
127
+ if (c.startTime > dragged.startTime) {
128
+ const next = c.startTime + delta;
129
+ updates.push({ id: c.id, startTime: next < 0 ? 0 : next });
130
+ }
131
+ }
132
+ return updates;
133
+ }
134
+ /**
135
+ * Format a tick time for the ruler — `mm:ss` over a minute, `s.s` below.
136
+ *
137
+ * @param seconds - Time in seconds.
138
+ * @returns Formatted string for the tick label.
139
+ */
140
+ export function formatTickTime(seconds) {
141
+ if (seconds < 60) {
142
+ return seconds === Math.floor(seconds) ? `${seconds}s` : `${seconds.toFixed(1)}s`;
143
+ }
144
+ const m = Math.floor(seconds / 60);
145
+ const s = Math.floor(seconds - m * 60);
146
+ return `${m}:${s.toString().padStart(2, '0')}`;
147
+ }
148
+ //# sourceMappingURL=timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,gCAAgC;AAChC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AAE3C,gCAAgC;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAEjC,gCAAgC;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAEnC,oCAAoC;AACpC,MAAM,CAAC,MAAM,oBAAoB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AAE,CAAC,CAAA;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;AAChD,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Types of the Solid video timeline — the same props (React names) and the
3
+ * same DOM for the same input as
4
+ * `@molecule/app-feature-video-timeline-react`.
5
+ *
6
+ * @module
7
+ */
8
+ import type { Clip } from '@molecule/app-feature-track-lane-solid';
9
+ /**
10
+ * The kind of media a track holds. Drives the lane name fallback,
11
+ * the default clip color, and the data attribute parents can hook
12
+ * onto for kind-specific styling.
13
+ */
14
+ export type TrackKind = 'video' | 'audio' | 'subtitle';
15
+ /**
16
+ * One track row on a `<VideoTimeline>`. Tracks are rendered in array
17
+ * order top-to-bottom and each track delegates clip rendering to a
18
+ * `<TrackLane>` row.
19
+ */
20
+ export interface Track {
21
+ /** Stable identifier — used as the row key and lane id passed to handlers. */
22
+ id: string;
23
+ /** The kind of media on this track. */
24
+ kind: TrackKind;
25
+ /** Clips on this track. Order is preserved as-is. */
26
+ clips: Clip[];
27
+ /** Optional human-friendly track name; falls back to a translated kind label. */
28
+ name?: string;
29
+ }
30
+ /**
31
+ * Edit mode applied to clip drags.
32
+ *
33
+ * - `insert` — dragging a clip just drops it at the new position; other clips
34
+ * on the lane stay where they are.
35
+ * - `ripple` — dragging a clip shifts every later clip on the same lane by
36
+ * the same delta, preserving inter-clip gaps.
37
+ */
38
+ export type VideoTimelineMode = 'ripple' | 'insert';
39
+ /** Props accepted by the {@link VideoTimeline} component — the same props React's accepts. */
40
+ export interface VideoTimelineProps {
41
+ /** Tracks to render. Order is preserved as-is. */
42
+ tracks: Track[];
43
+ /** Current playhead time in seconds. Drives the playhead vertical line. */
44
+ currentTime: number;
45
+ /** Total timeline duration in seconds — used to size the scrollable body. */
46
+ duration: number;
47
+ /** Called when the user clicks/scrubs the ruler. */
48
+ onSeek?: (time: number) => void;
49
+ /** Called when a clip on a lane is dragged horizontally. */
50
+ onClipMove?: (clipId: string, startTime: number, trackId: string) => void;
51
+ /** Called when a clip's right-edge resize handle is dragged. */
52
+ onClipResize?: (clipId: string, duration: number, trackId: string) => void;
53
+ /** Horizontal scale (px per second). Defaults to 20. */
54
+ pixelsPerSecond?: number;
55
+ /** Lower zoom bound for Ctrl+wheel / slider. Defaults to 2. */
56
+ zoomMin?: number;
57
+ /** Upper zoom bound for Ctrl+wheel / slider. Defaults to 200. */
58
+ zoomMax?: number;
59
+ /** Edit mode for clip drags. Defaults to `'ripple'`. */
60
+ mode?: VideoTimelineMode;
61
+ /** Called when the user changes the zoom (slider or Ctrl+wheel). */
62
+ onZoomChange?: (pixelsPerSecond: number) => void;
63
+ /** Optional currently-selected clip id. */
64
+ selectedClipId?: string;
65
+ /** Called when a clip is clicked (no drag). */
66
+ onClipClick?: (clipId: string, trackId: string) => void;
67
+ /** Per-track row height in pixels. Defaults to 44. */
68
+ trackHeight?: number;
69
+ /** Width of the leading lane-header column in pixels. Defaults to 120. */
70
+ laneHeaderWidth?: number;
71
+ /** Height of the time ruler row in pixels. Defaults to 28. */
72
+ rulerHeight?: number;
73
+ /** Extra classes merged onto the root element. */
74
+ className?: string;
75
+ }
76
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAA;AAElE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAA;AAEtD;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAA;IACV,uCAAuC;IACvC,IAAI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0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Types of the Solid video timeline — the same props (React names) and the
3
+ * same DOM for the same input as
4
+ * `@molecule/app-feature-video-timeline-react`.
5
+ *
6
+ * @module
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@molecule/app-feature-video-timeline-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Multi-track video timeline composing track-lane rows with a time ruler, playhead, zoom controls, and ripple/insert edit modes",
5
+ "homepage": "https://www.molecule.dev/packages/app-feature-video-timeline-solid",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "feature",
28
+ "video-timeline",
29
+ "timeline",
30
+ "video-editor",
31
+ "multi-track",
32
+ "ripple",
33
+ "playhead",
34
+ "solid"
35
+ ],
36
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
37
+ "license": "Apache-2.0",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/molecule-dev/molecule.git",
41
+ "directory": "packages/app/features/feature-video-timeline-solid"
42
+ },
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "peerDependencies": {
51
+ "@molecule/app-feature-track-lane-solid": "^1.0.0",
52
+ "@molecule/app-solid": "^3.5.0",
53
+ "@molecule/app-ui": "^1.0.1",
54
+ "@molecule/app-ui-solid": "^1.1.0",
55
+ "solid-js": "^1.8.0"
56
+ },
57
+ "devDependencies": {
58
+ "@molecule/app-feature-track-lane-solid": "1.1.0",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-solid": "3.7.2",
63
+ "@molecule/app-ui": "1.4.0",
64
+ "@molecule/app-ui-solid": "1.1.5",
65
+ "@types/node": "26.6.5",
66
+ "jsdom": "30.1.3",
67
+ "solid-js": "1.9.17",
68
+ "typescript": "6.0.3",
69
+ "vite-plugin-solid": "2.11.15",
70
+ "vitest": "4.1.12"
71
+ }
72
+ }