@cyca/react-timeline-editor 0.2.4-alpha.5 → 0.2.5-alpha.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.
package/dist/index.d.ts DELETED
@@ -1,338 +0,0 @@
1
- import { default as default_2 } from 'react';
2
- import { JSX } from 'react/jsx-runtime';
3
- import * as React_2 from 'react';
4
-
5
- export declare interface EditData {
6
- /**
7
- * @description Timeline editing data
8
- */
9
- editorData: TimelineRow[];
10
- /**
11
- * @description Timeline action effects map
12
- */
13
- effects: Record<string, TimelineEffect>;
14
- /**
15
- * @description Single scale mark range (>0)
16
- * @default 1
17
- */
18
- scale?: number;
19
- /**
20
- * @description Minimum number of scales (>=1)
21
- * @default 20
22
- */
23
- minScaleCount?: number;
24
- /**
25
- * @description Maximum number of scales (>=minScaleCount)
26
- * @default Infinity
27
- */
28
- maxScaleCount?: number;
29
- /**
30
- * @description Number of subdivision units per scale (>0 integer)
31
- * @default 10
32
- */
33
- scaleSplitCount?: number;
34
- /**
35
- * @description Display width of a single scale (>0, unit: px)
36
- * @default 160
37
- */
38
- scaleWidth?: number;
39
- /**
40
- * @description Distance from the left where the scale starts (>=0, unit: px)
41
- * @default 20
42
- */
43
- startLeft?: number;
44
- /**
45
- * @description Default height of each editing row (>0, unit: px)
46
- * @default 32
47
- */
48
- rowHeight?: number;
49
- /**
50
- * @description Whether to enable grid snap
51
- * @default false
52
- */
53
- gridSnap?: boolean;
54
- /**
55
- * @description Enable snap
56
- * @default false
57
- */
58
- snap?: boolean;
59
- /**
60
- * @description Enable cursor snap to action endpoints when dragging
61
- * @default false
62
- */
63
- cursorSnap?: boolean;
64
- /**
65
- * @description Whether to hide cursor
66
- * @default false
67
- */
68
- hideCursor?: boolean;
69
- /**
70
- * @description Disable dragging in all action areas
71
- * @default false
72
- */
73
- disableDrag?: boolean;
74
- /**
75
- * @description Custom action area rendering
76
- */
77
- getActionRender?: (action: TimelineAction, row: TimelineRow) => React_2.ReactNode;
78
- /**
79
- * @description Custom scale rendering
80
- */
81
- getScaleRender?: (scale: number) => React_2.ReactNode;
82
- /**
83
- * @description Start move callback
84
- */
85
- onActionMoveStart?: (params: {
86
- action: TimelineAction;
87
- row: TimelineRow;
88
- }) => void;
89
- /**
90
- * @description Move callback (return false to prevent movement)
91
- */
92
- onActionMoving?: (params: {
93
- action: TimelineAction;
94
- row: TimelineRow;
95
- start: number;
96
- end: number;
97
- }) => void | boolean;
98
- /**
99
- * @description Move end callback (return false to prevent onChange trigger)
100
- */
101
- onActionMoveEnd?: (params: {
102
- action: TimelineAction;
103
- row: TimelineRow;
104
- start: number;
105
- end: number;
106
- }) => void;
107
- /**
108
- * @description Start resize callback
109
- */
110
- onActionResizeStart?: (params: {
111
- action: TimelineAction;
112
- row: TimelineRow;
113
- dir: "right" | "left";
114
- }) => void;
115
- /**
116
- * @description Resize callback (return false to prevent resize)
117
- */
118
- onActionResizing?: (params: {
119
- action: TimelineAction;
120
- row: TimelineRow;
121
- start: number;
122
- end: number;
123
- dir: "right" | "left";
124
- }) => void | boolean;
125
- /**
126
- * @description Resize end callback (return false to prevent onChange trigger)
127
- */
128
- onActionResizeEnd?: (params: {
129
- action: TimelineAction;
130
- row: TimelineRow;
131
- start: number;
132
- end: number;
133
- dir: "right" | "left";
134
- }) => void;
135
- /**
136
- * @description Click row callback
137
- */
138
- onClickRow?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
139
- row: TimelineRow;
140
- time: number;
141
- }) => void;
142
- /**
143
- * @description Click action callback
144
- */
145
- onClickAction?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
146
- action: TimelineAction;
147
- row: TimelineRow;
148
- time: number;
149
- }) => void;
150
- /**
151
- * @description Click action callback (not executed when drag is triggered)
152
- */
153
- onClickActionOnly?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
154
- action: TimelineAction;
155
- row: TimelineRow;
156
- time: number;
157
- }) => void;
158
- /**
159
- * @description Double click row callback
160
- */
161
- onDoubleClickRow?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
162
- row: TimelineRow;
163
- time: number;
164
- }) => void;
165
- /**
166
- * @description Double click action callback
167
- */
168
- onDoubleClickAction?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
169
- action: TimelineAction;
170
- row: TimelineRow;
171
- time: number;
172
- }) => void;
173
- /**
174
- * @description Right click row callback
175
- */
176
- onContextMenuRow?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
177
- row: TimelineRow;
178
- time: number;
179
- }) => void;
180
- /**
181
- * @description Right click action callback
182
- */
183
- onContextMenuAction?: (e: React_2.MouseEvent<HTMLElement, MouseEvent>, param: {
184
- action: TimelineAction;
185
- row: TimelineRow;
186
- time: number;
187
- }) => void;
188
- /**
189
- * @description Get the list of action ids to show assist drag lines, calculated at move/resize start, defaults to all actions except the currently moving action
190
- */
191
- getAssistDragLineActionIds?: (params: {
192
- action: TimelineAction;
193
- editorData: TimelineRow[];
194
- row: TimelineRow;
195
- }) => string[];
196
- /**
197
- * @description Cursor drag start event
198
- */
199
- onCursorDragStart?: (time: number) => void;
200
- /**
201
- * @description Cursor drag end event
202
- */
203
- onCursorDragEnd?: (time: number) => void;
204
- /**
205
- * @description Cursor drag event
206
- */
207
- onCursorDrag?: (time: number) => void;
208
- /**
209
- * @description Click time area event, return false to prevent setting time
210
- */
211
- onClickTimeArea?: (time: number, e: React_2.MouseEvent<HTMLDivElement, MouseEvent>) => boolean | undefined;
212
- /**
213
- * @description Virtualization overscan count (unstable API, may change or be removed)
214
- * @default 5
215
- */
216
- unstable_rowActionsOverscan?: number;
217
- }
218
-
219
- declare type ScrollToTimeBlock = "start" | "center" | "end";
220
-
221
- declare interface ScrollToTimeOptions {
222
- block?: ScrollToTimeBlock;
223
- offset?: number;
224
- /**
225
- * @description Only scroll if the time is not currently visible in the viewport
226
- * @default false
227
- */
228
- onlyIfNotVisible?: boolean;
229
- behavior?: "instant" | "smooth" | "auto";
230
- }
231
-
232
- export declare function Timeline({ ref, ...props }: TimelineEditor & {
233
- ref?: default_2.RefObject<TimelineState | null>;
234
- unstable_forceRemountEditorArea?: number;
235
- }): JSX.Element;
236
-
237
- /**
238
- * Basic parameters of action
239
- * @export
240
- * @interface TimelineAction
241
- */
242
- export declare interface TimelineAction {
243
- /** Action id */
244
- id: string;
245
- /** Action start time */
246
- start: number;
247
- /** Action end time */
248
- end: number;
249
- /** Effect ID corresponding to the action */
250
- effectId: string;
251
- /** Whether the action is selected */
252
- selected?: boolean;
253
- /** Whether the action is resizable */
254
- flexible?: boolean;
255
- /** Whether the action is movable */
256
- movable?: boolean;
257
- /** Whether the action is disabled */
258
- disable?: boolean;
259
- /** Minimum start time limit for the action */
260
- minStart?: number;
261
- /** Maximum end time limit for the action */
262
- maxEnd?: number;
263
- }
264
-
265
- /**
266
- * Animation editor parameters
267
- * @export
268
- * @interface TimelineProp
269
- */
270
- export declare interface TimelineEditor extends EditData {
271
- /**
272
- * @description Editing area scroll callback (used to control synchronization with editing row scrolling)
273
- */
274
- onScroll?: (params: EventTarget & HTMLDivElement) => void;
275
- /**
276
- * @description Whether to enable auto scroll when dragging
277
- * @default false
278
- */
279
- autoScroll?: boolean;
280
- /**
281
- * @description Auto scroll speed (default 1)
282
- * @default 1
283
- */
284
- autoScrollSpeed?: number;
285
- /**
286
- * @description Auto scroll max speed (default 10)
287
- * @default 10
288
- */
289
- autoScrollMaxSpeed?: number;
290
- /**
291
- * @description Custom timeline style
292
- */
293
- style?: React_2.CSSProperties;
294
- /**
295
- * @description Data change callback, triggered after action end changes data (return false to prevent automatic engine synchronization, used to reduce performance overhead)
296
- */
297
- onChange?: (editorData: TimelineRow[]) => void | boolean;
298
- }
299
-
300
- export declare interface TimelineEffect {
301
- /** Effect id */
302
- id: string;
303
- /** Effect name */
304
- name?: string;
305
- }
306
-
307
- /**
308
- * Basic parameters of action row
309
- * @export
310
- * @interface TimelineRow
311
- */
312
- export declare interface TimelineRow {
313
- /** Action row id */
314
- id: string;
315
- /** List of actions in the row */
316
- actions: TimelineAction[];
317
- /** Custom row height */
318
- rowHeight?: number;
319
- /** Whether the row is selected */
320
- selected?: boolean;
321
- /** Extended class names of the row */
322
- classNames?: string[];
323
- }
324
-
325
- export declare interface TimelineState {
326
- readonly target: HTMLDivElement;
327
- time: number;
328
- getTime(): number;
329
- setTime(time: number): void;
330
- setScrollLeft: (val: number) => void;
331
- setScrollTop: (val: number) => void;
332
- scrollLeft: number;
333
- scrollTop: number;
334
- scrollToTime(time: number, options?: ScrollToTimeOptions): void;
335
- getTimePixelPosition(time?: number): number;
336
- }
337
-
338
- export { }