lexgui 0.7.15 → 8.1.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.
Files changed (134) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +14 -5
  3. package/build/components/AlertDialog.d.ts +7 -0
  4. package/build/components/ArrayInput.d.ts +9 -0
  5. package/build/components/BaseComponent.d.ts +73 -0
  6. package/build/components/Button.d.ts +14 -0
  7. package/build/components/Calendar.d.ts +41 -0
  8. package/build/components/CalendarRange.d.ts +16 -0
  9. package/build/components/CanvasCurve.d.ts +10 -0
  10. package/build/components/CanvasDial.d.ts +11 -0
  11. package/build/components/CanvasMap2D.d.ts +61 -0
  12. package/build/components/Card.d.ts +8 -0
  13. package/build/components/Checkbox.d.ts +8 -0
  14. package/build/components/Color.d.ts +20 -0
  15. package/build/components/ColorInput.d.ts +13 -0
  16. package/build/components/ColorPicker.d.ts +29 -0
  17. package/build/components/ComboButtons.d.ts +8 -0
  18. package/build/components/ContextMenu.d.ts +16 -0
  19. package/build/components/Counter.d.ts +9 -0
  20. package/build/components/Curve.d.ts +10 -0
  21. package/build/components/DatePicker.d.ts +13 -0
  22. package/build/components/Dial.d.ts +10 -0
  23. package/build/components/Dialog.d.ts +20 -0
  24. package/build/components/DropdownMenu.d.ts +32 -0
  25. package/build/components/FileInput.d.ts +8 -0
  26. package/build/components/Footer.d.ts +14 -0
  27. package/build/components/Form.d.ts +8 -0
  28. package/build/components/Layers.d.ts +9 -0
  29. package/build/components/List.d.ts +9 -0
  30. package/build/components/Map2D.d.ts +12 -0
  31. package/build/components/Menubar.d.ts +59 -0
  32. package/build/components/NodeTree.d.ts +26 -0
  33. package/build/components/NumberInput.d.ts +9 -0
  34. package/build/components/OTPInput.d.ts +8 -0
  35. package/build/components/Pad.d.ts +8 -0
  36. package/build/components/Pagination.d.ts +26 -0
  37. package/build/components/PocketDialog.d.ts +11 -0
  38. package/build/components/Popover.d.ts +20 -0
  39. package/build/components/Progress.d.ts +8 -0
  40. package/build/components/RadioGroup.d.ts +8 -0
  41. package/build/components/RangeInput.d.ts +11 -0
  42. package/build/components/Rate.d.ts +8 -0
  43. package/build/components/Select.d.ts +10 -0
  44. package/build/components/Sheet.d.ts +10 -0
  45. package/build/components/Sidebar.d.ts +84 -0
  46. package/build/components/SizeInput.d.ts +8 -0
  47. package/build/components/Skeleton.d.ts +5 -0
  48. package/build/components/Spinner.d.ts +9 -0
  49. package/build/components/TabSections.d.ts +11 -0
  50. package/build/components/Table.d.ts +34 -0
  51. package/build/components/Tabs.d.ts +20 -0
  52. package/build/components/Tags.d.ts +9 -0
  53. package/build/components/TextArea.d.ts +8 -0
  54. package/build/components/TextInput.d.ts +11 -0
  55. package/build/components/Title.d.ts +8 -0
  56. package/build/components/Toggle.d.ts +8 -0
  57. package/build/components/Tour.d.ts +36 -0
  58. package/build/components/Vector.d.ts +9 -0
  59. package/build/core/Area.d.ts +143 -0
  60. package/build/core/Branch.d.ts +19 -0
  61. package/build/core/Core.d.ts +1 -0
  62. package/build/core/Event.d.ts +26 -0
  63. package/build/core/Icons.d.ts +4 -0
  64. package/build/core/Namespace.d.ts +2 -0
  65. package/build/core/Namespace.js +34 -0
  66. package/build/core/Namespace.js.map +1 -0
  67. package/build/core/Panel.d.ts +538 -0
  68. package/build/core/Utils.d.ts +1 -0
  69. package/build/core/Vec2.d.ts +21 -0
  70. package/build/extensions/AssetView.d.ts +136 -0
  71. package/build/extensions/AssetView.js +1367 -0
  72. package/build/extensions/AssetView.js.map +1 -0
  73. package/build/extensions/Audio.d.ts +9 -0
  74. package/build/extensions/Audio.js +163 -0
  75. package/build/extensions/Audio.js.map +1 -0
  76. package/build/extensions/CodeEditor.d.ts +350 -0
  77. package/build/extensions/CodeEditor.js +5022 -0
  78. package/build/extensions/CodeEditor.js.map +1 -0
  79. package/build/extensions/DocMaker.d.ts +27 -0
  80. package/build/extensions/DocMaker.js +327 -0
  81. package/build/extensions/DocMaker.js.map +1 -0
  82. package/build/extensions/GraphEditor.d.ts +276 -0
  83. package/build/extensions/GraphEditor.js +2770 -0
  84. package/build/extensions/GraphEditor.js.map +1 -0
  85. package/build/extensions/ImUi.d.ts +46 -0
  86. package/build/extensions/ImUi.js +227 -0
  87. package/build/extensions/ImUi.js.map +1 -0
  88. package/build/extensions/Timeline.d.ts +670 -0
  89. package/build/extensions/Timeline.js +3955 -0
  90. package/build/extensions/Timeline.js.map +1 -0
  91. package/build/extensions/VideoEditor.d.ts +128 -0
  92. package/build/extensions/VideoEditor.js +898 -0
  93. package/build/extensions/VideoEditor.js.map +1 -0
  94. package/build/extensions/index.d.ts +8 -0
  95. package/build/extensions/index.js +10 -0
  96. package/build/extensions/index.js.map +1 -0
  97. package/build/index.all.d.ts +2 -0
  98. package/build/index.css.d.ts +4 -0
  99. package/build/index.d.ts +56 -0
  100. package/build/lexgui.all.js +28498 -0
  101. package/build/lexgui.all.js.map +1 -0
  102. package/build/lexgui.all.min.js +1 -0
  103. package/build/lexgui.all.module.js +28422 -0
  104. package/build/lexgui.all.module.js.map +1 -0
  105. package/build/lexgui.all.module.min.js +1 -0
  106. package/build/lexgui.css +939 -346
  107. package/build/lexgui.js +13406 -17286
  108. package/build/lexgui.js.map +1 -0
  109. package/build/lexgui.min.css +3 -10
  110. package/build/lexgui.min.js +1 -1
  111. package/build/lexgui.module.js +12762 -16698
  112. package/build/lexgui.module.js.map +1 -0
  113. package/build/lexgui.module.min.js +1 -1
  114. package/changelog.md +170 -74
  115. package/demo.js +162 -48
  116. package/examples/all-components.html +45 -14
  117. package/examples/asset-view.html +110 -47
  118. package/examples/code-editor.html +5 -5
  119. package/examples/dialogs.html +3 -3
  120. package/examples/editor.html +27 -13
  121. package/examples/index.html +19 -14
  122. package/examples/node-graph.html +2 -2
  123. package/examples/previews/video-editor.png +0 -0
  124. package/examples/timeline.html +1 -1
  125. package/examples/video-editor.html +2 -2
  126. package/package.json +25 -9
  127. package/build/extensions/audio.js +0 -212
  128. package/build/extensions/codeeditor.js +0 -6319
  129. package/build/extensions/docmaker.js +0 -432
  130. package/build/extensions/imui.js +0 -325
  131. package/build/extensions/nodegraph.js +0 -3696
  132. package/build/extensions/timeline.js +0 -4636
  133. package/build/extensions/videoeditor.js +0 -953
  134. package/build/lexgui-docs.css +0 -352
