@twick/timeline 0.14.2 → 0.14.3
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/README.md +86 -0
- package/dist/context/timeline-context.d.ts +103 -0
- package/dist/core/track/track.d.ts +323 -18
- package/dist/core/visitor/element-adder.d.ts +122 -2
- package/dist/index.js +441 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +441 -18
- package/dist/index.mjs.map +1 -1
- package/dist/utils/constants.d.ts +172 -35
- package/dist/utils/timeline.utils.d.ts +112 -0
- package/package.json +4 -4
|
@@ -10,20 +10,140 @@ import { RectElement } from '../elements/rect.element';
|
|
|
10
10
|
import { Track } from '../track/track';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* ElementAdder visitor for adding elements to tracks
|
|
13
|
+
* ElementAdder visitor for adding elements to tracks.
|
|
14
14
|
* Uses the visitor pattern to handle different element types
|
|
15
|
-
*
|
|
15
|
+
* and implements the Friend Class Pattern for explicit access control.
|
|
16
|
+
* Automatically calculates start and end times for elements based on
|
|
17
|
+
* existing track content.
|
|
16
18
|
*/
|
|
17
19
|
export declare class ElementAdder implements ElementVisitor<Promise<boolean>> {
|
|
18
20
|
private track;
|
|
19
21
|
private trackFriend;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new ElementAdder instance for the specified track.
|
|
24
|
+
*
|
|
25
|
+
* @param track - The track to add elements to
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```js
|
|
29
|
+
* const adder = new ElementAdder(track);
|
|
30
|
+
* const success = await adder.visitVideoElement(videoElement);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
20
33
|
constructor(track: Track);
|
|
34
|
+
/**
|
|
35
|
+
* Adds a video element to the track.
|
|
36
|
+
* Updates video metadata and calculates appropriate start/end times
|
|
37
|
+
* based on existing track elements.
|
|
38
|
+
*
|
|
39
|
+
* @param element - The video element to add
|
|
40
|
+
* @returns Promise resolving to true if element was added successfully
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```js
|
|
44
|
+
* const success = await adder.visitVideoElement(videoElement);
|
|
45
|
+
* // success = true if element was added successfully
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
21
48
|
visitVideoElement(element: VideoElement): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Adds an audio element to the track.
|
|
51
|
+
* Updates audio metadata and calculates appropriate start/end times
|
|
52
|
+
* based on existing track elements.
|
|
53
|
+
*
|
|
54
|
+
* @param element - The audio element to add
|
|
55
|
+
* @returns Promise resolving to true if element was added successfully
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```js
|
|
59
|
+
* const success = await adder.visitAudioElement(audioElement);
|
|
60
|
+
* // success = true if element was added successfully
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
22
63
|
visitAudioElement(element: AudioElement): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Adds an image element to the track.
|
|
66
|
+
* Updates image metadata and calculates appropriate start/end times
|
|
67
|
+
* based on existing track elements.
|
|
68
|
+
*
|
|
69
|
+
* @param element - The image element to add
|
|
70
|
+
* @returns Promise resolving to true if element was added successfully
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```js
|
|
74
|
+
* const success = await adder.visitImageElement(imageElement);
|
|
75
|
+
* // success = true if element was added successfully
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
23
78
|
visitImageElement(element: ImageElement): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Adds a text element to the track.
|
|
81
|
+
* Calculates appropriate start/end times based on existing track elements.
|
|
82
|
+
*
|
|
83
|
+
* @param element - The text element to add
|
|
84
|
+
* @returns Promise resolving to true if element was added successfully
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```js
|
|
88
|
+
* const success = await adder.visitTextElement(textElement);
|
|
89
|
+
* // success = true if element was added successfully
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
24
92
|
visitTextElement(element: TextElement): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Adds a caption element to the track.
|
|
95
|
+
* Calculates appropriate start/end times based on existing track elements.
|
|
96
|
+
*
|
|
97
|
+
* @param element - The caption element to add
|
|
98
|
+
* @returns Promise resolving to true if element was added successfully
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```js
|
|
102
|
+
* const success = await adder.visitCaptionElement(captionElement);
|
|
103
|
+
* // success = true if element was added successfully
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
25
106
|
visitCaptionElement(element: CaptionElement): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Adds an icon element to the track.
|
|
109
|
+
* Calculates appropriate start/end times based on existing track elements.
|
|
110
|
+
*
|
|
111
|
+
* @param element - The icon element to add
|
|
112
|
+
* @returns Promise resolving to true if element was added successfully
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```js
|
|
116
|
+
* const success = await adder.visitIconElement(iconElement);
|
|
117
|
+
* // success = true if element was added successfully
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
26
120
|
visitIconElement(element: IconElement): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Adds a circle element to the track.
|
|
123
|
+
* Calculates appropriate start/end times based on existing track elements.
|
|
124
|
+
*
|
|
125
|
+
* @param element - The circle element to add
|
|
126
|
+
* @returns Promise resolving to true if element was added successfully
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```js
|
|
130
|
+
* const success = await adder.visitCircleElement(circleElement);
|
|
131
|
+
* // success = true if element was added successfully
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
27
134
|
visitCircleElement(element: CircleElement): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Adds a rectangle element to the track.
|
|
137
|
+
* Calculates appropriate start/end times based on existing track elements.
|
|
138
|
+
*
|
|
139
|
+
* @param element - The rectangle element to add
|
|
140
|
+
* @returns Promise resolving to true if element was added successfully
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```js
|
|
144
|
+
* const success = await adder.visitRectElement(rectElement);
|
|
145
|
+
* // success = true if element was added successfully
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
28
148
|
visitRectElement(element: RectElement): Promise<boolean>;
|
|
29
149
|
}
|