@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
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
export enum LogLevel {
|
|
2
|
+
VERBOSE = 0,
|
|
3
|
+
LOG = 1,
|
|
4
|
+
INFO = 2,
|
|
5
|
+
WARN = 3,
|
|
6
|
+
ERROR = 4,
|
|
7
|
+
FATAL = 5,
|
|
8
|
+
SILENT = Infinity
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const LogLevels = {
|
|
12
|
+
VERBOSE: LogLevel.VERBOSE,
|
|
13
|
+
LOG: LogLevel.LOG,
|
|
14
|
+
INFO: LogLevel.INFO,
|
|
15
|
+
WARN: LogLevel.WARN,
|
|
16
|
+
ERROR: LogLevel.ERROR,
|
|
17
|
+
SILENT: LogLevel.SILENT,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function colorize(hex: string, x: number) {
|
|
21
|
+
return `color:${hex};font-size:${x}px;`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default class ConsoleLogger {
|
|
25
|
+
static readonly instances: ConsoleLogger[] = [];
|
|
26
|
+
static level: LogLevel = LogLevel.LOG;
|
|
27
|
+
static Levels = LogLevels;
|
|
28
|
+
static noColor = false;
|
|
29
|
+
|
|
30
|
+
Levels = LogLevels;
|
|
31
|
+
level: LogLevel = LogLevel.LOG;
|
|
32
|
+
prefix = '';
|
|
33
|
+
enabled = true;
|
|
34
|
+
debugColor: string = colorize('#cccccc', 12);
|
|
35
|
+
logColor: string = colorize('#bbbbbb', 12);
|
|
36
|
+
infoColor: string = colorize('#2196f3', 12);
|
|
37
|
+
warnColor: string = colorize('#ff00ff', 12);
|
|
38
|
+
errorColor: string = colorize('#e91e63', 12);
|
|
39
|
+
fatalColor: string = colorize('#9a0101', 13);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ConsoleLogger
|
|
43
|
+
* @param {string} prefix Logger prefix
|
|
44
|
+
* @return {ConsoleLogger}
|
|
45
|
+
*/
|
|
46
|
+
constructor(prefix: string) {
|
|
47
|
+
this.setPrefix(prefix);
|
|
48
|
+
this.level = ConsoleLogger.level;
|
|
49
|
+
ConsoleLogger.instances.push(this);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static setLevel(level: LogLevel) {
|
|
53
|
+
this.level = level;
|
|
54
|
+
this.instances.forEach(logger => logger.setLevel(level));
|
|
55
|
+
}
|
|
56
|
+
static enable(level?: LogLevel) {
|
|
57
|
+
if (level) {
|
|
58
|
+
this.level = level;
|
|
59
|
+
}
|
|
60
|
+
this.instances.forEach(logger => logger.enable());
|
|
61
|
+
}
|
|
62
|
+
static disable() {
|
|
63
|
+
this.instances.forEach(logger => logger.disable());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* set logger prefix
|
|
68
|
+
* @param prefix
|
|
69
|
+
*/
|
|
70
|
+
setPrefix(prefix: string) {
|
|
71
|
+
this.prefix = prefix;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* enable logger with optional log level
|
|
76
|
+
* @param level
|
|
77
|
+
*/
|
|
78
|
+
enable(level: LogLevel = this.level): void {
|
|
79
|
+
this.level = level;
|
|
80
|
+
this.enabled = true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* disable logger
|
|
85
|
+
*/
|
|
86
|
+
disable(): void {
|
|
87
|
+
this.enabled = false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Set log level
|
|
92
|
+
* @param {LogLevel} level
|
|
93
|
+
* @return {void}
|
|
94
|
+
*/
|
|
95
|
+
setLevel(level: LogLevel): void {
|
|
96
|
+
this.level = level;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* trace
|
|
101
|
+
* @param title
|
|
102
|
+
* @param args
|
|
103
|
+
*/
|
|
104
|
+
trace(title: string, ...args: any[]): void {
|
|
105
|
+
if (!this.enabled || this.level > LogLevel.VERBOSE) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (ConsoleLogger.noColor) {
|
|
109
|
+
console.trace(`[${this.prefix}] ${title}`, ...args);
|
|
110
|
+
} else {
|
|
111
|
+
console.trace(`%c[${this.prefix}] ${title}`, this.debugColor, ...args);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* debug
|
|
117
|
+
* @param title
|
|
118
|
+
* @param args
|
|
119
|
+
*/
|
|
120
|
+
debug(title: string, ...args: any[]): void {
|
|
121
|
+
if (!this.enabled || this.level > LogLevel.VERBOSE) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (ConsoleLogger.noColor) {
|
|
125
|
+
console.debug(`[${this.prefix}] ${title}`, ...args);
|
|
126
|
+
} else {
|
|
127
|
+
console.debug(`%c[${this.prefix}] ${title}`, this.debugColor, ...args);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* log
|
|
133
|
+
* @param title
|
|
134
|
+
* @param args
|
|
135
|
+
*/
|
|
136
|
+
log(title: string, ...args: any[]): void {
|
|
137
|
+
if (!this.enabled || this.level > LogLevel.LOG) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (ConsoleLogger.noColor) {
|
|
141
|
+
console.log(`[${this.prefix}] ${title}`, ...args);
|
|
142
|
+
} else {
|
|
143
|
+
console.log(`%c[${this.prefix}] ${title}`, this.logColor, ...args);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* info
|
|
149
|
+
* @param title
|
|
150
|
+
* @param args
|
|
151
|
+
*/
|
|
152
|
+
info(title: string, ...args: any[]): void {
|
|
153
|
+
if (!this.enabled || this.level > LogLevel.INFO) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (ConsoleLogger.noColor) {
|
|
157
|
+
console.info(`[${this.prefix}] ${title}`, ...args);
|
|
158
|
+
} else {
|
|
159
|
+
console.info(`%c[${this.prefix}] ${title}`, this.infoColor, ...args);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* warn
|
|
165
|
+
* @param title
|
|
166
|
+
* @param args
|
|
167
|
+
*/
|
|
168
|
+
warn(title: string, ...args: any[]): void {
|
|
169
|
+
if (!this.enabled || this.level > LogLevel.WARN) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (ConsoleLogger.noColor) {
|
|
173
|
+
console.warn(`[${this.prefix}] ${title}`, ...args);
|
|
174
|
+
} else {
|
|
175
|
+
console.warn(`%c[${this.prefix}] ${title}`, this.warnColor, ...args);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* error
|
|
181
|
+
* @param title
|
|
182
|
+
* @param args
|
|
183
|
+
*/
|
|
184
|
+
error(title: string, ...args: any[]): void {
|
|
185
|
+
if (!this.enabled || this.level > LogLevel.ERROR) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (ConsoleLogger.noColor) {
|
|
189
|
+
console.error(`[${this.prefix}] ${title}`, ...args);
|
|
190
|
+
} else {
|
|
191
|
+
console.error(`%c[${this.prefix}] ${title}`, this.errorColor, ...args);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* fatal error
|
|
197
|
+
* @param title
|
|
198
|
+
* @param args
|
|
199
|
+
*/
|
|
200
|
+
fatal(title: string, ...args: any[]): void {
|
|
201
|
+
if (!this.enabled || this.level > LogLevel.FATAL) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (ConsoleLogger.noColor) {
|
|
205
|
+
console.error(`[${this.prefix}] ${title}`, ...args);
|
|
206
|
+
} else {
|
|
207
|
+
console.error(`%c[${this.prefix}] ${title}`, this.fatalColor, ...args);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* start a group with label
|
|
213
|
+
* @param label
|
|
214
|
+
*/
|
|
215
|
+
group(...label: any[]) {
|
|
216
|
+
if (console.group) {
|
|
217
|
+
console.group(...label);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* end a group
|
|
223
|
+
*/
|
|
224
|
+
groupEnd() {
|
|
225
|
+
if (console.groupEnd) {
|
|
226
|
+
console.groupEnd();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* collapse log group
|
|
232
|
+
* @param label
|
|
233
|
+
*/
|
|
234
|
+
groupCollapsed(...label: any[]) {
|
|
235
|
+
if (console.groupCollapsed) {
|
|
236
|
+
console.groupCollapsed(...label);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|