@@ -0,0 +1,670 @@
1
+ declare const Area: any;
2
+ declare const Panel: any;
3
+ declare const Dialog: any;
4
+ declare const TreeEvent: any;
5
+ type Nullable<T> = T | null | undefined;
6
+ /**
7
+ * @class Timeline
8
+ * @description Agnostic timeline, do not impose any timeline content. Renders to a canvas
9
+ */
10
+ export declare abstract class Timeline {
11
+ #private;
12
+ static BACKGROUND_COLOR: string;
13
+ static TRACK_COLOR_PRIMARY: string;
14
+ static TRACK_COLOR_SECONDARY: string;
15
+ static TRACK_COLOR_TERCIARY: string;
16
+ static TRACK_COLOR_QUATERNARY: string;
17
+ static TRACK_SELECTED: string;
18
+ static TRACK_SELECTED_LIGHT: string;
19
+ static FONT: string;
20
+ static FONT_COLOR_PRIMARY: string;
21
+ static FONT_COLOR_TERTIARY: string;
22
+ static FONT_COLOR_QUATERNARY: string;
23
+ static KEYFRAME_COLOR: string;
24
+ static KEYFRAME_COLOR_HOVERED: string;
25
+ static KEYFRAME_COLOR_SELECTED: string;
26
+ static KEYFRAME_COLOR_LOCK: string;
27
+ static KEYFRAME_COLOR_EDITED: string;
28
+ static KEYFRAME_COLOR_INACTIVE: string;
29
+ static TIME_MARKER_COLOR: string;
30
+ static TIME_MARKER_COLOR_TEXT: string;
31
+ static BOX_SELECTION_COLOR: string;
32
+ uniqueID: string;
33
+ timelineTitle: string;
34
+ animationClip: any;
35
+ duration: number;
36
+ currentTime: number;
37
+ visualTimeRange: [number, number];
38
+ visualOriginTime: number;
39
+ pixelsPerSecond: number;
40
+ secondsPerPixel: number;
41
+ clickTime: number;
42
+ clickDiscardTimeout: number;
43
+ lastMouse: [number, number];
44
+ boxSelection: boolean;
45
+ boxSelectionStart: [number, number];
46
+ boxSelectionEnd: [number, number];
47
+ historyUndo: Array<any>;
48
+ historyRedo: Array<any>;
49
+ historySaveEnabler: boolean;
50
+ historyMaxSteps: number;
51
+ clipboard: any;
52
+ grabbing: boolean;
53
+ grabTime: number;
54
+ grabbingTimeBar: boolean;
55
+ grabbingScroll: boolean;
56
+ movingKeys: boolean;
57
+ timeBeforeMove: number;
58
+ currentScroll: number;
59
+ currentScrollInPixels: number;
60
+ trackHeight: number;
61
+ timeSeparators: number[];
62
+ playing: boolean;
63
+ loop: boolean;
64
+ active: boolean;
65
+ skipVisibility: boolean;
66
+ skipLock: boolean;
67
+ disableNewTracks: boolean;
68
+ optimizeThreshold: number;
69
+ selectedTracks: any[];
70
+ selectedItems: any[];
71
+ leftPanel: typeof Panel;
72
+ trackTreesPanel: any;
73
+ trackTreesComponent: any;
74
+ lastTrackTreesComponentOffset: any;
75
+ mainArea: typeof Area;
76
+ root: HTMLBodyElement;
77
+ header: typeof Panel;
78
+ canvasArea: typeof Area;
79
+ canvas: HTMLCanvasElement;
80
+ size: [number, number];
81
+ topMargin: number;
82
+ header_offset: number;
83
+ updateTheme: () => void;
84
+ onCreateBeforeTopBar: Nullable<(headerPanel: typeof Panel) => void>;
85
+ onCreateAfterTopBar: Nullable<(headerPanel: typeof Panel) => void>;
86
+ onCreateControlsButtons: Nullable<(headerPanel: typeof Panel) => void>;
87
+ onCreateSettingsButtons: Nullable<(headerPanel: typeof Panel) => void>;
88
+ onShowOptimizeMenu: Nullable<(event: any) => void>;
89
+ onShowConfiguration: Nullable<(panel: typeof Panel) => void>;
90
+ onMouse: Nullable<(event: any, t: number) => void>;
91
+ onDblClick: Nullable<(event: any) => void>;
92
+ onShowContextMenu: Nullable<(event: any) => void>;
93
+ onAddNewTrackButton: Nullable<() => void>;
94
+ onAddNewTrack: Nullable<(track: any, options: any) => void>;
95
+ onTrackTreeEvent: Nullable<(event: typeof TreeEvent) => void>;
96
+ onBeforeDrawContent: Nullable<(ctx: CanvasRenderingContext2D) => void>;
97
+ onStateStop: Nullable<() => void>;
98
+ onStateChange: Nullable<(s: boolean) => void>;
99
+ onChangeLoopMode: Nullable<(l: boolean) => void>;
100
+ onSetDuration: Nullable<(d: number) => void>;
101
+ onSetTime: Nullable<(t: number) => void>;
102
+ onItemSelected: Nullable<(selected: any[], itemsToAdd: Nullable<any[]>, itemsToRemove: Nullable<any[]>) => void>;
103
+ onSetTrackSelection: Nullable<(track: object, oldValue: boolean) => void>;
104
+ onSetTrackState: Nullable<(track: object, oldValue: boolean) => void>;
105
+ onSetTrackLock: Nullable<(track: object, oldValue: boolean) => void>;
106
+ onUpdateTrack: Nullable<(tracks: number[] | string[]) => void>;
107
+ configurationDialog: Nullable<typeof Dialog>;
108
+ abstract onMouseUp(event: any, t: number): void;
109
+ abstract onMouseDown(event: any, t: number): void;
110
+ abstract onMouseMove(event: any, t: number): void;
111
+ abstract drawContent(ctx: CanvasRenderingContext2D): void;
112
+ abstract deleteSelectedContent(skipCallback: boolean): void;
113
+ abstract copySelectedContent(): void;
114
+ abstract pasteContent(time: number): void;
115
+ abstract historyGenerateTrackStep(trackIdx: number): any;
116
+ abstract historyApplyTrackStep(state: any, isUndo: boolean): any;
117
+ /**
118
+ * @param {String} id = string unique id
119
+ * @param {Object} options = {skipLock, skipVisibility}
120
+ */
121
+ constructor(id: string, options?: any);
122
+ clear(): void;
123
+ /**
124
+ * @method updateHeader
125
+ */
126
+ updateHeader(): void;
127
+ /**
128
+ * @method updateLeftPanel
129
+ */
130
+ updateLeftPanel(): void;
131
+ setTrackHeight(trackHeight: number): void;
132
+ /**
133
+ * @param {Object} options options for the new track
134
+ * { id: string, active: bool, locked: bool, }
135
+ * @returns
136
+ */
137
+ addNewTrack(options?: any, skipCallback?: boolean): number;
138
+ /**
139
+ * Finds tracks ( wholy and partially ) inside the range minY maxY.
140
+ * ( Full ) Canvas local coordinates.
141
+ * @param {Number} minY pixels
142
+ * @param {Number} maxY pixels
143
+ * @returns array of trackDatas
144
+ */
145
+ getTracksInRange(minY: number, maxY: number): any;
146
+ /**
147
+ * @method setAnimationClip
148
+ * @param {*} animation
149
+ * @param {Boolean} needsToProcess
150
+ * @param {Object} processOptions
151
+ * [ KeyFrameTimeline ] - each track should contain an attribute "dim" to indicate the value dimension ( e.g. vector3 -> dim=3). Otherwise dimensions will be infered from track's values and times. Default is 1
152
+ */
153
+ setAnimationClip(animation: any, needsToProcess?: boolean): any;
154
+ drawTimeInfo(w: number, h?: number): void;
155
+ drawTracksBackground(w: number, h: number): void;
156
+ /**
157
+ * @method draw
158
+ */
159
+ draw(): void;
160
+ /**
161
+ * @method clearState
162
+ */
163
+ clearState(): void;
164
+ /**
165
+ * @method setDuration
166
+ * @param {Number} t
167
+ * @param {Boolean} skipCallback
168
+ * @param {Boolean} updateHeader
169
+ */
170
+ setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
171
+ setTime(time: number, skipCallback?: boolean): void;
172
+ xToTime(x: number): number;
173
+ timeToX(t: number): number;
174
+ /**
175
+ * @method setScale
176
+ * @param {*} pixelsPerSecond >0. totalVisiblePixels / totalVisibleSeconds.
177
+ */
178
+ setScale(pixelsPerSecond: number): void;
179
+ /**
180
+ * @method setScroll
181
+ * not delta from last state, but full scroll amount.
182
+ * @param {Number} scrollY either pixels or [0,1 ]
183
+ * @param {Boolean} normalized if true, scrollY is in range[0,1 ] being 1 fully scrolled. Otherwised scrollY represents pixels
184
+ * @returns
185
+ */
186
+ setScroll(scrollY: number, normalized?: boolean): void;
187
+ /**
188
+ * @method processMouse
189
+ * @param {*} e
190
+ */
191
+ processMouse(e: any): true | undefined;
192
+ /**
193
+ * keydown
194
+ * @method processKeys
195
+ * @param {*} e
196
+ */
197
+ processKeys(e: KeyboardEvent): void;
198
+ /**
199
+ * @method changeState
200
+ * @param {Boolean} skipCallback defaults false
201
+ * @description change play/pause state
202
+ */
203
+ changeState(skipCallback?: boolean): void;
204
+ /**
205
+ * @method setState
206
+ * @param {Boolean} state
207
+ * @param {Boolean} skipCallback defaults false
208
+ * @description change play/pause state
209
+ */
210
+ setState(state: boolean, skipCallback?: boolean): void;
211
+ /**
212
+ * @method setLoopMode
213
+ * @param {Boolean} loopState
214
+ * @param {Boolean} skipCallback defaults false
215
+ * @description change loop mode of the timeline
216
+ */
217
+ setLoopMode(loopState: boolean, skipCallback?: boolean): void;
218
+ /**
219
+ * @returns the tree elements ( tracks and grouops ) shown in the timeline.
220
+ * Each item has { treeData: { trackData: track } }, where track is the actual track information of the animationClip.
221
+ * If not a track, trackData will be undefined
222
+ */
223
+ getVisibleItems(): any;
224
+ /**
225
+ * [ trackIdx ]
226
+ * @param {Array} itemsName array of numbers identifying tracks
227
+ */
228
+ setSelectedItems(items: any[], skipCallback?: boolean): void;
229
+ /**
230
+ * @param {Array} itemsToAdd [ trackIdx ], array of numbers identifying tracks by their index
231
+ * @param {Array} itemsToRemove [ trackIdx ], array of numbers identifying tracks by their index
232
+ */
233
+ changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
234
+ /**
235
+ * It will find the first occurrence of trackId in animationClip.tracks
236
+ * @param {String} trackId
237
+ * @returns
238
+ */
239
+ getTrack(trackId: string): any;
240
+ /**
241
+ * @param {Boolean} updateTrackTree whether the track tree needs a refresh
242
+ * @returns
243
+ */
244
+ deselectAllTracks(updateTrackTree?: boolean): void;
245
+ /**
246
+ * @param {Int} trackIdx
247
+ * @param {Boolean} isSelected new "selected" state of the track
248
+ * @param {Boolean} skipCallback whether to call onSetTrackSelection
249
+ * @param {Boolean} updateTrackTree whether track tree panel needs a refresh
250
+ * @returns
251
+ */
252
+ setTrackSelection(trackIdx: number, isSelected: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
253
+ /**
254
+ * updates trackTreesComponent's nodes, to match the selectedTracks
255
+ */
256
+ _updateTrackTreeSelection(): void;
257
+ deselectAllElements(): void;
258
+ /**
259
+ * @method setTrackState
260
+ * @param {Int} trackIdx
261
+ * @param {Boolean} isEnbaled
262
+ * @param {Boolean} skipCallback onSetTrackState
263
+ * @param {Boolean} updateTrackTree updates eye icon of the track, if it is visible in the timeline
264
+ */
265
+ setTrackState(trackIdx: number, isEnbaled?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
266
+ /**
267
+ * @param {Int} trackIdx
268
+ * @param {Boolean} isLocked
269
+ * @param {Boolean} skipCallback onSetTrackLock
270
+ * @param {Boolean} updateTrackTree updates lock icon of the track, if it is visible in the timeline
271
+ */
272
+ setTrackLock(trackIdx: number, isLocked?: boolean, skipCallback?: boolean, updateTrackTree?: boolean): void;
273
+ /**
274
+ * @param {Int} trackIdx index of track in the animation ( not local index )
275
+ * @param {Boolean} combineWithPrevious whether to create a new entry or unify changes into a single undo entry
276
+ */
277
+ saveState(trackIdx: number, combineWithPrevious?: boolean): void;
278
+ undo(): boolean;
279
+ redo(): boolean;
280
+ /**
281
+ * @method resize
282
+ * @param {*} size
283
+ */
284
+ resize(size?: Nullable<[number, number]>): void;
285
+ resizeCanvas(): void;
286
+ /**
287
+ * @method hide
288
+ * Hide timeline area
289
+ */
290
+ hide(): void;
291
+ /**
292
+ * @method show
293
+ * Show timeline area if it is hidden
294
+ */
295
+ show(): void;
296
+ /**
297
+ These functions might be overriden by child classes. Nonetheless, they must have the same attributes, at least.
298
+ Usually call a super.whateverFunction to generate its base form, and expand it with extra attributes
299
+ */
300
+ /**
301
+ * This functions uses the selectedItems and generates the data that will feed the LX.Tree Component.
302
+ * This function is used by updateLeftPanel. Some timelines might allow grouping of tracks. Such timelines may override this function
303
+ * WARNING: track entries MUST have an attribute of 'trackData' with the track info
304
+ * @returns lexgui tree data as expected for the creation of a LX.Tree
305
+ */
306
+ generateSelectedItemsTreeData(): any;
307
+ /**
308
+ * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
309
+ * @returns
310
+ */
311
+ instantiateTrack(options?: any, clone?: boolean): {
312
+ isTrack: boolean;
313
+ id: any;
314
+ active: any;
315
+ locked: any;
316
+ isSelected: boolean;
317
+ trackIdx: number;
318
+ data: any;
319
+ };
320
+ /**
321
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
322
+ * @param {Object} options data with which to generate an animationClip
323
+ * @param {Boolean} clone whether to clone clips or make a shallow copy
324
+ * @returns
325
+ */
326
+ instantiateAnimationClip(options?: any, clone?: boolean): any;
327
+ }
328
+ /**
329
+ * @class KeyFramesTimeline
330
+ */
331
+ export declare class KeyFramesTimeline extends Timeline {
332
+ #private;
333
+ static ADDKEY_VALUESINARRAYS: number;
334
+ lastKeyFramesSelected: any[];
335
+ keyValuePerPixel: number;
336
+ defaultCurves: boolean;
337
+ defaultCurvesRange: [number, number];
338
+ keyframeSize: number;
339
+ keyframeSizeHovered: number;
340
+ lastHovered: Nullable<[number, number]>;
341
+ moveKeyMinTime: number;
342
+ onContentMoved: Nullable<(trackIdx: number, keyIdx: number) => void>;
343
+ onOptimizeTracks: Nullable<(trackIdx: number) => void>;
344
+ onDeleteKeyFrames: Nullable<(trackIdx: number, indices: number[]) => void>;
345
+ onSelectKeyFrame: Nullable<(selection: [number, number, number][]) => void>;
346
+ onDeselectKeyFrames: Nullable<(lastSelected: any[]) => void>;
347
+ /**
348
+ * @param {String} name unique string
349
+ * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
350
+ */
351
+ constructor(name: string, options?: any);
352
+ generateSelectedItemsTreeData(): any;
353
+ /**
354
+ * OVERRIDE
355
+ * @param {Object} options track information that wants to be set to the new track
356
+ * id, dim, values, times, selected, edited, hovered
357
+ * @returns
358
+ */
359
+ instantiateTrack(options?: any, clone?: boolean): any;
360
+ /**
361
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
362
+ * @param {Object} animation data with which to generate an animationClip
363
+ * @returns
364
+ */
365
+ instantiateAnimationClip(animation: Nullable<any>, clone?: boolean): any;
366
+ deselectAllElements(): void;
367
+ /**
368
+ * OVERRIDE
369
+ * @param {Array} itemsToAdd [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
370
+ * @param {Array} itemsToRemove [ trackIdx, "groupId" ], array of strings and/or number identifying groups and/or tracks
371
+ */
372
+ changeSelectedItems(itemsToAdd?: Nullable<any[]>, itemsToRemove?: Nullable<any[]>, skipCallback?: boolean): void;
373
+ /**
374
+ * @param {String} groupId unique identifier
375
+ * @param {Array} groupTracks [ "trackID", trackIdx ] array of strings and/or numbers of the existing tracks to include in this group. A track can only be part of 1 group
376
+ * if groupTracks == null, groupId is removed from the list
377
+ */
378
+ setTracksGroup(groupId: string, groupTracks?: Nullable<(string | number)[]>): void;
379
+ /**
380
+ * @param {String} groupId
381
+ * @returns array of tracks or null
382
+ */
383
+ getTracksGroup(groupId: string): any[] | null;
384
+ /**
385
+ * OVERRIDE
386
+ * @param {String} trackId
387
+ * @param {String} groupId optionl. If not set, it will find the first occurrence of trackId in animationClip.tracks
388
+ * @returns
389
+ */
390
+ getTrack(trackId: string, groupId?: Nullable<string>): any;
391
+ /**
392
+ * @param {Number} size pixels, height of keyframe
393
+ * @param {Number} sizeHovered optional, size in pixels when hovered
394
+ */
395
+ setKeyframeSize(size: number, sizeHovered?: Nullable<number>): void;
396
+ onMouseUp(e: any, time: number): void;
397
+ onMouseDown(e: any, time: number): void;
398
+ onMouseMove(e: any, time: number): void;
399
+ drawContent(ctx: CanvasRenderingContext2D): void;
400
+ /**
401
+ * @method drawTrackWithKeyframes
402
+ * @param {*} ctx
403
+ * ...
404
+ * @description helper function, you can call it from drawContent to render all the keyframes
405
+ */
406
+ drawTrackWithKeyframes(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
407
+ drawTrackWithCurves(ctx: CanvasRenderingContext2D, trackHeight: number, track: any): void;
408
+ _getValidTrackName(uglyName: string): (string | null)[];
409
+ /**
410
+ * updates an existing track with new values and times.
411
+ * @param {Int} trackIdx index of track in the animationClip
412
+ * @param {*} newTrack object with two arrays: values and times. These will be set to the selected track
413
+ * @returns
414
+ */
415
+ updateTrack(trackIdx: number, newTrack: any): boolean;
416
+ /**
417
+ * removes equivalent sequential keys either because of equal times or values
418
+ * ( 0,0,0,0,1,1,1,0,0,0,0,0,0,0 ) --> ( 0, 0,1,1,0, 0 )
419
+ * @param {Int} trackIdx index of track in the animation
420
+ * @param {Boolean} onlyEqualTime if true, removes only keyframes with equal times. Otherwise, values are ALSO compared through the class threshold
421
+ * @param {Boolean} skipCallback if false, triggers "onOptimizeTracks" after optimizing
422
+ */
423
+ optimizeTrack(trackIdx: number, onlyEqualTime?: boolean, skipCallback?: boolean): void;
424
+ optimizeTracks(onlyEqualTime?: boolean): void;
425
+ /**
426
+ * saveState function uses this to generate a "copy" of the track.
427
+ * @param {Number} trackIdx
428
+ * @returns All necessary information to reconstruct the track state
429
+ */
430
+ historyGenerateTrackStep(trackIdx: number): {
431
+ trackIdx: number;
432
+ t: any;
433
+ v: any;
434
+ edited: any;
435
+ };
436
+ /**
437
+ * It should swap the previous state with the incoming state of the track. It must return the previous state.
438
+ * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
439
+ * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
440
+ * @param {Boolean} isUndo
441
+ * @returns previous state object
442
+ */
443
+ historyApplyTrackStep(state: any, isUndo: boolean): {
444
+ trackIdx: any;
445
+ t: any;
446
+ v: any;
447
+ edited: any;
448
+ };
449
+ /**
450
+ * @param {*} track
451
+ * @param {Number} srcIdx keyFrame index
452
+ * @param {Number} trgIdx keyFrame index
453
+ */
454
+ swapKeyFrames(track: any, srcIdx: number, trgIdx: number): void;
455
+ copySelectedContent(): void;
456
+ copyKeyFrameValue(track: any, index: number): void;
457
+ copyKeyFrames(track: any, indices: number[]): void;
458
+ canPasteKeyFrame(): boolean;
459
+ pasteContentValue(): boolean;
460
+ pasteContent(time?: number): boolean;
461
+ pasteKeyFrameValue(track: any, index: number): void;
462
+ pasteKeyFrames(pasteTime?: number): boolean;
463
+ /**
464
+ *
465
+ * @param {Int} trackIdx
466
+ * @param {Array} newValues array of values for each keyframe. It should be a flat array of size track.dim*numKeyframes. Check ADDKEY_VALUESINARRAYS flag
467
+ * @param {Array of numbers } newTimes must be ordered ascendently
468
+ * @param {Number} timeOffset
469
+ * @param {Int} flags
470
+ * KeyFramesTimeline.ADDKEY_VALUESINARRAYS: if set, newValues is an array of arrays, one for each entry [ [1,2,3], [5,6,7] ]. Times is still a flat array of values [ 0, 0.2 ]
471
+
472
+ * @returns
473
+ */
474
+ addKeyFrames(trackIdx: number, newValues: any[], newTimes: number[], timeOffset?: number, flags?: number): number[] | null;
475
+ deleteSelectedContent(skipCallback?: boolean): void;
476
+ deleteKeyFrames(trackIdx: number, indices: number[], skipCallback?: boolean): boolean;
477
+ /**
478
+ * Binary search. Relies on track.times being a sorted array
479
+ * @param {Object} track
480
+ * @param {Number} time
481
+ * @param {Number} mode on of the possible values
482
+ * - -1 = nearest frame with t[ f ] <= time
483
+ * - 0 = nearest frame
484
+ * - 1 = nearest frame with t[ f ] >= time
485
+ * @returns a zero/positive value if successful. On failure returnes -1 meaning either there are no frames ( 0 ), no frame-time is lower ( -1 ) or no frame-time is higher (1 )
486
+ */
487
+ getNearestKeyFrame(track: any, time: number, mode?: number): number;
488
+ /**
489
+ * get the nearest keyframe to "time" given a maximum threshold.
490
+ * @param {Object} track
491
+ * @param {Number} time
492
+ * @param {Number} threshold must be positive value
493
+ * @returns returns a postive/zero value if there is a frame inside the threshold range. Otherwise, -1
494
+ */
495
+ getCurrentKeyFrame(track: any, time: number, threshold?: number): number;
496
+ /**
497
+ * Returns the interval of frames between minTime and maxTime (both included )
498
+ * @param {Object} track
499
+ * @param {Number} minTime
500
+ * @param {Number} maxTime
501
+ * @param {Number} threshold must be positive value
502
+ * @returns an array with two values [ minFrame, maxFrame ]. Otherwise null
503
+ */
504
+ getKeyFramesInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
505
+ unHoverAll(): Nullable<[number, number]>;
506
+ deselectAllKeyFrames(): boolean;
507
+ isKeyFrameSelected(track: any, index: number): any;
508
+ /**
509
+ * @param {Int} trackIdx track index of animation clip
510
+ * @param {Int} frameIdx frame ( index ) to select inside the track
511
+ * @param {Boolean} skipCallback
512
+ * @returns
513
+ */
514
+ selectKeyFrame(trackIdx: number, frameIdx: number, skipCallback?: boolean): any[] | null;
515
+ deselectKeyFrame(trackIdx: number, frameIdx: number): boolean;
516
+ getNumKeyFramesSelected(): number;
517
+ /**
518
+ * helper function to process a selection with multiple keyframes. Sets the time of the timeline to the first selected keyframe
519
+ * @param {Number} trackIdx
520
+ * @param {Number} keyFrameIndex
521
+ * @param {Boolean} multipleSelection whether to append to selection or reset it and make this keyframe the only current selection
522
+ * @returns
523
+ */
524
+ processSelectionKeyFrame(trackIdx: number, keyFrameIndex: number, multipleSelection?: boolean): void;
525
+ /**
526
+ * @method clearTrack
527
+ */
528
+ clearTrack(trackIdx: number): number | undefined;
529
+ }
530
+ /**
531
+ * @class ClipsTimeline
532
+ */
533
+ export declare class ClipsTimeline extends Timeline {
534
+ #private;
535
+ static CLONEREASON_COPY: number;
536
+ static CLONEREASON_PASTE: number;
537
+ static CLONEREASON_HISTORY: number;
538
+ static CLONEREASON_TRACKCLONE: number;
539
+ lastClipsSelected: any;
540
+ lastTrackClipsMove: number;
541
+ dragClipMode: Nullable<string>;
542
+ lastHovered: Nullable<[number, number]>;
543
+ onSelectClip: Nullable<(clip: Nullable<any>) => void>;
544
+ onContentMoved: Nullable<(clip: Nullable<any>, delta: number) => void>;
545
+ onDeleteSelectedClips: Nullable<(selected: any[]) => void>;
546
+ onDeleteClip: Nullable<(trackIdx: number, clipIdx: number, clip: any) => void>;
547
+ /**
548
+ * @param {String} name
549
+ * @param {Object} options = {animationClip, selectedItems, x, y, width, height, canvas, trackHeight}
550
+ */
551
+ constructor(name: string, options?: any);
552
+ /**
553
+ * Generates an animationClip using either the parameters set in the animation argument or using default values
554
+ * @param {Object} animation data with which to generate an animationClip
555
+ * @returns
556
+ */
557
+ instantiateAnimationClip(animation: any, clone?: boolean): any;
558
+ /**
559
+ * @param {Object} options set some values for the track instance ( groups and trackIdx not included )
560
+ * @returns
561
+ */
562
+ instantiateTrack(options?: any, clone?: boolean): any;
563
+ instantiateClip(options?: any): {
564
+ id: any;
565
+ start: any;
566
+ duration: any;
567
+ fadein: any;
568
+ fadeout: any;
569
+ clipColor: any;
570
+ fadeColor: any;
571
+ active: any;
572
+ trackIdx: number;
573
+ };
574
+ addNewTrack(options?: any, updateLeftPanel?: boolean, skipCallback?: boolean): any;
575
+ setAnimationClip(animation: any, needsToProcess?: boolean): any;
576
+ deselectAllElements(): void;
577
+ /**
578
+ * OVERRIDE ITEM SELECTION.
579
+ * CLIPS WILL OFFER NO SELECTION. All tracks are visible
580
+ */
581
+ changeSelectedItems(): void;
582
+ unHoverAll(): Nullable<[number, number]>;
583
+ onMouseUp(e: any): void;
584
+ onMouseDown(e: any, time: number): void;
585
+ onMouseMove(e: any, time: number): true | undefined;
586
+ drawContent(ctx: CanvasRenderingContext2D): void;
587
+ /**
588
+ * @method drawTrackWithBoxes
589
+ * @param {*} ctx
590
+ */
591
+ drawTrackWithBoxes(ctx: CanvasRenderingContext2D, y: number, trackHeight: number, track: any): void;
592
+ /**
593
+ * @method optimizeTrack
594
+ */
595
+ optimizeTrack(trackIdx: number): void;
596
+ /**
597
+ * @method optimizeTracks
598
+ */
599
+ optimizeTracks(): void;
600
+ /**
601
+ * @param {Object} clip clip to be added
602
+ * @param {Int} trackIdx ( optional ) track where to put the clip. -1 will find the first free slot. ***WARNING*** Must call getClipsInRange, before calling this function with a valid trackdIdx
603
+ * @param {Number} offsetTime ( optional ) offset time of current time
604
+ * @param {Number} searchStartTrackIdx ( optional ) if trackIdx is set to -1, this idx will be used as the starting point to find a valid track
605
+ * @returns a zero/positive value if successful. Otherwise, -1
606
+ */
607
+ addClip(clip: any, trackIdx?: number, offsetTime?: number, searchStartTrackIdx?: number): any;
608
+ /**
609
+ * Add an array of clips to the timeline in the first suitable tracks. It tries to put clips in the same track if possible. All clips will be in adjacent tracks to each other
610
+ * @param {Object[] } clips
611
+ * @param {Number} offsetTime
612
+ * @param {Int} searchStartTrackIdx
613
+ * @returns
614
+ */
615
+ addClips(clips: any[], offsetTime?: number, searchStartTrackIdx?: number): boolean;
616
+ deleteSelectedContent(skipCallback?: boolean): void;
617
+ /** Delete clip from the timeline
618
+ * @param {Number} trackIdx
619
+ * @param {Number} clipIdx clip to be deleted
620
+ */
621
+ deleteClip(trackIdx: number, clipIdx: number, skipCallback?: boolean): void;
622
+ /**
623
+ * User defined. Used when copying and pasting
624
+ * @param {Array of clips } clipsToClone array of original clips. Do not modify clips in this array
625
+ * @param {Number} timeOffset Value of time that should be added ( or subtracted ) from the timing attributes
626
+ * @param {Int} reason Flag to signal the reason of the clone
627
+ * @returns {Array of clips }
628
+ */
629
+ cloneClips(clipsToClone: any[], timeOffset: number, reason?: number): any;
630
+ /**
631
+ * Overwrite the "cloneClips" function to provide a custom cloning of clips. Otherwise, JSON serialization is used
632
+ */
633
+ copySelectedContent(): void;
634
+ pasteContent(time?: number): void;
635
+ /**
636
+ * @method clearTrack
637
+ */
638
+ clearTrack(trackIdx: number): void;
639
+ /**
640
+ * saveState function uses this to generate a "copy" of the track.
641
+ * @param {Number} trackIdx
642
+ * @returns All necessary information to reconstruct the track state
643
+ */
644
+ historyGenerateTrackStep(trackIdx: number): {
645
+ trackIdx: number;
646
+ clips: any;
647
+ edited: any;
648
+ };
649
+ /**
650
+ * It should swap the previous state with the incoming state of the track. It must return the previous state.
651
+ * historyGenerateTrackStep could be used to copy the previous state. However, as it is a swap, it suffices to just copy the references.
652
+ * @param {Object} state object with a trackIdx:Number and whatever information was saved in historyGenerateTrackStep
653
+ * @param {Boolean} isUndo
654
+ * @returns previous state object
655
+ */
656
+ historyApplyTrackStep(state: any, isUndo: boolean): {
657
+ trackIdx: any;
658
+ clips: any;
659
+ edited: any;
660
+ };
661
+ getClipOnTime(track: any, time: number, threshold: number): number;
662
+ deselectAllClips(): boolean;
663
+ selectAll(skipCallback?: boolean): void;
664
+ selectClip(trackIdx: number, clipIndex: number, deselect?: boolean, skipCallback?: boolean): number;
665
+ deselectClip(trackIdx: number, clipIndex: number): number;
666
+ getClipsInRange(track: any, minTime: number, maxTime: number, threshold?: number): number[] | null;
667
+ validateDuration(t: number): number;
668
+ setDuration(t: number, skipCallback?: boolean, updateHeader?: boolean): void;
669
+ }
670
+ export {};