@keplar-404/react-timeline-editor 1.0.6
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/components/control_area/index.d.ts +0 -0
- package/dist/components/cursor/cursor.d.ts +20 -0
- package/dist/components/cut-overlay/CutOverlay.d.ts +202 -0
- package/dist/components/edit_area/cross_row_drag.d.ts +50 -0
- package/dist/components/edit_area/drag_lines.d.ts +11 -0
- package/dist/components/edit_area/drag_preview.d.ts +14 -0
- package/dist/components/edit_area/drag_utils.d.ts +39 -0
- package/dist/components/edit_area/edit_action.d.ts +19 -0
- package/dist/components/edit_area/edit_area.d.ts +56 -0
- package/dist/components/edit_area/edit_row.d.ts +27 -0
- package/dist/components/edit_area/hooks/use_drag_line.d.ts +33 -0
- package/dist/components/edit_area/insertion_line.d.ts +12 -0
- package/dist/components/loop-zone/LoopZoneOverlay.d.ts +243 -0
- package/dist/components/row_rnd/hooks/useAutoScroll.d.ts +7 -0
- package/dist/components/row_rnd/interactable.d.ts +14 -0
- package/dist/components/row_rnd/row_rnd.d.ts +3 -0
- package/dist/components/row_rnd/row_rnd_interface.d.ts +47 -0
- package/dist/components/time_area/time_area.d.ts +17 -0
- package/dist/components/timeline.d.ts +3 -0
- package/dist/components/transport/TransportBar.d.ts +132 -0
- package/dist/components/transport/useTimelinePlayer.d.ts +164 -0
- package/dist/index.cjs.js +13 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.es.js +10102 -0
- package/dist/index.umd.js +13 -0
- package/dist/interface/common_prop.d.ts +12 -0
- package/dist/interface/const.d.ts +28 -0
- package/dist/interface/timeline.d.ts +342 -0
- package/dist/react-timeline-editor.css +1 -0
- package/dist/utils/check_props.d.ts +2 -0
- package/dist/utils/deal_class_prefix.d.ts +1 -0
- package/dist/utils/deal_data.d.ts +58 -0
- package/dist/utils/logger.d.ts +132 -0
- package/package.json +70 -0
- package/src/components/control_area/index.tsx +1 -0
- package/src/components/cursor/cursor.css +26 -0
- package/src/components/cursor/cursor.tsx +105 -0
- package/src/components/cut-overlay/CutOverlay.css +68 -0
- package/src/components/cut-overlay/CutOverlay.tsx +491 -0
- package/src/components/edit_area/cross_row_drag.tsx +174 -0
- package/src/components/edit_area/drag_lines.css +13 -0
- package/src/components/edit_area/drag_lines.tsx +31 -0
- package/src/components/edit_area/drag_preview.tsx +50 -0
- package/src/components/edit_area/drag_utils.ts +77 -0
- package/src/components/edit_area/edit_action.css +56 -0
- package/src/components/edit_area/edit_action.tsx +362 -0
- package/src/components/edit_area/edit_area.css +24 -0
- package/src/components/edit_area/edit_area.tsx +606 -0
- package/src/components/edit_area/edit_row.css +78 -0
- package/src/components/edit_area/edit_row.tsx +128 -0
- package/src/components/edit_area/hooks/use_drag_line.ts +93 -0
- package/src/components/edit_area/insertion_line.tsx +39 -0
- package/src/components/loop-zone/LoopZoneOverlay.css +65 -0
- package/src/components/loop-zone/LoopZoneOverlay.tsx +461 -0
- package/src/components/row_rnd/hooks/useAutoScroll.ts +81 -0
- package/src/components/row_rnd/interactable.tsx +55 -0
- package/src/components/row_rnd/row_rnd.tsx +365 -0
- package/src/components/row_rnd/row_rnd_interface.ts +59 -0
- package/src/components/time_area/time_area.css +35 -0
- package/src/components/time_area/time_area.tsx +93 -0
- package/src/components/timeline.css +12 -0
- package/src/components/timeline.tsx +227 -0
- package/src/components/transport/TransportBar.css +171 -0
- package/src/components/transport/TransportBar.tsx +322 -0
- package/src/components/transport/useTimelinePlayer.ts +319 -0
- package/src/index.tsx +17 -0
- package/src/interface/common_prop.ts +13 -0
- package/src/interface/const.ts +32 -0
- package/src/interface/timeline.ts +329 -0
- package/src/utils/check_props.ts +77 -0
- package/src/utils/deal_class_prefix.ts +6 -0
- package/src/utils/deal_data.ts +159 -0
- package/src/utils/logger.ts +239 -0
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
|
+
import { ScrollSync } from 'react-virtualized';
|
|
3
|
+
import { CommonProp } from '../../interface/common_prop';
|
|
4
|
+
/** Animation timeline component parameters */
|
|
5
|
+
export type CursorProps = CommonProp & {
|
|
6
|
+
/** Scroll distance from left */
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
/** Set cursor position */
|
|
9
|
+
setCursor: (param: {
|
|
10
|
+
left?: number;
|
|
11
|
+
time?: number;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
/** Timeline area DOM ref */
|
|
14
|
+
areaRef: React.RefObject<HTMLDivElement>;
|
|
15
|
+
/** Set scroll left */
|
|
16
|
+
deltaScrollLeft?: (delta: number) => void;
|
|
17
|
+
/** Scroll sync ref (TODO: This data is used to temporarily solve the out-of-sync issue when scrollLeft is dragged) */
|
|
18
|
+
scrollSync: React.RefObject<ScrollSync>;
|
|
19
|
+
};
|
|
20
|
+
export declare const Cursor: FC<CursorProps>;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimelineRow } from '@keplar-404/timeline-engine';
|
|
3
|
+
/**
|
|
4
|
+
* Visual and behavioral configuration for the {@link CutOverlay} component.
|
|
5
|
+
* All properties are optional — defaults produce a red-themed blade.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const cutConfig: CutOverlayConfig = {
|
|
10
|
+
* bladeColor: '#3b82f6',
|
|
11
|
+
* showPill: true,
|
|
12
|
+
* formatPillLabel: (t) => `Split at ${t.toFixed(3)}s`,
|
|
13
|
+
* showBlockHighlight: true,
|
|
14
|
+
* blockHighlightColor: 'rgba(59,130,246,0.12)',
|
|
15
|
+
* };
|
|
16
|
+
* <CutOverlay config={cutConfig} ... />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface CutOverlayConfig {
|
|
20
|
+
/**
|
|
21
|
+
* CSS color of the vertical blade line.
|
|
22
|
+
* @default '#ef4444'
|
|
23
|
+
*/
|
|
24
|
+
bladeColor?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to display the floating time-label pill above the blade.
|
|
27
|
+
* Set to `false` to completely hide the pill.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showPill?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Custom formatter for the time label displayed inside the pill.
|
|
33
|
+
* Receives the cut time in **seconds** and should return a string.
|
|
34
|
+
*
|
|
35
|
+
* @param time - Cut time value in seconds.
|
|
36
|
+
* @returns The string to render inside the pill.
|
|
37
|
+
* @default (t) => `✂ ${t.toFixed(2)}s`
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* formatPillLabel={(t) => `Cut @ ${(t * 1000).toFixed(0)} ms`}
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
formatPillLabel?: (time: number) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Background color of the pill label.
|
|
47
|
+
* @default '#ef4444'
|
|
48
|
+
*/
|
|
49
|
+
pillColor?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Text color of the pill label.
|
|
52
|
+
* @default '#ffffff'
|
|
53
|
+
*/
|
|
54
|
+
pillTextColor?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to show the translucent highlight on the hovered action block.
|
|
57
|
+
* Set to `false` to remove all background and border from the clip container.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
showBlockHighlight?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Background fill color for the block highlight.
|
|
63
|
+
* Accepts any valid CSS color value (e.g. `'rgba(99,102,241,0.15)'` or `'transparent'`).
|
|
64
|
+
* Only takes effect when `showBlockHighlight` is `true`.
|
|
65
|
+
* @default 'rgba(239,68,68,0.08)'
|
|
66
|
+
*/
|
|
67
|
+
blockHighlightColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Border color for the block highlight container.
|
|
70
|
+
* Only takes effect when `showBlockHighlight` is `true`.
|
|
71
|
+
* @default 'rgba(239,68,68,0.3)'
|
|
72
|
+
*/
|
|
73
|
+
blockHighlightBorderColor?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Custom CSS cursor to display when hovering over the active cut overlay.
|
|
76
|
+
* Standard CSS cursors like 'crosshair', 'copy', or 'default' are supported.
|
|
77
|
+
* @default 'col-resize'
|
|
78
|
+
*/
|
|
79
|
+
cursor?: string;
|
|
80
|
+
/**
|
|
81
|
+
* A specific keyboard key that must be held down to activate the cut blade.
|
|
82
|
+
* When defined, standard timeline interactions (dragging, selecting) pass through
|
|
83
|
+
* normally until this precise key is physically held down.
|
|
84
|
+
*
|
|
85
|
+
* Supports standard modifier keys ('Alt', 'Control', 'Shift', 'Meta') or any
|
|
86
|
+
* exact literal character key (e.g. 'c' or 'x').
|
|
87
|
+
*
|
|
88
|
+
* Note: The `string & {}` union hack preserves autocomplete for common keys
|
|
89
|
+
* while allowing custom exact string matches.
|
|
90
|
+
*/
|
|
91
|
+
keyboardModifier?: 'Alt' | 'Control' | 'Shift' | 'Meta' | (string & {});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Props for the {@link CutOverlay} component.
|
|
95
|
+
*
|
|
96
|
+
* Mount this absolutely inside the same container as your `<Timeline>` to
|
|
97
|
+
* overlay a blade-cut interaction on top of the timeline's edit area.
|
|
98
|
+
*/
|
|
99
|
+
export interface CutOverlayProps {
|
|
100
|
+
/**
|
|
101
|
+
* The current timeline row data — same array you pass to `<Timeline editorData>`.
|
|
102
|
+
* Used to hit-test which action block the cursor is over.
|
|
103
|
+
*/
|
|
104
|
+
data: TimelineRow[];
|
|
105
|
+
/**
|
|
106
|
+
* Duration represented by one scale unit (seconds).
|
|
107
|
+
* Must match the `scale` prop on `<Timeline>`.
|
|
108
|
+
* @default 1
|
|
109
|
+
*/
|
|
110
|
+
scale: number;
|
|
111
|
+
/**
|
|
112
|
+
* Number of sub-divisions per scale unit used for grid snapping.
|
|
113
|
+
* Must match the `scaleSplitCount` prop on `<Timeline>`.
|
|
114
|
+
* @default 10
|
|
115
|
+
*/
|
|
116
|
+
scaleSplitCount: number;
|
|
117
|
+
/**
|
|
118
|
+
* Width in pixels of one scale unit.
|
|
119
|
+
* Must match the `scaleWidth` prop on `<Timeline>`.
|
|
120
|
+
* @default 160
|
|
121
|
+
*/
|
|
122
|
+
scaleWidth: number;
|
|
123
|
+
/**
|
|
124
|
+
* Left inset in pixels before the first scale mark begins.
|
|
125
|
+
* Must match the `startLeft` prop on `<Timeline>`.
|
|
126
|
+
* @default 20
|
|
127
|
+
*/
|
|
128
|
+
startLeft: number;
|
|
129
|
+
/**
|
|
130
|
+
* Height in pixels of each row in the edit area.
|
|
131
|
+
* Must match the `rowHeight` prop on `<Timeline>`.
|
|
132
|
+
* @default 32
|
|
133
|
+
*/
|
|
134
|
+
rowHeight: number;
|
|
135
|
+
/**
|
|
136
|
+
* Height in pixels of the time-ruler strip that sits above the edit rows.
|
|
137
|
+
* This is subtracted from the mouse Y coordinate to find the correct row index.
|
|
138
|
+
* The default timeline ruler is **32 px** tall, but adjust if your layout differs.
|
|
139
|
+
* @default 32
|
|
140
|
+
*/
|
|
141
|
+
editAreaTopOffset: number;
|
|
142
|
+
/**
|
|
143
|
+
* When `true` (and `<Timeline gridSnap>` is also enabled), the cut point
|
|
144
|
+
* snaps to the nearest grid boundary as the cursor moves.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
gridSnap: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Fine-grained control over the blade, pill, and block-highlight visuals.
|
|
150
|
+
* All properties are optional and fall back to red-themed defaults.
|
|
151
|
+
* @see {@link CutOverlayConfig}
|
|
152
|
+
*/
|
|
153
|
+
config?: CutOverlayConfig;
|
|
154
|
+
/**
|
|
155
|
+
* Called when the user clicks while the blade is positioned over an action block.
|
|
156
|
+
*
|
|
157
|
+
* @param rowId - `id` of the row that contains the cut action.
|
|
158
|
+
* @param actionId - `id` of the action block being cut.
|
|
159
|
+
* @param cutTime - The time value (in seconds) at the cut point.
|
|
160
|
+
*/
|
|
161
|
+
onCut: (rowId: string, actionId: string, cutTime: number) => void;
|
|
162
|
+
/**
|
|
163
|
+
* Called whenever the keyboard modifier state changes.
|
|
164
|
+
* Fires with `true` when the modifier is pressed (blade active)
|
|
165
|
+
* and `false` when released (blade inactive, pointer events pass through).
|
|
166
|
+
*
|
|
167
|
+
* Use this to dynamically control `disableDrag` on the sibling `<Timeline>`:
|
|
168
|
+
* when the modifier is held → disable drag; when released → re-enable.
|
|
169
|
+
*
|
|
170
|
+
* Not called when no `keyboardModifier` is configured — in that case
|
|
171
|
+
* the blade is always active and drag should always be disabled.
|
|
172
|
+
*
|
|
173
|
+
* @param held - Whether the modifier key is currently pressed.
|
|
174
|
+
*/
|
|
175
|
+
onModifierChange?: (held: boolean) => void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* `CutOverlay` adds a blade-cut interaction on top of a `<Timeline>` edit area.
|
|
179
|
+
*
|
|
180
|
+
* When enabled, hovering over an action block shows a vertical blade line and
|
|
181
|
+
* an optional floating time pill. Clicking splits the block at the cut point.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```tsx
|
|
185
|
+
* {cutModeActive && (
|
|
186
|
+
* <CutOverlay
|
|
187
|
+
* data={editorData}
|
|
188
|
+
* scale={1}
|
|
189
|
+
* scaleSplitCount={10}
|
|
190
|
+
* scaleWidth={160}
|
|
191
|
+
* startLeft={20}
|
|
192
|
+
* rowHeight={40}
|
|
193
|
+
* editAreaTopOffset={42}
|
|
194
|
+
* gridSnap={snapEnabled}
|
|
195
|
+
* config={{ bladeColor: '#3b82f6', formatPillLabel: (t) => `${t.toFixed(2)}s` }}
|
|
196
|
+
* onCut={(rowId, actionId, cutTime) => handleCut(rowId, actionId, cutTime)}
|
|
197
|
+
* />
|
|
198
|
+
* )}
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
declare const CutOverlay: React.FC<CutOverlayProps>;
|
|
202
|
+
export default CutOverlay;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimelineAction, TimelineRow } from '@keplar-404/timeline-engine';
|
|
3
|
+
export interface CrossRowDragState {
|
|
4
|
+
isDragging: boolean;
|
|
5
|
+
/** The action currently being dragged across rows */
|
|
6
|
+
action: TimelineAction | null;
|
|
7
|
+
/** The source row (where the action came from) */
|
|
8
|
+
sourceRow: TimelineRow | null;
|
|
9
|
+
/** Visual width of the ghost (px) */
|
|
10
|
+
ghostWidth: number;
|
|
11
|
+
/** Visual height of the ghost (px) */
|
|
12
|
+
ghostHeight: number;
|
|
13
|
+
/** Current cursor X (client) */
|
|
14
|
+
cursorX: number;
|
|
15
|
+
/** Current cursor Y (client) */
|
|
16
|
+
cursorY: number;
|
|
17
|
+
/** Offset from the left edge of the block where the user grabbed it */
|
|
18
|
+
grabOffsetX: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CrossRowDragAPI {
|
|
21
|
+
state: CrossRowDragState;
|
|
22
|
+
startCrossRowDrag: (params: {
|
|
23
|
+
action: TimelineAction;
|
|
24
|
+
sourceRow: TimelineRow;
|
|
25
|
+
ghostWidth: number;
|
|
26
|
+
ghostHeight: number;
|
|
27
|
+
grabOffsetX: number;
|
|
28
|
+
initialX: number;
|
|
29
|
+
initialY: number;
|
|
30
|
+
}) => void;
|
|
31
|
+
endCrossRowDrag: () => void;
|
|
32
|
+
/** Called by the EditArea when mouse is released to commit the move */
|
|
33
|
+
onCommit: (action: TimelineAction, sourceRow: TimelineRow, targetRow: TimelineRow, newStart: number, newEnd: number) => void;
|
|
34
|
+
setOnCommit: (fn: CrossRowDragAPI['onCommit']) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const useCrossRowDrag: () => CrossRowDragAPI;
|
|
37
|
+
export declare const CrossRowDragProvider: React.FC<{
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}>;
|
|
40
|
+
interface GhostProps {
|
|
41
|
+
state: CrossRowDragState;
|
|
42
|
+
enableGhostPreview: boolean;
|
|
43
|
+
/** Optional custom render function; receives the dragged action + source row */
|
|
44
|
+
getGhostPreview?: (params: {
|
|
45
|
+
action: TimelineAction;
|
|
46
|
+
row: TimelineRow;
|
|
47
|
+
}) => React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export declare const CrossRowGhost: React.FC<GhostProps>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface DragLineData {
|
|
3
|
+
isMoving: boolean;
|
|
4
|
+
movePositions: number[];
|
|
5
|
+
assistPositions: number[];
|
|
6
|
+
}
|
|
7
|
+
export type DragLineProps = DragLineData & {
|
|
8
|
+
scrollLeft: number;
|
|
9
|
+
};
|
|
10
|
+
/** Drag auxiliary lines */
|
|
11
|
+
export declare const DragLines: FC<DragLineProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface DragPreviewProps {
|
|
3
|
+
/** Top position of the preview element */
|
|
4
|
+
top: number;
|
|
5
|
+
/** Height of the preview element */
|
|
6
|
+
height: number;
|
|
7
|
+
/** Whether the preview element is visible */
|
|
8
|
+
visible: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Drag preview component - displays a preview of the row being dragged
|
|
12
|
+
*/
|
|
13
|
+
export declare const DragPreview: FC<DragPreviewProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TimelineRow } from '@keplar-404/timeline-engine';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate the accumulated height of rows
|
|
4
|
+
* @param editorData Editor data
|
|
5
|
+
* @param rowIndex Target row index
|
|
6
|
+
* @param defaultRowHeight Default row height
|
|
7
|
+
* @returns Accumulated height
|
|
8
|
+
*/
|
|
9
|
+
export declare const calculateRowAccumulatedHeight: (editorData: TimelineRow[], rowIndex: number, defaultRowHeight: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Calculate total height of all rows
|
|
12
|
+
* @param editorData Editor data
|
|
13
|
+
* @param defaultRowHeight Default row height
|
|
14
|
+
* @returns Total height
|
|
15
|
+
*/
|
|
16
|
+
export declare const calculateTotalHeight: (editorData: TimelineRow[], defaultRowHeight: number) => number;
|
|
17
|
+
/**
|
|
18
|
+
* Get an array of actual heights for each row
|
|
19
|
+
* @param editorData Editor data
|
|
20
|
+
* @param defaultRowHeight Default row height
|
|
21
|
+
* @returns Height array
|
|
22
|
+
*/
|
|
23
|
+
export declare const getRowHeights: (editorData: TimelineRow[], defaultRowHeight: number) => number[];
|
|
24
|
+
/**
|
|
25
|
+
* Calculate the position of the insertion line
|
|
26
|
+
* @param editorData Editor data
|
|
27
|
+
* @param targetIndex Target index
|
|
28
|
+
* @param defaultRowHeight Default row height
|
|
29
|
+
* @returns Insertion line top position
|
|
30
|
+
*/
|
|
31
|
+
export declare const calculateInsertionLineTop: (editorData: TimelineRow[], targetIndex: number, defaultRowHeight: number) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Validate whether the drag target index is valid
|
|
34
|
+
* @param targetIndex Target index
|
|
35
|
+
* @param draggedIndex Index of the row being dragged
|
|
36
|
+
* @param totalRows Total number of rows
|
|
37
|
+
* @returns Whether it is valid
|
|
38
|
+
*/
|
|
39
|
+
export declare const isValidDragTarget: (targetIndex: number, draggedIndex: number, totalRows: number) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
|
+
import { TimelineAction, TimelineRow } from '@keplar-404/timeline-engine';
|
|
3
|
+
import { CommonProp } from '../../interface/common_prop';
|
|
4
|
+
import { DragLineData } from './drag_lines';
|
|
5
|
+
export type EditActionProps = CommonProp & {
|
|
6
|
+
row: TimelineRow;
|
|
7
|
+
action: TimelineAction;
|
|
8
|
+
dragLineData: DragLineData;
|
|
9
|
+
setEditorData: (params: TimelineRow[]) => void;
|
|
10
|
+
handleTime: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => number;
|
|
11
|
+
areaRef: React.RefObject<HTMLDivElement>;
|
|
12
|
+
/** Scroll delta, used for auto-scroll sync */
|
|
13
|
+
deltaScrollLeft?: (delta: number) => void;
|
|
14
|
+
/** Enable dragging a block to a different row */
|
|
15
|
+
enableCrossRowDrag?: boolean;
|
|
16
|
+
/** Show ghost element while dragging */
|
|
17
|
+
enableGhostPreview?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const EditAction: FC<EditActionProps>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OnScrollParams } from 'react-virtualized';
|
|
3
|
+
import { TimelineAction, TimelineRow } from '@keplar-404/timeline-engine';
|
|
4
|
+
import { CommonProp } from '../../interface/common_prop';
|
|
5
|
+
export type EditAreaProps = CommonProp & {
|
|
6
|
+
/** Horizontal scroll offset */
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
/** Vertical scroll offset */
|
|
9
|
+
scrollTop: number;
|
|
10
|
+
/** Scroll callback for sync */
|
|
11
|
+
onScroll: (params: OnScrollParams) => void;
|
|
12
|
+
/** Update the editor data */
|
|
13
|
+
setEditorData: (params: TimelineRow[]) => void;
|
|
14
|
+
/** Horizontal auto-scroll delta */
|
|
15
|
+
deltaScrollLeft: (scrollLeft: number) => void;
|
|
16
|
+
/** Enable cross-row block drag */
|
|
17
|
+
enableCrossRowDrag?: boolean;
|
|
18
|
+
/** Show ghost preview while block dragging across rows */
|
|
19
|
+
enableGhostPreview?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Custom render function for the drag ghost element.
|
|
22
|
+
* Replaces the default blue glowing box with your own component.
|
|
23
|
+
*/
|
|
24
|
+
getGhostPreview?: (params: {
|
|
25
|
+
action: TimelineAction;
|
|
26
|
+
row: TimelineRow;
|
|
27
|
+
}) => React.ReactNode;
|
|
28
|
+
};
|
|
29
|
+
/** Edit area ref data */
|
|
30
|
+
export interface EditAreaState {
|
|
31
|
+
domRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
32
|
+
}
|
|
33
|
+
export declare const EditArea: React.ForwardRefExoticComponent<CommonProp & {
|
|
34
|
+
/** Horizontal scroll offset */
|
|
35
|
+
scrollLeft: number;
|
|
36
|
+
/** Vertical scroll offset */
|
|
37
|
+
scrollTop: number;
|
|
38
|
+
/** Scroll callback for sync */
|
|
39
|
+
onScroll: (params: OnScrollParams) => void;
|
|
40
|
+
/** Update the editor data */
|
|
41
|
+
setEditorData: (params: TimelineRow[]) => void;
|
|
42
|
+
/** Horizontal auto-scroll delta */
|
|
43
|
+
deltaScrollLeft: (scrollLeft: number) => void;
|
|
44
|
+
/** Enable cross-row block drag */
|
|
45
|
+
enableCrossRowDrag?: boolean;
|
|
46
|
+
/** Show ghost preview while block dragging across rows */
|
|
47
|
+
enableGhostPreview?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Custom render function for the drag ghost element.
|
|
50
|
+
* Replaces the default blue glowing box with your own component.
|
|
51
|
+
*/
|
|
52
|
+
getGhostPreview?: (params: {
|
|
53
|
+
action: TimelineAction;
|
|
54
|
+
row: TimelineRow;
|
|
55
|
+
}) => React.ReactNode;
|
|
56
|
+
} & React.RefAttributes<EditAreaState>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React, FC } from 'react';
|
|
2
|
+
import { TimelineRow } from '@keplar-404/timeline-engine';
|
|
3
|
+
import { CommonProp } from '../../interface/common_prop';
|
|
4
|
+
import { DragLineData } from './drag_lines';
|
|
5
|
+
export type EditRowProps = CommonProp & {
|
|
6
|
+
areaRef: React.RefObject<HTMLDivElement>;
|
|
7
|
+
rowData?: TimelineRow;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
dragLineData: DragLineData;
|
|
10
|
+
setEditorData: (params: TimelineRow[]) => void;
|
|
11
|
+
/** Horizontal scroll offset */
|
|
12
|
+
scrollLeft: number;
|
|
13
|
+
/** Horizontal scroll delta */
|
|
14
|
+
deltaScrollLeft: (scrollLeft: number) => void;
|
|
15
|
+
/** Row index in the editor data array */
|
|
16
|
+
rowIndex?: number;
|
|
17
|
+
/** Current row-reorder drag state */
|
|
18
|
+
dragState?: {
|
|
19
|
+
isDragging: boolean;
|
|
20
|
+
draggedIndex: number;
|
|
21
|
+
};
|
|
22
|
+
/** Enable cross-row block drag */
|
|
23
|
+
enableCrossRowDrag?: boolean;
|
|
24
|
+
/** Show ghost preview while block dragging across rows */
|
|
25
|
+
enableGhostPreview?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare const EditRow: FC<EditRowProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TimelineAction, TimelineRow } from '@keplar-404/timeline-engine';
|
|
2
|
+
import { DragLineData } from '../drag_lines';
|
|
3
|
+
export declare function useDragLine(): {
|
|
4
|
+
initDragLine: (data: {
|
|
5
|
+
movePositions?: number[];
|
|
6
|
+
assistPositions?: number[];
|
|
7
|
+
}) => void;
|
|
8
|
+
updateDragLine: (data: {
|
|
9
|
+
movePositions?: number[];
|
|
10
|
+
assistPositions?: number[];
|
|
11
|
+
}) => void;
|
|
12
|
+
disposeDragLine: () => void;
|
|
13
|
+
dragLineData: DragLineData;
|
|
14
|
+
defaultGetAssistPosition: (data: {
|
|
15
|
+
editorData: TimelineRow[];
|
|
16
|
+
assistActionIds?: string[];
|
|
17
|
+
action: TimelineAction;
|
|
18
|
+
row: TimelineRow;
|
|
19
|
+
startLeft: number;
|
|
20
|
+
scale: number;
|
|
21
|
+
scaleWidth: number;
|
|
22
|
+
hideCursor: boolean;
|
|
23
|
+
cursorLeft: number;
|
|
24
|
+
}) => number[];
|
|
25
|
+
defaultGetMovePosition: (data: {
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
dir?: "right" | "left";
|
|
29
|
+
startLeft: number;
|
|
30
|
+
scale: number;
|
|
31
|
+
scaleWidth: number;
|
|
32
|
+
}) => number[];
|
|
33
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface InsertionLineProps {
|
|
3
|
+
/** Distance from top */
|
|
4
|
+
top: number;
|
|
5
|
+
/** Whether the insertion line is visible */
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Insertion line component - displays the drag insertion position
|
|
10
|
+
*/
|
|
11
|
+
export declare const InsertionLine: FC<InsertionLineProps>;
|
|
12
|
+
export {};
|