awesome-timeline-react 0.1.15 → 0.2.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.
- package/LICENSE +21 -21
- package/README.md +184 -96
- package/dist/_tsup-dts-rollup.d.mts +738 -329
- package/dist/_tsup-dts-rollup.d.ts +738 -329
- package/dist/index.css +129 -210
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +2055 -1923
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2040 -1910
- package/dist/index.mjs.map +1 -1
- package/package.json +66 -62
- package/dist/src/index.d.mts +0 -1
- package/dist/src/index.d.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,1911 +1,2041 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// src/
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
if (
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
if (
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
this.
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
);
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
if (
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
if (
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
{
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
()
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
if (
|
|
1702
|
-
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
);
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
);
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
)
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/timeline.tsx
|
|
22
|
+
import React6, {
|
|
23
|
+
forwardRef as forwardRef3,
|
|
24
|
+
useEffect as useEffect6,
|
|
25
|
+
useImperativeHandle as useImperativeHandle2,
|
|
26
|
+
useMemo as useMemo4,
|
|
27
|
+
useRef as useRef7,
|
|
28
|
+
useState as useState4
|
|
29
|
+
} from "react";
|
|
30
|
+
|
|
31
|
+
// src/canvas/animator.ts
|
|
32
|
+
var DEFAULT_LAYOUT_DURATION_MS = 200;
|
|
33
|
+
var DEFAULT_FADE_DURATION_MS = 120;
|
|
34
|
+
var ease = (t) => t * t * (3 - 2 * t);
|
|
35
|
+
var LayoutAnimator = class {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.rowHeights = /* @__PURE__ */ new Map();
|
|
38
|
+
this.eventTops = /* @__PURE__ */ new Map();
|
|
39
|
+
this.handleAlphas = /* @__PURE__ */ new Map();
|
|
40
|
+
this.now = 0;
|
|
41
|
+
this.activeUntil = 0;
|
|
42
|
+
this.layoutDuration = DEFAULT_LAYOUT_DURATION_MS;
|
|
43
|
+
this.fadeDuration = DEFAULT_FADE_DURATION_MS;
|
|
44
|
+
}
|
|
45
|
+
setDurations(layoutMs, fadeMs) {
|
|
46
|
+
this.layoutDuration = layoutMs;
|
|
47
|
+
this.fadeDuration = fadeMs;
|
|
48
|
+
}
|
|
49
|
+
beginFrame(now) {
|
|
50
|
+
this.now = now;
|
|
51
|
+
}
|
|
52
|
+
rowHeight(rowId, target) {
|
|
53
|
+
return this.value(this.rowHeights, rowId, target, this.layoutDuration);
|
|
54
|
+
}
|
|
55
|
+
eventTop(eventId, target) {
|
|
56
|
+
return this.value(this.eventTops, eventId, target, this.layoutDuration);
|
|
57
|
+
}
|
|
58
|
+
/** 0..1 opacity of an event's resize handles; target 1 = hovered. */
|
|
59
|
+
handleAlpha(eventId, target) {
|
|
60
|
+
return this.value(this.handleAlphas, eventId, target, this.fadeDuration);
|
|
61
|
+
}
|
|
62
|
+
isAnimating() {
|
|
63
|
+
return this.now < this.activeUntil;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Drop an event's top tween so its next draw renders at the target
|
|
67
|
+
* instantly — used on drag-drop commit, where the ghost already previewed
|
|
68
|
+
* the final position and a tween would feel like a rubber-band.
|
|
69
|
+
*/
|
|
70
|
+
snapEventTop(eventId) {
|
|
71
|
+
this.eventTops.delete(eventId);
|
|
72
|
+
}
|
|
73
|
+
/** Drop all state, e.g. when the scene is reset wholesale. */
|
|
74
|
+
reset() {
|
|
75
|
+
this.rowHeights.clear();
|
|
76
|
+
this.eventTops.clear();
|
|
77
|
+
this.handleAlphas.clear();
|
|
78
|
+
this.activeUntil = 0;
|
|
79
|
+
}
|
|
80
|
+
value(map, key, target, duration) {
|
|
81
|
+
let tween = map.get(key);
|
|
82
|
+
if (!tween) {
|
|
83
|
+
tween = { from: target, to: target, start: 0, duration };
|
|
84
|
+
map.set(key, tween);
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
if (tween.to !== target) {
|
|
88
|
+
if (duration <= 0) {
|
|
89
|
+
tween.from = target;
|
|
90
|
+
tween.to = target;
|
|
91
|
+
return target;
|
|
92
|
+
}
|
|
93
|
+
const current = this.current(tween);
|
|
94
|
+
tween.from = current;
|
|
95
|
+
tween.to = target;
|
|
96
|
+
tween.start = this.now;
|
|
97
|
+
tween.duration = duration;
|
|
98
|
+
this.activeUntil = Math.max(this.activeUntil, this.now + duration);
|
|
99
|
+
}
|
|
100
|
+
return this.current(tween);
|
|
101
|
+
}
|
|
102
|
+
current(tween) {
|
|
103
|
+
if (tween.from === tween.to || tween.duration <= 0) return tween.to;
|
|
104
|
+
const t = Math.min(1, (this.now - tween.start) / tween.duration);
|
|
105
|
+
return tween.from + (tween.to - tween.from) * ease(t);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/hooks/use-resize-observer.ts
|
|
110
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
111
|
+
var useResizeObserver = ({
|
|
112
|
+
windowTime,
|
|
113
|
+
setTick,
|
|
114
|
+
setCellWidth,
|
|
115
|
+
contentRef
|
|
116
|
+
}) => {
|
|
117
|
+
const prevWidthRef = useRef(0);
|
|
118
|
+
const resizeObserver = useMemo(() => {
|
|
119
|
+
return new ResizeObserver((entries) => {
|
|
120
|
+
var _a;
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
const width = (_a = entry.borderBoxSize) == null ? void 0 : _a[0].inlineSize;
|
|
123
|
+
if (typeof width === "number" && width !== prevWidthRef.current) {
|
|
124
|
+
prevWidthRef.current = width;
|
|
125
|
+
const windowDuration = windowTime[1] - windowTime[0];
|
|
126
|
+
const numberOfHourBlocks = windowDuration / 3600;
|
|
127
|
+
setTick(windowDuration / entry.contentRect.width);
|
|
128
|
+
setCellWidth(entry.contentRect.width / numberOfHourBlocks);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}, [windowTime]);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (contentRef.current) {
|
|
135
|
+
resizeObserver.observe(contentRef.current, { box: "border-box" });
|
|
136
|
+
}
|
|
137
|
+
return () => resizeObserver.disconnect();
|
|
138
|
+
}, [resizeObserver]);
|
|
139
|
+
};
|
|
140
|
+
var use_resize_observer_default = useResizeObserver;
|
|
141
|
+
|
|
142
|
+
// src/helpers/sort-events.ts
|
|
143
|
+
var sortEvents = (eventA, eventB) => {
|
|
144
|
+
if (eventA.startTime - eventB.startTime < 0) return -1;
|
|
145
|
+
if (eventA.startTime === eventB.startTime) {
|
|
146
|
+
if (eventA.endTime < eventB.endTime) {
|
|
147
|
+
return -1;
|
|
148
|
+
} else {
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var sort_events_default = sortEvents;
|
|
156
|
+
|
|
157
|
+
// src/components/rt-indicator.tsx
|
|
158
|
+
import React, { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
159
|
+
var RTIndicator = ({
|
|
160
|
+
tick,
|
|
161
|
+
windowTime
|
|
162
|
+
}) => {
|
|
163
|
+
const [currentTime, setCurrentTime] = useState((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
164
|
+
const [leftOffset, setLeftOffset] = useState(0);
|
|
165
|
+
const intervalIdRef = useRef2(null);
|
|
166
|
+
useEffect2(() => {
|
|
167
|
+
if (tick) {
|
|
168
|
+
const leftOffsetTime = currentTime - windowTime[0];
|
|
169
|
+
setLeftOffset(Math.round(leftOffsetTime / tick));
|
|
170
|
+
if (intervalIdRef.current !== null) {
|
|
171
|
+
clearInterval(intervalIdRef.current);
|
|
172
|
+
}
|
|
173
|
+
const intervalId = setInterval(() => {
|
|
174
|
+
setCurrentTime((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
175
|
+
}, tick * 1e3);
|
|
176
|
+
intervalIdRef.current = intervalId;
|
|
177
|
+
}
|
|
178
|
+
}, [tick, windowTime, currentTime]);
|
|
179
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, windowTime[0] <= currentTime && currentTime <= windowTime[1] && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "rt-arrow", style: { left: 86 + leftOffset } }), /* @__PURE__ */ React.createElement("div", { className: "rt-line", style: { left: 100 + leftOffset } })));
|
|
180
|
+
};
|
|
181
|
+
var rt_indicator_default = RTIndicator;
|
|
182
|
+
|
|
183
|
+
// src/components/event-prompt.tsx
|
|
184
|
+
import React2, {
|
|
185
|
+
forwardRef,
|
|
186
|
+
useImperativeHandle,
|
|
187
|
+
useRef as useRef3,
|
|
188
|
+
useState as useState2
|
|
189
|
+
} from "react";
|
|
190
|
+
import { computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
191
|
+
var EventPrompt = forwardRef(
|
|
192
|
+
({ template }, ref) => {
|
|
193
|
+
const promptRef = useRef3(null);
|
|
194
|
+
const [hoveredEvent, setHoveredEvent] = useState2();
|
|
195
|
+
const showSeqRef = useRef3(0);
|
|
196
|
+
useImperativeHandle(ref, () => {
|
|
197
|
+
return {
|
|
198
|
+
show(event, anchorRect) {
|
|
199
|
+
const prompt = promptRef.current;
|
|
200
|
+
if (!prompt) return;
|
|
201
|
+
setHoveredEvent(event);
|
|
202
|
+
const seq = ++showSeqRef.current;
|
|
203
|
+
const virtualAnchor = {
|
|
204
|
+
getBoundingClientRect: () => ({
|
|
205
|
+
x: anchorRect.x,
|
|
206
|
+
y: anchorRect.y,
|
|
207
|
+
width: anchorRect.width,
|
|
208
|
+
height: anchorRect.height,
|
|
209
|
+
top: anchorRect.y,
|
|
210
|
+
left: anchorRect.x,
|
|
211
|
+
right: anchorRect.x + anchorRect.width,
|
|
212
|
+
bottom: anchorRect.y + anchorRect.height
|
|
213
|
+
})
|
|
214
|
+
};
|
|
215
|
+
prompt.style.display = "block";
|
|
216
|
+
prompt.style.visibility = "hidden";
|
|
217
|
+
computePosition(virtualAnchor, prompt, {
|
|
218
|
+
placement: "top",
|
|
219
|
+
middleware: [
|
|
220
|
+
offset(8),
|
|
221
|
+
flip({ padding: 8 }),
|
|
222
|
+
shift({ padding: 8 })
|
|
223
|
+
]
|
|
224
|
+
}).then(({ x, y }) => {
|
|
225
|
+
if (seq !== showSeqRef.current || !promptRef.current) return;
|
|
226
|
+
promptRef.current.style.left = `${x}px`;
|
|
227
|
+
promptRef.current.style.top = `${y}px`;
|
|
228
|
+
promptRef.current.style.visibility = "visible";
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
hide() {
|
|
232
|
+
showSeqRef.current++;
|
|
233
|
+
if (promptRef.current) {
|
|
234
|
+
promptRef.current.style.display = "none";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
return /* @__PURE__ */ React2.createElement("div", { className: "event-prompt", ref: promptRef }, template && hoveredEvent && template(hoveredEvent));
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
var event_prompt_default = EventPrompt;
|
|
243
|
+
|
|
244
|
+
// src/components/canvas-time-bar.tsx
|
|
245
|
+
import React3, { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
246
|
+
|
|
247
|
+
// src/hooks/use-get-block-properties.ts
|
|
248
|
+
import { useMemo as useMemo2 } from "react";
|
|
249
|
+
var useGetBlockProperties = ({
|
|
250
|
+
windowTime,
|
|
251
|
+
contentWidth
|
|
252
|
+
}) => {
|
|
253
|
+
const numberOfHourBlocks = useMemo2(
|
|
254
|
+
() => (windowTime[1] - windowTime[0]) / 3600,
|
|
255
|
+
[windowTime]
|
|
256
|
+
);
|
|
257
|
+
const blockWidth = contentWidth ? contentWidth / numberOfHourBlocks : 0;
|
|
258
|
+
return { numberOfHourBlocks, blockWidth };
|
|
259
|
+
};
|
|
260
|
+
var use_get_block_properties_default = useGetBlockProperties;
|
|
261
|
+
|
|
262
|
+
// src/helpers/get-month-name.ts
|
|
263
|
+
var getMonthName = (monthIndex) => {
|
|
264
|
+
let monthName = null;
|
|
265
|
+
switch (monthIndex) {
|
|
266
|
+
case 0:
|
|
267
|
+
monthName = "Jan";
|
|
268
|
+
break;
|
|
269
|
+
case 1:
|
|
270
|
+
monthName = "Feb";
|
|
271
|
+
break;
|
|
272
|
+
case 2:
|
|
273
|
+
monthName = "Mar";
|
|
274
|
+
break;
|
|
275
|
+
case 3:
|
|
276
|
+
monthName = "Apr";
|
|
277
|
+
break;
|
|
278
|
+
case 4:
|
|
279
|
+
monthName = "May";
|
|
280
|
+
break;
|
|
281
|
+
case 5:
|
|
282
|
+
monthName = "Jun";
|
|
283
|
+
break;
|
|
284
|
+
case 6:
|
|
285
|
+
monthName = "Jul";
|
|
286
|
+
break;
|
|
287
|
+
case 7:
|
|
288
|
+
monthName = "Aug";
|
|
289
|
+
break;
|
|
290
|
+
case 8:
|
|
291
|
+
monthName = "Sep";
|
|
292
|
+
break;
|
|
293
|
+
case 9:
|
|
294
|
+
monthName = "Oct";
|
|
295
|
+
break;
|
|
296
|
+
case 10:
|
|
297
|
+
monthName = "Nov";
|
|
298
|
+
break;
|
|
299
|
+
case 11:
|
|
300
|
+
monthName = "Dec";
|
|
301
|
+
break;
|
|
302
|
+
default:
|
|
303
|
+
monthName = "Jan";
|
|
304
|
+
}
|
|
305
|
+
return monthName;
|
|
306
|
+
};
|
|
307
|
+
var get_month_name_default = getMonthName;
|
|
308
|
+
|
|
309
|
+
// src/helpers/get-week-day-name.ts
|
|
310
|
+
var getWeekDayName = (dayIndex) => {
|
|
311
|
+
let dayName = null;
|
|
312
|
+
switch (dayIndex) {
|
|
313
|
+
case 0:
|
|
314
|
+
dayName = "Mon";
|
|
315
|
+
break;
|
|
316
|
+
case 1:
|
|
317
|
+
dayName = "Tue";
|
|
318
|
+
break;
|
|
319
|
+
case 2:
|
|
320
|
+
dayName = "Wed";
|
|
321
|
+
break;
|
|
322
|
+
case 3:
|
|
323
|
+
dayName = "Thu";
|
|
324
|
+
break;
|
|
325
|
+
case 4:
|
|
326
|
+
dayName = "Fri";
|
|
327
|
+
break;
|
|
328
|
+
case 5:
|
|
329
|
+
dayName = "Sat";
|
|
330
|
+
break;
|
|
331
|
+
case 6:
|
|
332
|
+
dayName = "Sun";
|
|
333
|
+
break;
|
|
334
|
+
default:
|
|
335
|
+
dayName = "Mon";
|
|
336
|
+
}
|
|
337
|
+
return dayName;
|
|
338
|
+
};
|
|
339
|
+
var get_week_day_name_default = getWeekDayName;
|
|
340
|
+
|
|
341
|
+
// src/core/time-blocks.ts
|
|
342
|
+
var hourLabel = (hour) => hour < 10 ? `0${hour}:00` : `${hour}:00`;
|
|
343
|
+
var dayLabel = (date) => `${get_week_day_name_default(date.getDay())} ${date.getDate()} ${get_month_name_default(
|
|
344
|
+
date.getMonth()
|
|
345
|
+
)}`;
|
|
346
|
+
var generateTimeBlocks = ({
|
|
347
|
+
windowStart,
|
|
348
|
+
tick,
|
|
349
|
+
contentWidth,
|
|
350
|
+
blockWidth
|
|
351
|
+
}) => {
|
|
352
|
+
const dayBlocks = [];
|
|
353
|
+
const hourBlocks = [];
|
|
354
|
+
if (tick === null || contentWidth === null || blockWidth <= 0) {
|
|
355
|
+
return { dayBlocks, hourBlocks };
|
|
356
|
+
}
|
|
357
|
+
let timePoint = windowStart;
|
|
358
|
+
let widthLeft = contentWidth;
|
|
359
|
+
let prevNumBlocks = 1;
|
|
360
|
+
while (1) {
|
|
361
|
+
const datePoint = new Date(timePoint * 1e3);
|
|
362
|
+
const endDatePoint = new Date(
|
|
363
|
+
datePoint.getFullYear(),
|
|
364
|
+
datePoint.getMonth(),
|
|
365
|
+
datePoint.getDate(),
|
|
366
|
+
23,
|
|
367
|
+
59,
|
|
368
|
+
59
|
|
369
|
+
);
|
|
370
|
+
const dateDuration = endDatePoint.getTime() - datePoint.getTime();
|
|
371
|
+
const dateWidth = dateDuration / 1e3 / tick;
|
|
372
|
+
widthLeft -= dateWidth;
|
|
373
|
+
if (Math.round(widthLeft) < 0) {
|
|
374
|
+
const numBlocks2 = Math.round((dateWidth + widthLeft) / blockWidth);
|
|
375
|
+
for (let i = 0; i < numBlocks2; i++) {
|
|
376
|
+
hourBlocks.push({
|
|
377
|
+
label: hourLabel(i),
|
|
378
|
+
x: hourBlocks.length * blockWidth,
|
|
379
|
+
width: blockWidth
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
dayBlocks.push({
|
|
383
|
+
label: dayLabel(datePoint),
|
|
384
|
+
x: (prevNumBlocks - 1) * blockWidth,
|
|
385
|
+
width: numBlocks2 * blockWidth
|
|
386
|
+
});
|
|
387
|
+
prevNumBlocks += numBlocks2;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
const numBlocks = Math.round(dateWidth / blockWidth);
|
|
391
|
+
for (let i = 24 - numBlocks; i < 24; i++) {
|
|
392
|
+
hourBlocks.push({
|
|
393
|
+
label: hourLabel(i),
|
|
394
|
+
x: hourBlocks.length * blockWidth,
|
|
395
|
+
width: blockWidth
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
dayBlocks.push({
|
|
399
|
+
label: dayLabel(datePoint),
|
|
400
|
+
x: (prevNumBlocks - 1) * blockWidth,
|
|
401
|
+
width: numBlocks * blockWidth
|
|
402
|
+
});
|
|
403
|
+
prevNumBlocks += numBlocks;
|
|
404
|
+
if (Math.round(widthLeft) === 0) {
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
timePoint = (endDatePoint.getTime() + 1e3) / 1e3;
|
|
408
|
+
}
|
|
409
|
+
return { dayBlocks, hourBlocks };
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/canvas/dpr.ts
|
|
413
|
+
var sizeCanvas = (canvas, cssWidth, cssHeight, dpr) => {
|
|
414
|
+
canvas.width = Math.max(1, Math.round(cssWidth * dpr));
|
|
415
|
+
canvas.height = Math.max(1, Math.round(cssHeight * dpr));
|
|
416
|
+
canvas.style.width = `${cssWidth}px`;
|
|
417
|
+
canvas.style.height = `${cssHeight}px`;
|
|
418
|
+
const ctx = canvas.getContext("2d");
|
|
419
|
+
if (ctx) {
|
|
420
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
421
|
+
}
|
|
422
|
+
return ctx;
|
|
423
|
+
};
|
|
424
|
+
var watchDpr = (onChange) => {
|
|
425
|
+
let disposed = false;
|
|
426
|
+
let cleanup = () => {
|
|
427
|
+
};
|
|
428
|
+
const listen = () => {
|
|
429
|
+
if (disposed) return;
|
|
430
|
+
const media = window.matchMedia(
|
|
431
|
+
`(resolution: ${window.devicePixelRatio}dppx)`
|
|
432
|
+
);
|
|
433
|
+
const handler = () => {
|
|
434
|
+
onChange(window.devicePixelRatio);
|
|
435
|
+
media.removeEventListener("change", handler);
|
|
436
|
+
listen();
|
|
437
|
+
};
|
|
438
|
+
media.addEventListener("change", handler);
|
|
439
|
+
cleanup = () => media.removeEventListener("change", handler);
|
|
440
|
+
};
|
|
441
|
+
listen();
|
|
442
|
+
return () => {
|
|
443
|
+
disposed = true;
|
|
444
|
+
cleanup();
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
// src/canvas/theme.ts
|
|
449
|
+
var DEFAULT_THEME = {
|
|
450
|
+
eventFill: "#ffffff",
|
|
451
|
+
eventStroke: "#000000",
|
|
452
|
+
eventTextColor: "#000000",
|
|
453
|
+
staticEventFill: "#e0e0e0",
|
|
454
|
+
gridColor: "#e4dcdc",
|
|
455
|
+
timeBarBorder: "yellow",
|
|
456
|
+
timeBarTextColor: "white",
|
|
457
|
+
font: void 0
|
|
458
|
+
};
|
|
459
|
+
var resolveTheme = (theme) => __spreadValues(__spreadValues({}, DEFAULT_THEME), theme);
|
|
460
|
+
|
|
461
|
+
// src/canvas/draw-grid.ts
|
|
462
|
+
var drawGridLines = (ctx, {
|
|
463
|
+
width,
|
|
464
|
+
height,
|
|
465
|
+
cellWidth,
|
|
466
|
+
color = DEFAULT_THEME.gridColor
|
|
467
|
+
}) => {
|
|
468
|
+
if (cellWidth <= 0) return;
|
|
469
|
+
ctx.strokeStyle = color;
|
|
470
|
+
ctx.lineWidth = 1;
|
|
471
|
+
ctx.beginPath();
|
|
472
|
+
for (let x = cellWidth; x < width; x += cellWidth) {
|
|
473
|
+
if (width - x < 1) break;
|
|
474
|
+
const crisp = Math.round(x) - 0.5;
|
|
475
|
+
ctx.moveTo(crisp, 0);
|
|
476
|
+
ctx.lineTo(crisp, height);
|
|
477
|
+
}
|
|
478
|
+
ctx.stroke();
|
|
479
|
+
};
|
|
480
|
+
var drawTimeBar = (ctx, {
|
|
481
|
+
width,
|
|
482
|
+
height,
|
|
483
|
+
dayBlocks,
|
|
484
|
+
hourBlocks,
|
|
485
|
+
font,
|
|
486
|
+
borderColor = DEFAULT_THEME.timeBarBorder,
|
|
487
|
+
textColor = DEFAULT_THEME.timeBarTextColor
|
|
488
|
+
}) => {
|
|
489
|
+
const mid = height / 2;
|
|
490
|
+
ctx.strokeStyle = borderColor;
|
|
491
|
+
ctx.lineWidth = 1;
|
|
492
|
+
ctx.beginPath();
|
|
493
|
+
ctx.moveTo(0, Math.round(mid) - 0.5);
|
|
494
|
+
ctx.lineTo(width, Math.round(mid) - 0.5);
|
|
495
|
+
ctx.stroke();
|
|
496
|
+
ctx.beginPath();
|
|
497
|
+
for (let i = 0; i < dayBlocks.length - 1; i++) {
|
|
498
|
+
const edge = Math.round(dayBlocks[i].x + dayBlocks[i].width) - 0.5;
|
|
499
|
+
ctx.moveTo(edge, 0);
|
|
500
|
+
ctx.lineTo(edge, mid);
|
|
501
|
+
}
|
|
502
|
+
for (let i = 0; i < hourBlocks.length - 1; i++) {
|
|
503
|
+
const edge = Math.round(hourBlocks[i].x + hourBlocks[i].width) - 0.5;
|
|
504
|
+
ctx.moveTo(edge, mid);
|
|
505
|
+
ctx.lineTo(edge, height);
|
|
506
|
+
}
|
|
507
|
+
ctx.stroke();
|
|
508
|
+
ctx.fillStyle = textColor;
|
|
509
|
+
ctx.font = font;
|
|
510
|
+
ctx.textBaseline = "middle";
|
|
511
|
+
ctx.textAlign = "center";
|
|
512
|
+
const inset = 4;
|
|
513
|
+
for (const block of dayBlocks) {
|
|
514
|
+
ctx.fillText(
|
|
515
|
+
block.label,
|
|
516
|
+
block.x + block.width / 2,
|
|
517
|
+
mid / 2,
|
|
518
|
+
block.width - inset
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
for (const block of hourBlocks) {
|
|
522
|
+
ctx.fillText(
|
|
523
|
+
block.label,
|
|
524
|
+
block.x + block.width / 2,
|
|
525
|
+
mid + mid / 2,
|
|
526
|
+
block.width - inset
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
// src/components/canvas-time-bar.tsx
|
|
532
|
+
var TIME_BAR_INNER_HEIGHT = 48;
|
|
533
|
+
var CanvasTimeBar = ({
|
|
534
|
+
windowTime,
|
|
535
|
+
tick,
|
|
536
|
+
contentWidth,
|
|
537
|
+
scrollWidth,
|
|
538
|
+
theme
|
|
539
|
+
}) => {
|
|
540
|
+
const canvasRef = useRef4(null);
|
|
541
|
+
const { blockWidth } = use_get_block_properties_default({
|
|
542
|
+
windowTime,
|
|
543
|
+
contentWidth
|
|
544
|
+
});
|
|
545
|
+
useEffect3(() => {
|
|
546
|
+
var _a;
|
|
547
|
+
const canvas = canvasRef.current;
|
|
548
|
+
if (!canvas || !contentWidth) return;
|
|
549
|
+
const ctx = sizeCanvas(
|
|
550
|
+
canvas,
|
|
551
|
+
contentWidth,
|
|
552
|
+
TIME_BAR_INNER_HEIGHT,
|
|
553
|
+
window.devicePixelRatio
|
|
554
|
+
);
|
|
555
|
+
if (ctx) {
|
|
556
|
+
drawTimeBar(ctx, __spreadValues({
|
|
557
|
+
width: contentWidth,
|
|
558
|
+
height: TIME_BAR_INNER_HEIGHT,
|
|
559
|
+
font: (_a = theme == null ? void 0 : theme.font) != null ? _a : getComputedStyle(canvas).font,
|
|
560
|
+
borderColor: theme == null ? void 0 : theme.timeBarBorder,
|
|
561
|
+
textColor: theme == null ? void 0 : theme.timeBarTextColor
|
|
562
|
+
}, generateTimeBlocks({
|
|
563
|
+
windowStart: windowTime[0],
|
|
564
|
+
tick,
|
|
565
|
+
contentWidth,
|
|
566
|
+
blockWidth
|
|
567
|
+
})));
|
|
568
|
+
}
|
|
569
|
+
}, [windowTime, tick, contentWidth, blockWidth, theme]);
|
|
570
|
+
return /* @__PURE__ */ React3.createElement("div", { className: "time-bar" }, /* @__PURE__ */ React3.createElement("div", { className: "empty-block" }), /* @__PURE__ */ React3.createElement(
|
|
571
|
+
"canvas",
|
|
572
|
+
{
|
|
573
|
+
ref: canvasRef,
|
|
574
|
+
className: "canvas-time-bar",
|
|
575
|
+
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
576
|
+
}
|
|
577
|
+
), scrollWidth ? /* @__PURE__ */ React3.createElement(
|
|
578
|
+
"div",
|
|
579
|
+
{
|
|
580
|
+
style: {
|
|
581
|
+
width: scrollWidth,
|
|
582
|
+
height: "100%",
|
|
583
|
+
boxSizing: "border-box",
|
|
584
|
+
borderLeft: "1px solid yellow"
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
) : null);
|
|
588
|
+
};
|
|
589
|
+
var canvas_time_bar_default = CanvasTimeBar;
|
|
590
|
+
|
|
591
|
+
// src/components/canvas-board.tsx
|
|
592
|
+
import React5, {
|
|
593
|
+
forwardRef as forwardRef2,
|
|
594
|
+
useCallback as useCallback2,
|
|
595
|
+
useEffect as useEffect5,
|
|
596
|
+
useRef as useRef6,
|
|
597
|
+
useState as useState3,
|
|
598
|
+
useSyncExternalStore
|
|
599
|
+
} from "react";
|
|
600
|
+
|
|
601
|
+
// src/canvas/frame-scheduler.ts
|
|
602
|
+
var FrameScheduler = class {
|
|
603
|
+
constructor(onFrame) {
|
|
604
|
+
this.onFrame = onFrame;
|
|
605
|
+
this.rafId = null;
|
|
606
|
+
this.dirty = { static: false, dynamic: false };
|
|
607
|
+
}
|
|
608
|
+
invalidate(layer) {
|
|
609
|
+
if (layer === "all" || layer === "static") this.dirty.static = true;
|
|
610
|
+
if (layer === "all" || layer === "dynamic") this.dirty.dynamic = true;
|
|
611
|
+
this.schedule();
|
|
612
|
+
}
|
|
613
|
+
/** Runs a pending frame immediately (tests, synchronous reads). */
|
|
614
|
+
flush() {
|
|
615
|
+
if (this.rafId !== null) {
|
|
616
|
+
cancelAnimationFrame(this.rafId);
|
|
617
|
+
this.rafId = null;
|
|
618
|
+
this.run();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
dispose() {
|
|
622
|
+
if (this.rafId !== null) {
|
|
623
|
+
cancelAnimationFrame(this.rafId);
|
|
624
|
+
this.rafId = null;
|
|
625
|
+
}
|
|
626
|
+
this.dirty = { static: false, dynamic: false };
|
|
627
|
+
}
|
|
628
|
+
schedule() {
|
|
629
|
+
if (this.rafId !== null) return;
|
|
630
|
+
this.rafId = requestAnimationFrame(() => {
|
|
631
|
+
this.rafId = null;
|
|
632
|
+
this.run();
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
run() {
|
|
636
|
+
const dirty = this.dirty;
|
|
637
|
+
this.dirty = { static: false, dynamic: false };
|
|
638
|
+
if (dirty.static || dirty.dynamic) this.onFrame(dirty);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// src/core/culling.ts
|
|
643
|
+
var cullToWindow = (events, windowStart, windowEnd) => {
|
|
644
|
+
let lo = 0;
|
|
645
|
+
let hi = events.length;
|
|
646
|
+
while (lo < hi) {
|
|
647
|
+
const mid = lo + hi >> 1;
|
|
648
|
+
if (events[mid].startTime <= windowEnd) {
|
|
649
|
+
lo = mid + 1;
|
|
650
|
+
} else {
|
|
651
|
+
hi = mid;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
const visible = [];
|
|
655
|
+
for (let i = 0; i < lo; i++) {
|
|
656
|
+
if (events[i].endTime >= windowStart) visible.push(events[i]);
|
|
657
|
+
}
|
|
658
|
+
return visible;
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// src/core/coords.ts
|
|
662
|
+
var timeToX = (time, windowStart, tick) => (time - windowStart) / tick;
|
|
663
|
+
var timeToWidth = (startTime, endTime, tick) => (endTime - startTime) / tick;
|
|
664
|
+
var intersectsWindow = (event, windowStart, windowEnd) => event.endTime >= windowStart && event.startTime <= windowEnd;
|
|
665
|
+
|
|
666
|
+
// src/core/lanes.ts
|
|
667
|
+
var LANE_HEIGHT = 22;
|
|
668
|
+
var LANE_TOP_OFFSET = 10;
|
|
669
|
+
var ROW_BASE_HEIGHT = 40;
|
|
670
|
+
var STATIC_EVENT_BASE_HEIGHT = 20;
|
|
671
|
+
var EVENT_BAR_HEIGHT = 20;
|
|
672
|
+
var laneTop = (lane) => LANE_TOP_OFFSET + LANE_HEIGHT * lane;
|
|
673
|
+
var rowMinHeight = (highestLane) => ROW_BASE_HEIGHT + highestLane * LANE_HEIGHT;
|
|
674
|
+
var staticEventHeight = (highestLane) => STATIC_EVENT_BASE_HEIGHT + highestLane * LANE_HEIGHT;
|
|
675
|
+
var assignLanes = (rowEvents, windowStart, windowEnd) => {
|
|
676
|
+
let eventOrder = 0;
|
|
677
|
+
const prevEvent = [];
|
|
678
|
+
let highestEventOrder = 0;
|
|
679
|
+
const laneOf = /* @__PURE__ */ new Map();
|
|
680
|
+
for (const event of rowEvents) {
|
|
681
|
+
if (!intersectsWindow(event, windowStart, windowEnd)) continue;
|
|
682
|
+
let tempEventOrder = 0;
|
|
683
|
+
let assignEventOrder = true;
|
|
684
|
+
for (let i = 0; i <= eventOrder; i++) {
|
|
685
|
+
if (prevEvent[i] && prevEvent[i].endTime > event.startTime) {
|
|
686
|
+
tempEventOrder += 1;
|
|
687
|
+
} else {
|
|
688
|
+
if (eventOrder > highestEventOrder) {
|
|
689
|
+
highestEventOrder = eventOrder;
|
|
690
|
+
}
|
|
691
|
+
eventOrder = 0;
|
|
692
|
+
assignEventOrder = false;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (assignEventOrder) {
|
|
697
|
+
eventOrder = tempEventOrder;
|
|
698
|
+
}
|
|
699
|
+
prevEvent[tempEventOrder] = event;
|
|
700
|
+
laneOf.set(event.id, tempEventOrder);
|
|
701
|
+
}
|
|
702
|
+
if (eventOrder > highestEventOrder) {
|
|
703
|
+
highestEventOrder = eventOrder;
|
|
704
|
+
}
|
|
705
|
+
return { laneOf, highestLane: highestEventOrder };
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
// src/core/interactions.ts
|
|
709
|
+
var computeDropTimes = ({
|
|
710
|
+
pointerX,
|
|
711
|
+
cellWidth,
|
|
712
|
+
tick,
|
|
713
|
+
windowStart,
|
|
714
|
+
duration
|
|
715
|
+
}) => {
|
|
716
|
+
const closestCell = Math.round(pointerX / cellWidth);
|
|
717
|
+
const newPosition = cellWidth * closestCell;
|
|
718
|
+
const startTime = windowStart + newPosition * tick;
|
|
719
|
+
return { startTime, endTime: startTime + duration };
|
|
720
|
+
};
|
|
721
|
+
var computeResizeTimes = (event, deltaPx, tick, direction) => {
|
|
722
|
+
if (direction === "left") {
|
|
723
|
+
const startTime = Math.round(event.startTime + deltaPx * tick);
|
|
724
|
+
if (event.endTime - startTime > 0) {
|
|
725
|
+
return { startTime, endTime: event.endTime };
|
|
726
|
+
}
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
const endTime = Math.round(event.endTime + deltaPx * tick);
|
|
730
|
+
if (endTime - event.startTime > 0) {
|
|
731
|
+
return { startTime: event.startTime, endTime };
|
|
732
|
+
}
|
|
733
|
+
return null;
|
|
734
|
+
};
|
|
735
|
+
var canResizeEvent = (event, eventsResize) => {
|
|
736
|
+
var _a, _b, _c, _d;
|
|
737
|
+
return !((_a = event.props) == null ? void 0 : _a.isLocked) && (eventsResize && (((_b = event.props) == null ? void 0 : _b.isResizable) === true || ((_c = event.props) == null ? void 0 : _c.isResizable) === void 0) || !eventsResize && ((_d = event.props) == null ? void 0 : _d.isResizable) === true);
|
|
738
|
+
};
|
|
739
|
+
var stepCellWidth = (cellWidth, deltaY, tick) => {
|
|
740
|
+
const pixelsToCalculate = 900 / tick;
|
|
741
|
+
const next = deltaY > 0 ? cellWidth + pixelsToCalculate : cellWidth - pixelsToCalculate;
|
|
742
|
+
if (next < pixelsToCalculate || next > pixelsToCalculate * 12) {
|
|
743
|
+
return cellWidth;
|
|
744
|
+
}
|
|
745
|
+
return next;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
// src/canvas/draw-events.ts
|
|
749
|
+
var EVENT_RADIUS = 5;
|
|
750
|
+
var EVENT_TEXT_INSET = 13;
|
|
751
|
+
var HANDLE_INSET = 4;
|
|
752
|
+
var HANDLE_BAR_WIDTH = 3;
|
|
753
|
+
var HANDLE_BAR_GAP = 1;
|
|
754
|
+
var HANDLE_BAR_HEIGHT = 10;
|
|
755
|
+
var roundedRect = (ctx, x, y, width, height, radius) => {
|
|
756
|
+
const r = Math.min(radius, width / 2, height / 2);
|
|
757
|
+
ctx.beginPath();
|
|
758
|
+
if (typeof ctx.roundRect === "function") {
|
|
759
|
+
ctx.roundRect(x, y, width, height, r);
|
|
760
|
+
} else {
|
|
761
|
+
ctx.moveTo(x + r, y);
|
|
762
|
+
ctx.arcTo(x + width, y, x + width, y + height, r);
|
|
763
|
+
ctx.arcTo(x + width, y + height, x, y + height, r);
|
|
764
|
+
ctx.arcTo(x, y + height, x, y, r);
|
|
765
|
+
ctx.arcTo(x, y, x + width, y, r);
|
|
766
|
+
ctx.closePath();
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
var drawRowDividers = (ctx, view, scene, animator) => {
|
|
770
|
+
const [windowStart, windowEnd] = view.windowTime;
|
|
771
|
+
const rowIds = scene.getRowIds();
|
|
772
|
+
ctx.strokeStyle = view.theme.gridColor;
|
|
773
|
+
ctx.lineWidth = 1;
|
|
774
|
+
ctx.beginPath();
|
|
775
|
+
let y = 0;
|
|
776
|
+
for (let i = 0; i < rowIds.length; i++) {
|
|
777
|
+
y += animator.rowHeight(
|
|
778
|
+
rowIds[i],
|
|
779
|
+
scene.getRowHeight(rowIds[i], windowStart, windowEnd)
|
|
780
|
+
);
|
|
781
|
+
if (i === rowIds.length - 1) break;
|
|
782
|
+
const screenY = y - view.scrollTop;
|
|
783
|
+
if (screenY < 0) continue;
|
|
784
|
+
if (screenY > view.height) break;
|
|
785
|
+
const crisp = Math.round(screenY) - 0.5;
|
|
786
|
+
ctx.moveTo(0, crisp);
|
|
787
|
+
ctx.lineTo(view.width, crisp);
|
|
788
|
+
}
|
|
789
|
+
ctx.stroke();
|
|
790
|
+
};
|
|
791
|
+
var drawResizeHandles = (ctx, rect, alpha, strokeColor) => {
|
|
792
|
+
ctx.save();
|
|
793
|
+
ctx.globalAlpha *= alpha;
|
|
794
|
+
ctx.strokeStyle = strokeColor;
|
|
795
|
+
ctx.lineWidth = 1;
|
|
796
|
+
const barY = rect.y + (rect.height - HANDLE_BAR_HEIGHT) / 2;
|
|
797
|
+
const xs = [
|
|
798
|
+
rect.x + HANDLE_INSET,
|
|
799
|
+
rect.x + HANDLE_INSET + HANDLE_BAR_WIDTH + HANDLE_BAR_GAP,
|
|
800
|
+
rect.x + rect.width - HANDLE_INSET - HANDLE_BAR_WIDTH,
|
|
801
|
+
rect.x + rect.width - HANDLE_INSET - HANDLE_BAR_WIDTH * 2 - HANDLE_BAR_GAP
|
|
802
|
+
];
|
|
803
|
+
for (const barX of xs) {
|
|
804
|
+
ctx.beginPath();
|
|
805
|
+
if (typeof ctx.roundRect === "function") {
|
|
806
|
+
ctx.roundRect(
|
|
807
|
+
barX + 0.5,
|
|
808
|
+
barY + 0.5,
|
|
809
|
+
HANDLE_BAR_WIDTH - 1,
|
|
810
|
+
HANDLE_BAR_HEIGHT - 1,
|
|
811
|
+
1.5
|
|
812
|
+
);
|
|
813
|
+
} else {
|
|
814
|
+
ctx.rect(barX + 0.5, barY + 0.5, HANDLE_BAR_WIDTH - 1, HANDLE_BAR_HEIGHT - 1);
|
|
815
|
+
}
|
|
816
|
+
ctx.stroke();
|
|
817
|
+
}
|
|
818
|
+
ctx.restore();
|
|
819
|
+
};
|
|
820
|
+
var defaultDrawEvent = (ctx, event, rect, view, font) => {
|
|
821
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
822
|
+
const theme = view.theme;
|
|
823
|
+
const style = (_a = event.props) == null ? void 0 : _a.style;
|
|
824
|
+
if ((style == null ? void 0 : style.opacity) !== void 0) ctx.globalAlpha *= style.opacity;
|
|
825
|
+
ctx.fillStyle = (_b = style == null ? void 0 : style.fill) != null ? _b : theme.eventFill;
|
|
826
|
+
ctx.strokeStyle = (_c = style == null ? void 0 : style.stroke) != null ? _c : theme.eventStroke;
|
|
827
|
+
ctx.lineWidth = (_d = style == null ? void 0 : style.strokeWidth) != null ? _d : 1;
|
|
828
|
+
roundedRect(
|
|
829
|
+
ctx,
|
|
830
|
+
rect.x + 0.5,
|
|
831
|
+
rect.y + 0.5,
|
|
832
|
+
rect.width - 1,
|
|
833
|
+
rect.height - 1,
|
|
834
|
+
(_e = style == null ? void 0 : style.borderRadius) != null ? _e : EVENT_RADIUS
|
|
835
|
+
);
|
|
836
|
+
ctx.fill();
|
|
837
|
+
ctx.stroke();
|
|
838
|
+
const label = (_f = event.props) == null ? void 0 : _f.label;
|
|
839
|
+
if (label && rect.width > EVENT_TEXT_INSET * 2) {
|
|
840
|
+
ctx.fillStyle = (_g = style == null ? void 0 : style.textColor) != null ? _g : theme.eventTextColor;
|
|
841
|
+
ctx.font = (_i = (_h = style == null ? void 0 : style.font) != null ? _h : theme.font) != null ? _i : font;
|
|
842
|
+
ctx.save();
|
|
843
|
+
ctx.beginPath();
|
|
844
|
+
ctx.rect(
|
|
845
|
+
rect.x + EVENT_TEXT_INSET,
|
|
846
|
+
rect.y,
|
|
847
|
+
rect.width - EVENT_TEXT_INSET * 2,
|
|
848
|
+
rect.height
|
|
849
|
+
);
|
|
850
|
+
ctx.clip();
|
|
851
|
+
ctx.fillText(label, rect.x + EVENT_TEXT_INSET, rect.y + rect.height / 2);
|
|
852
|
+
ctx.restore();
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
var drawEvents = (ctx, view, scene, font, animator) => {
|
|
856
|
+
var _a, _b, _c, _d, _e, _f;
|
|
857
|
+
if (view.tick === null) return;
|
|
858
|
+
const [windowStart, windowEnd] = view.windowTime;
|
|
859
|
+
const tick = view.tick;
|
|
860
|
+
ctx.font = (_a = view.theme.font) != null ? _a : font;
|
|
861
|
+
ctx.textBaseline = "middle";
|
|
862
|
+
ctx.textAlign = "left";
|
|
863
|
+
let rowTop = 0;
|
|
864
|
+
for (const rowId of scene.getRowIds()) {
|
|
865
|
+
const rowHeight = animator.rowHeight(
|
|
866
|
+
rowId,
|
|
867
|
+
scene.getRowHeight(rowId, windowStart, windowEnd)
|
|
868
|
+
);
|
|
869
|
+
const rowY = rowTop - view.scrollTop;
|
|
870
|
+
rowTop += rowHeight;
|
|
871
|
+
if (rowY + rowHeight < 0) continue;
|
|
872
|
+
if (rowY > view.height) break;
|
|
873
|
+
const lanes = scene.getLanes(rowId, windowStart, windowEnd);
|
|
874
|
+
for (const event of cullToWindow(
|
|
875
|
+
scene.getRowStaticEvents(rowId),
|
|
876
|
+
windowStart,
|
|
877
|
+
windowEnd
|
|
878
|
+
)) {
|
|
879
|
+
const x = timeToX(event.startTime, windowStart, tick);
|
|
880
|
+
const width = timeToWidth(event.startTime, event.endTime, tick);
|
|
881
|
+
ctx.fillStyle = view.theme.staticEventFill;
|
|
882
|
+
roundedRect(
|
|
883
|
+
ctx,
|
|
884
|
+
x,
|
|
885
|
+
rowY + LANE_TOP_OFFSET,
|
|
886
|
+
width,
|
|
887
|
+
staticEventHeight(lanes.highestLane),
|
|
888
|
+
EVENT_RADIUS
|
|
889
|
+
);
|
|
890
|
+
ctx.fill();
|
|
891
|
+
}
|
|
892
|
+
for (const event of cullToWindow(
|
|
893
|
+
scene.getRowEvents(rowId),
|
|
894
|
+
windowStart,
|
|
895
|
+
windowEnd
|
|
896
|
+
)) {
|
|
897
|
+
let x = timeToX(event.startTime, windowStart, tick);
|
|
898
|
+
let width = timeToWidth(event.startTime, event.endTime, tick);
|
|
899
|
+
const y = rowY + animator.eventTop(
|
|
900
|
+
event.id,
|
|
901
|
+
laneTop(lanes.laneOf.get(event.id))
|
|
902
|
+
);
|
|
903
|
+
const resize = view.resizePreview;
|
|
904
|
+
const resizing = resize !== null && resize.eventId === event.id;
|
|
905
|
+
if (resizing) {
|
|
906
|
+
if (resize.direction === "left") {
|
|
907
|
+
x += resize.deltaPx;
|
|
908
|
+
width -= resize.deltaPx;
|
|
909
|
+
} else {
|
|
910
|
+
width += resize.deltaPx;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
const rect = { x, y, width, height: EVENT_BAR_HEIGHT };
|
|
914
|
+
const state = {
|
|
915
|
+
hovered: view.hoveredEventId === event.id,
|
|
916
|
+
dragging: view.draggedEventId === event.id,
|
|
917
|
+
resizing,
|
|
918
|
+
selected: false
|
|
919
|
+
};
|
|
920
|
+
ctx.save();
|
|
921
|
+
if (state.dragging) ctx.globalAlpha = 0.5;
|
|
922
|
+
const custom = (_c = (_b = event.props) == null ? void 0 : _b.drawEvent) != null ? _c : view.drawEvent;
|
|
923
|
+
const drawn = custom !== void 0 && custom(ctx, event, rect, state, view.theme) !== false;
|
|
924
|
+
if (!drawn) {
|
|
925
|
+
defaultDrawEvent(ctx, event, rect, view, font);
|
|
926
|
+
}
|
|
927
|
+
if (canResizeEvent(event, view.eventsResize)) {
|
|
928
|
+
const alpha = animator.handleAlpha(
|
|
929
|
+
event.id,
|
|
930
|
+
state.hovered || state.resizing ? 1 : 0
|
|
931
|
+
);
|
|
932
|
+
if (alpha > 0.01) {
|
|
933
|
+
drawResizeHandles(
|
|
934
|
+
ctx,
|
|
935
|
+
rect,
|
|
936
|
+
alpha,
|
|
937
|
+
(_f = (_e = (_d = event.props) == null ? void 0 : _d.style) == null ? void 0 : _e.stroke) != null ? _f : view.theme.eventStroke
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
ctx.restore();
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
// src/canvas/renderer.ts
|
|
947
|
+
var TimelineRenderer = class {
|
|
948
|
+
constructor(staticCanvas, dynamicCanvas, scene) {
|
|
949
|
+
this.staticCanvas = staticCanvas;
|
|
950
|
+
this.dynamicCanvas = dynamicCanvas;
|
|
951
|
+
this.scene = scene;
|
|
952
|
+
this.view = {
|
|
953
|
+
windowTime: [0, 0],
|
|
954
|
+
tick: null,
|
|
955
|
+
cellWidth: 0,
|
|
956
|
+
scrollTop: 0,
|
|
957
|
+
width: 0,
|
|
958
|
+
height: 0,
|
|
959
|
+
theme: DEFAULT_THEME,
|
|
960
|
+
drawEvent: void 0,
|
|
961
|
+
eventsResize: true,
|
|
962
|
+
hoveredEventId: null,
|
|
963
|
+
draggedEventId: null,
|
|
964
|
+
resizePreview: null
|
|
965
|
+
};
|
|
966
|
+
this.animator = new LayoutAnimator();
|
|
967
|
+
this.dpr = typeof window !== "undefined" ? window.devicePixelRatio : 1;
|
|
968
|
+
this.font = "16px sans-serif";
|
|
969
|
+
this.scheduler = new FrameScheduler((dirty) => this.drawFrame(dirty));
|
|
970
|
+
this.unsubscribeScene = scene.subscribe(() => this.invalidate("all"));
|
|
971
|
+
this.unwatchDpr = watchDpr((dpr) => {
|
|
972
|
+
this.dpr = dpr;
|
|
973
|
+
this.resizeCanvases();
|
|
974
|
+
this.invalidate("all");
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
getView() {
|
|
978
|
+
return this.view;
|
|
979
|
+
}
|
|
980
|
+
setView(partial) {
|
|
981
|
+
const sizeChanged = partial.width !== void 0 && partial.width !== this.view.width || partial.height !== void 0 && partial.height !== this.view.height;
|
|
982
|
+
this.view = __spreadValues(__spreadValues({}, this.view), partial);
|
|
983
|
+
if (sizeChanged) {
|
|
984
|
+
this.resizeCanvases();
|
|
985
|
+
this.invalidate("all");
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
this.invalidate("all");
|
|
989
|
+
}
|
|
990
|
+
invalidate(layer) {
|
|
991
|
+
this.scheduler.invalidate(layer);
|
|
992
|
+
}
|
|
993
|
+
/** Force a synchronous draw of anything pending (tests, screenshots). */
|
|
994
|
+
flush() {
|
|
995
|
+
this.scheduler.flush();
|
|
996
|
+
}
|
|
997
|
+
dispose() {
|
|
998
|
+
this.scheduler.dispose();
|
|
999
|
+
this.unsubscribeScene();
|
|
1000
|
+
this.unwatchDpr();
|
|
1001
|
+
}
|
|
1002
|
+
resizeCanvases() {
|
|
1003
|
+
sizeCanvas(this.staticCanvas, this.view.width, this.view.height, this.dpr);
|
|
1004
|
+
sizeCanvas(this.dynamicCanvas, this.view.width, this.view.height, this.dpr);
|
|
1005
|
+
if (typeof getComputedStyle === "function") {
|
|
1006
|
+
this.font = getComputedStyle(this.dynamicCanvas).font || this.font;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
drawFrame(dirty) {
|
|
1010
|
+
if (this.view.tick === null) return;
|
|
1011
|
+
this.animator.beginFrame(performance.now());
|
|
1012
|
+
if (dirty.static) {
|
|
1013
|
+
const ctx = this.staticCanvas.getContext("2d");
|
|
1014
|
+
if (ctx) {
|
|
1015
|
+
ctx.clearRect(0, 0, this.view.width, this.view.height);
|
|
1016
|
+
drawGridLines(ctx, {
|
|
1017
|
+
width: this.view.width,
|
|
1018
|
+
height: this.view.height,
|
|
1019
|
+
cellWidth: this.view.cellWidth,
|
|
1020
|
+
color: this.view.theme.gridColor
|
|
1021
|
+
});
|
|
1022
|
+
drawRowDividers(ctx, this.view, this.scene, this.animator);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
if (dirty.dynamic) {
|
|
1026
|
+
const ctx = this.dynamicCanvas.getContext("2d");
|
|
1027
|
+
if (ctx) {
|
|
1028
|
+
ctx.clearRect(0, 0, this.view.width, this.view.height);
|
|
1029
|
+
drawEvents(ctx, this.view, this.scene, this.font, this.animator);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
if (this.animator.isAnimating()) {
|
|
1033
|
+
this.scheduler.invalidate("all");
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
// src/hooks/use-canvas-interactions.ts
|
|
1039
|
+
import { useCallback, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef5 } from "react";
|
|
1040
|
+
|
|
1041
|
+
// src/core/types.ts
|
|
1042
|
+
var rectContains = (rect, x, y) => x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
|
|
1043
|
+
|
|
1044
|
+
// src/core/hit-test.ts
|
|
1045
|
+
var hitTest = (scene, view, x, y) => {
|
|
1046
|
+
const { windowStart, windowEnd, tick, scrollTop } = view;
|
|
1047
|
+
const yContent = y + scrollTop;
|
|
1048
|
+
let rowTop = 0;
|
|
1049
|
+
let rowId = null;
|
|
1050
|
+
for (const id of scene.getRowIds()) {
|
|
1051
|
+
const height = scene.getRowHeight(id, windowStart, windowEnd);
|
|
1052
|
+
if (yContent >= rowTop && yContent < rowTop + height) {
|
|
1053
|
+
rowId = id;
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
rowTop += height;
|
|
1057
|
+
}
|
|
1058
|
+
if (rowId === null) return null;
|
|
1059
|
+
const lanes = scene.getLanes(rowId, windowStart, windowEnd);
|
|
1060
|
+
const rowY = rowTop - scrollTop;
|
|
1061
|
+
const events = cullToWindow(
|
|
1062
|
+
scene.getRowEvents(rowId),
|
|
1063
|
+
windowStart,
|
|
1064
|
+
windowEnd
|
|
1065
|
+
);
|
|
1066
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
1067
|
+
const event = events[i];
|
|
1068
|
+
const rect = {
|
|
1069
|
+
x: timeToX(event.startTime, windowStart, tick),
|
|
1070
|
+
y: rowY + laneTop(lanes.laneOf.get(event.id)),
|
|
1071
|
+
width: timeToWidth(event.startTime, event.endTime, tick),
|
|
1072
|
+
height: EVENT_BAR_HEIGHT
|
|
1073
|
+
};
|
|
1074
|
+
if (rectContains(rect, x, y)) {
|
|
1075
|
+
return { kind: "event", event, rowId, rect };
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
const statics = cullToWindow(
|
|
1079
|
+
scene.getRowStaticEvents(rowId),
|
|
1080
|
+
windowStart,
|
|
1081
|
+
windowEnd
|
|
1082
|
+
);
|
|
1083
|
+
for (let i = statics.length - 1; i >= 0; i--) {
|
|
1084
|
+
const event = statics[i];
|
|
1085
|
+
const rect = {
|
|
1086
|
+
x: timeToX(event.startTime, windowStart, tick),
|
|
1087
|
+
y: rowY + LANE_TOP_OFFSET,
|
|
1088
|
+
width: timeToWidth(event.startTime, event.endTime, tick),
|
|
1089
|
+
height: staticEventHeight(lanes.highestLane)
|
|
1090
|
+
};
|
|
1091
|
+
if (rectContains(rect, x, y)) {
|
|
1092
|
+
return { kind: "static", event, rowId, rect };
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return null;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// src/hooks/use-canvas-interactions.ts
|
|
1099
|
+
var DRAG_THRESHOLD_PX = 3;
|
|
1100
|
+
var RESIZE_HOT_ZONE_PX = 8;
|
|
1101
|
+
var lockCursor = (cursor) => {
|
|
1102
|
+
const style = document.createElement("style");
|
|
1103
|
+
style.id = "lock-cursor";
|
|
1104
|
+
style.innerHTML = `* { cursor: ${cursor} !important; }`;
|
|
1105
|
+
document.head.appendChild(style);
|
|
1106
|
+
};
|
|
1107
|
+
var unlockCursor = () => {
|
|
1108
|
+
var _a;
|
|
1109
|
+
(_a = document.getElementById("lock-cursor")) == null ? void 0 : _a.remove();
|
|
1110
|
+
};
|
|
1111
|
+
var useCanvasInteractions = ({
|
|
1112
|
+
scene,
|
|
1113
|
+
rendererRef,
|
|
1114
|
+
dynamicCanvasRef,
|
|
1115
|
+
bodyRef,
|
|
1116
|
+
ghostRef,
|
|
1117
|
+
eventPromptRef,
|
|
1118
|
+
setWindowTime,
|
|
1119
|
+
setCellWidth,
|
|
1120
|
+
onDrop,
|
|
1121
|
+
onResize,
|
|
1122
|
+
onEventClick,
|
|
1123
|
+
onEventHover,
|
|
1124
|
+
eventsResize,
|
|
1125
|
+
panZoom
|
|
1126
|
+
}) => {
|
|
1127
|
+
const stateRef = useRef5({ mode: "idle" });
|
|
1128
|
+
const changeGridRef = useRef5(false);
|
|
1129
|
+
const panFrameRef = useRef5(null);
|
|
1130
|
+
const panPendingDxRef = useRef5(0);
|
|
1131
|
+
const hoveredRef = useRef5(null);
|
|
1132
|
+
const config = useMemo3(
|
|
1133
|
+
() => {
|
|
1134
|
+
var _a, _b, _c, _d;
|
|
1135
|
+
return {
|
|
1136
|
+
panOnDragBackground: (_a = panZoom == null ? void 0 : panZoom.panOnDragBackground) != null ? _a : true,
|
|
1137
|
+
ctrlWheelZoom: (_b = panZoom == null ? void 0 : panZoom.ctrlWheelZoom) != null ? _b : true,
|
|
1138
|
+
middleClickGranularity: (_c = panZoom == null ? void 0 : panZoom.middleClickGranularity) != null ? _c : true,
|
|
1139
|
+
zoomStepSeconds: (_d = panZoom == null ? void 0 : panZoom.zoomStepSeconds) != null ? _d : 900
|
|
1140
|
+
};
|
|
1141
|
+
},
|
|
1142
|
+
[panZoom]
|
|
1143
|
+
);
|
|
1144
|
+
const hidePrompt = useCallback(() => {
|
|
1145
|
+
var _a;
|
|
1146
|
+
(_a = eventPromptRef.current) == null ? void 0 : _a.hide();
|
|
1147
|
+
}, [eventPromptRef]);
|
|
1148
|
+
const currentHit = useCallback(
|
|
1149
|
+
(clientX, clientY) => {
|
|
1150
|
+
const canvas = dynamicCanvasRef.current;
|
|
1151
|
+
const renderer = rendererRef.current;
|
|
1152
|
+
if (!canvas || !renderer) return null;
|
|
1153
|
+
const view = renderer.getView();
|
|
1154
|
+
if (view.tick === null) return null;
|
|
1155
|
+
const rect = canvas.getBoundingClientRect();
|
|
1156
|
+
return hitTest(
|
|
1157
|
+
scene,
|
|
1158
|
+
{
|
|
1159
|
+
windowStart: view.windowTime[0],
|
|
1160
|
+
windowEnd: view.windowTime[1],
|
|
1161
|
+
tick: view.tick,
|
|
1162
|
+
scrollTop: view.scrollTop
|
|
1163
|
+
},
|
|
1164
|
+
clientX - rect.left,
|
|
1165
|
+
clientY - rect.top
|
|
1166
|
+
);
|
|
1167
|
+
},
|
|
1168
|
+
[scene, dynamicCanvasRef, rendererRef]
|
|
1169
|
+
);
|
|
1170
|
+
const resizeDirectionAt = useCallback(
|
|
1171
|
+
(hit, clientX) => {
|
|
1172
|
+
if (hit.kind !== "event" || !canResizeEvent(hit.event, eventsResize)) {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1175
|
+
const canvas = dynamicCanvasRef.current;
|
|
1176
|
+
if (!canvas) return null;
|
|
1177
|
+
const x = clientX - canvas.getBoundingClientRect().left;
|
|
1178
|
+
const zone = Math.min(RESIZE_HOT_ZONE_PX, hit.rect.width / 3);
|
|
1179
|
+
if (x <= hit.rect.x + zone) return "left";
|
|
1180
|
+
if (x >= hit.rect.x + hit.rect.width - zone) return "right";
|
|
1181
|
+
return null;
|
|
1182
|
+
},
|
|
1183
|
+
[dynamicCanvasRef, eventsResize]
|
|
1184
|
+
);
|
|
1185
|
+
const schedulePan = useCallback(() => {
|
|
1186
|
+
if (panFrameRef.current !== null) return;
|
|
1187
|
+
panFrameRef.current = requestAnimationFrame(() => {
|
|
1188
|
+
panFrameRef.current = null;
|
|
1189
|
+
const renderer = rendererRef.current;
|
|
1190
|
+
const dx = panPendingDxRef.current;
|
|
1191
|
+
panPendingDxRef.current = 0;
|
|
1192
|
+
const tick = renderer == null ? void 0 : renderer.getView().tick;
|
|
1193
|
+
if (!tick || dx === 0) return;
|
|
1194
|
+
const dt = Math.round(dx * tick);
|
|
1195
|
+
if (dt === 0) {
|
|
1196
|
+
panPendingDxRef.current = dx;
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
setWindowTime((prev) => [prev[0] - dt, prev[1] - dt]);
|
|
1200
|
+
});
|
|
1201
|
+
}, [rendererRef, setWindowTime]);
|
|
1202
|
+
const updateGhost = useCallback(
|
|
1203
|
+
(state, clientX, clientY) => {
|
|
1204
|
+
const ghost = ghostRef.current;
|
|
1205
|
+
if (!ghost) return;
|
|
1206
|
+
ghost.style.display = "flex";
|
|
1207
|
+
ghost.style.left = `${state.hit.rect.x + (clientX - state.startClientX)}px`;
|
|
1208
|
+
ghost.style.top = `${state.hit.rect.y + (clientY - state.startClientY)}px`;
|
|
1209
|
+
ghost.style.width = `${state.hit.rect.width}px`;
|
|
1210
|
+
},
|
|
1211
|
+
[ghostRef]
|
|
1212
|
+
);
|
|
1213
|
+
const handlePointerDown = useCallback(
|
|
1214
|
+
(pointerEvent) => {
|
|
1215
|
+
var _a;
|
|
1216
|
+
if (pointerEvent.button !== 0) return;
|
|
1217
|
+
const canvas = dynamicCanvasRef.current;
|
|
1218
|
+
if (!canvas) return;
|
|
1219
|
+
const hit = currentHit(pointerEvent.clientX, pointerEvent.clientY);
|
|
1220
|
+
if ((hit == null ? void 0 : hit.kind) === "event" && !((_a = hit.event.props) == null ? void 0 : _a.isLocked)) {
|
|
1221
|
+
const direction = resizeDirectionAt(hit, pointerEvent.clientX);
|
|
1222
|
+
if (direction) {
|
|
1223
|
+
stateRef.current = {
|
|
1224
|
+
mode: "resize",
|
|
1225
|
+
event: hit.event,
|
|
1226
|
+
direction,
|
|
1227
|
+
startClientX: pointerEvent.clientX,
|
|
1228
|
+
deltaPx: 0
|
|
1229
|
+
};
|
|
1230
|
+
lockCursor("e-resize");
|
|
1231
|
+
} else {
|
|
1232
|
+
stateRef.current = {
|
|
1233
|
+
mode: "drag",
|
|
1234
|
+
hit,
|
|
1235
|
+
startClientX: pointerEvent.clientX,
|
|
1236
|
+
startClientY: pointerEvent.clientY,
|
|
1237
|
+
active: false
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
} else if (config.panOnDragBackground) {
|
|
1241
|
+
stateRef.current = { mode: "pan", lastClientX: pointerEvent.clientX };
|
|
1242
|
+
canvas.style.cursor = "grabbing";
|
|
1243
|
+
} else {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
hidePrompt();
|
|
1247
|
+
canvas.setPointerCapture(pointerEvent.pointerId);
|
|
1248
|
+
},
|
|
1249
|
+
[currentHit, resizeDirectionAt, dynamicCanvasRef, hidePrompt, config]
|
|
1250
|
+
);
|
|
1251
|
+
const handleHover = useCallback(
|
|
1252
|
+
(pointerEvent) => {
|
|
1253
|
+
var _a, _b, _c, _d;
|
|
1254
|
+
const canvas = dynamicCanvasRef.current;
|
|
1255
|
+
if (!canvas) return;
|
|
1256
|
+
const hit = currentHit(pointerEvent.clientX, pointerEvent.clientY);
|
|
1257
|
+
const prevHovered = hoveredRef.current;
|
|
1258
|
+
hoveredRef.current = hit;
|
|
1259
|
+
if ((hit == null ? void 0 : hit.kind) === "event") {
|
|
1260
|
+
if ((_a = hit.event.props) == null ? void 0 : _a.isLocked) {
|
|
1261
|
+
canvas.style.cursor = "not-allowed";
|
|
1262
|
+
} else if (resizeDirectionAt(hit, pointerEvent.clientX)) {
|
|
1263
|
+
canvas.style.cursor = "e-resize";
|
|
1264
|
+
} else {
|
|
1265
|
+
canvas.style.cursor = "pointer";
|
|
1266
|
+
}
|
|
1267
|
+
} else {
|
|
1268
|
+
canvas.style.cursor = "grab";
|
|
1269
|
+
}
|
|
1270
|
+
const hoveredId = (hit == null ? void 0 : hit.kind) === "event" ? hit.event.id : null;
|
|
1271
|
+
const prevId = (prevHovered == null ? void 0 : prevHovered.kind) === "event" ? prevHovered.event.id : null;
|
|
1272
|
+
if (hoveredId !== prevId) {
|
|
1273
|
+
(_b = rendererRef.current) == null ? void 0 : _b.setView({ hoveredEventId: hoveredId });
|
|
1274
|
+
if (onEventHover) {
|
|
1275
|
+
onEventHover({
|
|
1276
|
+
eventId: hoveredId,
|
|
1277
|
+
rowId: hoveredId !== null && hit ? hit.rowId : null
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const prompt = eventPromptRef.current;
|
|
1282
|
+
if (!prompt) return;
|
|
1283
|
+
if ((hit == null ? void 0 : hit.kind) === "event" && (((_c = hit.event.props) == null ? void 0 : _c.showPrompt) || ((_d = hit.event.props) == null ? void 0 : _d.showPrompt) === void 0)) {
|
|
1284
|
+
if (prevId !== hit.event.id) {
|
|
1285
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
1286
|
+
prompt.show(hit.event, {
|
|
1287
|
+
x: canvasRect.left + hit.rect.x,
|
|
1288
|
+
y: canvasRect.top + hit.rect.y,
|
|
1289
|
+
width: hit.rect.width,
|
|
1290
|
+
height: hit.rect.height
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
} else {
|
|
1294
|
+
prompt.hide();
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
[
|
|
1298
|
+
currentHit,
|
|
1299
|
+
resizeDirectionAt,
|
|
1300
|
+
dynamicCanvasRef,
|
|
1301
|
+
eventPromptRef,
|
|
1302
|
+
rendererRef,
|
|
1303
|
+
onEventHover
|
|
1304
|
+
]
|
|
1305
|
+
);
|
|
1306
|
+
const handlePointerMove = useCallback(
|
|
1307
|
+
(pointerEvent) => {
|
|
1308
|
+
var _a, _b;
|
|
1309
|
+
const state = stateRef.current;
|
|
1310
|
+
if (state.mode === "idle") {
|
|
1311
|
+
handleHover(pointerEvent);
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
if (state.mode === "pan") {
|
|
1315
|
+
panPendingDxRef.current += pointerEvent.clientX - state.lastClientX;
|
|
1316
|
+
state.lastClientX = pointerEvent.clientX;
|
|
1317
|
+
schedulePan();
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
if (state.mode === "drag") {
|
|
1321
|
+
if (!state.active && Math.abs(pointerEvent.clientX - state.startClientX) + Math.abs(pointerEvent.clientY - state.startClientY) > DRAG_THRESHOLD_PX) {
|
|
1322
|
+
state.active = true;
|
|
1323
|
+
(_a = rendererRef.current) == null ? void 0 : _a.setView({ draggedEventId: state.hit.event.id });
|
|
1324
|
+
}
|
|
1325
|
+
if (state.active) {
|
|
1326
|
+
updateGhost(state, pointerEvent.clientX, pointerEvent.clientY);
|
|
1327
|
+
}
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
state.deltaPx = pointerEvent.clientX - state.startClientX;
|
|
1331
|
+
(_b = rendererRef.current) == null ? void 0 : _b.setView({
|
|
1332
|
+
resizePreview: {
|
|
1333
|
+
eventId: state.event.id,
|
|
1334
|
+
deltaPx: state.deltaPx,
|
|
1335
|
+
direction: state.direction
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
},
|
|
1339
|
+
[handleHover, schedulePan, updateGhost, rendererRef]
|
|
1340
|
+
);
|
|
1341
|
+
const commitDrop = useCallback(
|
|
1342
|
+
(state, clientX, clientY) => {
|
|
1343
|
+
const canvas = dynamicCanvasRef.current;
|
|
1344
|
+
const renderer = rendererRef.current;
|
|
1345
|
+
if (!canvas || !renderer) return;
|
|
1346
|
+
const view = renderer.getView();
|
|
1347
|
+
if (view.tick === null || view.cellWidth <= 0) return;
|
|
1348
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
1349
|
+
const yContent = clientY - canvasRect.top + view.scrollTop;
|
|
1350
|
+
let rowTop = 0;
|
|
1351
|
+
let targetRowId = null;
|
|
1352
|
+
for (const id of scene.getRowIds()) {
|
|
1353
|
+
const height = scene.getRowHeight(
|
|
1354
|
+
id,
|
|
1355
|
+
view.windowTime[0],
|
|
1356
|
+
view.windowTime[1]
|
|
1357
|
+
);
|
|
1358
|
+
if (yContent >= rowTop && yContent < rowTop + height) {
|
|
1359
|
+
targetRowId = id;
|
|
1360
|
+
break;
|
|
1361
|
+
}
|
|
1362
|
+
rowTop += height;
|
|
1363
|
+
}
|
|
1364
|
+
if (targetRowId === null) return;
|
|
1365
|
+
const liveEvent = scene.getEvent(state.hit.event.id);
|
|
1366
|
+
if (!liveEvent) return;
|
|
1367
|
+
const { startTime, endTime } = computeDropTimes({
|
|
1368
|
+
pointerX: clientX - canvasRect.left,
|
|
1369
|
+
cellWidth: view.cellWidth,
|
|
1370
|
+
tick: view.tick,
|
|
1371
|
+
windowStart: view.windowTime[0],
|
|
1372
|
+
duration: liveEvent.endTime - liveEvent.startTime
|
|
1373
|
+
});
|
|
1374
|
+
if (onDrop) {
|
|
1375
|
+
onDrop({
|
|
1376
|
+
eventId: liveEvent.id,
|
|
1377
|
+
oldRowId: liveEvent.rowId,
|
|
1378
|
+
newRowId: targetRowId,
|
|
1379
|
+
startTime,
|
|
1380
|
+
endTime
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
renderer.animator.snapEventTop(liveEvent.id);
|
|
1384
|
+
scene.applyPatches([
|
|
1385
|
+
{
|
|
1386
|
+
op: "update",
|
|
1387
|
+
id: liveEvent.id,
|
|
1388
|
+
changes: { startTime, endTime, rowId: targetRowId }
|
|
1389
|
+
}
|
|
1390
|
+
]);
|
|
1391
|
+
},
|
|
1392
|
+
[scene, dynamicCanvasRef, rendererRef, onDrop]
|
|
1393
|
+
);
|
|
1394
|
+
const commitResize = useCallback(
|
|
1395
|
+
(state) => {
|
|
1396
|
+
const renderer = rendererRef.current;
|
|
1397
|
+
const tick = renderer == null ? void 0 : renderer.getView().tick;
|
|
1398
|
+
renderer == null ? void 0 : renderer.setView({ resizePreview: null });
|
|
1399
|
+
unlockCursor();
|
|
1400
|
+
if (!tick) return;
|
|
1401
|
+
const liveEvent = scene.getEvent(state.event.id);
|
|
1402
|
+
if (!liveEvent) return;
|
|
1403
|
+
const next = computeResizeTimes(
|
|
1404
|
+
liveEvent,
|
|
1405
|
+
state.deltaPx,
|
|
1406
|
+
tick,
|
|
1407
|
+
state.direction
|
|
1408
|
+
);
|
|
1409
|
+
if (next) {
|
|
1410
|
+
scene.applyPatches([
|
|
1411
|
+
{ op: "update", id: liveEvent.id, changes: next }
|
|
1412
|
+
]);
|
|
1413
|
+
}
|
|
1414
|
+
if (onResize) {
|
|
1415
|
+
const committed = next != null ? next : {
|
|
1416
|
+
startTime: liveEvent.startTime,
|
|
1417
|
+
endTime: liveEvent.endTime
|
|
1418
|
+
};
|
|
1419
|
+
onResize(__spreadValues({ eventId: liveEvent.id }, committed));
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
[scene, rendererRef, onResize]
|
|
1423
|
+
);
|
|
1424
|
+
const handlePointerUp = useCallback(
|
|
1425
|
+
(pointerEvent) => {
|
|
1426
|
+
var _a;
|
|
1427
|
+
const canvas = dynamicCanvasRef.current;
|
|
1428
|
+
const state = stateRef.current;
|
|
1429
|
+
stateRef.current = { mode: "idle" };
|
|
1430
|
+
if (canvas == null ? void 0 : canvas.hasPointerCapture(pointerEvent.pointerId)) {
|
|
1431
|
+
canvas.releasePointerCapture(pointerEvent.pointerId);
|
|
1432
|
+
}
|
|
1433
|
+
if (canvas) canvas.style.cursor = "grab";
|
|
1434
|
+
if (state.mode === "drag" && state.active) {
|
|
1435
|
+
if (ghostRef.current) ghostRef.current.style.display = "none";
|
|
1436
|
+
(_a = rendererRef.current) == null ? void 0 : _a.setView({ draggedEventId: null });
|
|
1437
|
+
commitDrop(state, pointerEvent.clientX, pointerEvent.clientY);
|
|
1438
|
+
} else if (state.mode === "drag" && !state.active) {
|
|
1439
|
+
if (onEventClick) {
|
|
1440
|
+
onEventClick({
|
|
1441
|
+
eventId: state.hit.event.id,
|
|
1442
|
+
rowId: state.hit.rowId,
|
|
1443
|
+
nativeEvent: pointerEvent.nativeEvent,
|
|
1444
|
+
modifiers: {
|
|
1445
|
+
shift: pointerEvent.shiftKey,
|
|
1446
|
+
ctrl: pointerEvent.ctrlKey,
|
|
1447
|
+
meta: pointerEvent.metaKey,
|
|
1448
|
+
alt: pointerEvent.altKey
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
} else if (state.mode === "resize") {
|
|
1453
|
+
commitResize(state);
|
|
1454
|
+
}
|
|
1455
|
+
},
|
|
1456
|
+
[
|
|
1457
|
+
dynamicCanvasRef,
|
|
1458
|
+
ghostRef,
|
|
1459
|
+
rendererRef,
|
|
1460
|
+
commitDrop,
|
|
1461
|
+
commitResize,
|
|
1462
|
+
onEventClick
|
|
1463
|
+
]
|
|
1464
|
+
);
|
|
1465
|
+
const handlePointerLeave = useCallback(() => {
|
|
1466
|
+
var _a, _b;
|
|
1467
|
+
if (stateRef.current.mode !== "idle") return;
|
|
1468
|
+
if (((_a = hoveredRef.current) == null ? void 0 : _a.kind) === "event") {
|
|
1469
|
+
(_b = rendererRef.current) == null ? void 0 : _b.setView({ hoveredEventId: null });
|
|
1470
|
+
if (onEventHover) onEventHover({ eventId: null, rowId: null });
|
|
1471
|
+
}
|
|
1472
|
+
hoveredRef.current = null;
|
|
1473
|
+
if (dynamicCanvasRef.current) {
|
|
1474
|
+
dynamicCanvasRef.current.style.cursor = "";
|
|
1475
|
+
}
|
|
1476
|
+
hidePrompt();
|
|
1477
|
+
}, [dynamicCanvasRef, rendererRef, hidePrompt, onEventHover]);
|
|
1478
|
+
const handleAuxClick = useCallback(
|
|
1479
|
+
(pointerEvent) => {
|
|
1480
|
+
pointerEvent.preventDefault();
|
|
1481
|
+
if (pointerEvent.button === 1 && config.middleClickGranularity) {
|
|
1482
|
+
changeGridRef.current = !changeGridRef.current;
|
|
1483
|
+
if (bodyRef.current) {
|
|
1484
|
+
bodyRef.current.style.overflowY = changeGridRef.current ? "hidden" : "auto";
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1488
|
+
[bodyRef, config]
|
|
1489
|
+
);
|
|
1490
|
+
useEffect4(() => {
|
|
1491
|
+
const canvas = dynamicCanvasRef.current;
|
|
1492
|
+
if (!canvas) return;
|
|
1493
|
+
const handleWheel = (wheelEvent) => {
|
|
1494
|
+
var _a;
|
|
1495
|
+
const viaCtrl = (wheelEvent.ctrlKey || wheelEvent.metaKey) && config.ctrlWheelZoom;
|
|
1496
|
+
if (!changeGridRef.current && !viaCtrl) return;
|
|
1497
|
+
wheelEvent.preventDefault();
|
|
1498
|
+
const tick = (_a = rendererRef.current) == null ? void 0 : _a.getView().tick;
|
|
1499
|
+
if (!tick) return;
|
|
1500
|
+
setCellWidth(
|
|
1501
|
+
(cellWidth) => stepCellWidth(
|
|
1502
|
+
cellWidth,
|
|
1503
|
+
wheelEvent.deltaY,
|
|
1504
|
+
tick * 900 / config.zoomStepSeconds
|
|
1505
|
+
)
|
|
1506
|
+
);
|
|
1507
|
+
};
|
|
1508
|
+
canvas.addEventListener("wheel", handleWheel, { passive: false });
|
|
1509
|
+
return () => canvas.removeEventListener("wheel", handleWheel);
|
|
1510
|
+
}, [dynamicCanvasRef, rendererRef, setCellWidth, config]);
|
|
1511
|
+
useEffect4(() => unlockCursor, []);
|
|
1512
|
+
return {
|
|
1513
|
+
handlePointerDown,
|
|
1514
|
+
handlePointerMove,
|
|
1515
|
+
handlePointerUp,
|
|
1516
|
+
handlePointerLeave,
|
|
1517
|
+
handleAuxClick
|
|
1518
|
+
};
|
|
1519
|
+
};
|
|
1520
|
+
var use_canvas_interactions_default = useCanvasInteractions;
|
|
1521
|
+
|
|
1522
|
+
// src/components/canvas-board.tsx
|
|
1523
|
+
var CanvasBoard = forwardRef2(
|
|
1524
|
+
({
|
|
1525
|
+
scene,
|
|
1526
|
+
rows,
|
|
1527
|
+
windowTime,
|
|
1528
|
+
tick,
|
|
1529
|
+
cellWidth,
|
|
1530
|
+
theme,
|
|
1531
|
+
drawEvent,
|
|
1532
|
+
bodyRef,
|
|
1533
|
+
rendererRef,
|
|
1534
|
+
eventPromptRef,
|
|
1535
|
+
rowsHeaderClassName,
|
|
1536
|
+
setWindowTime,
|
|
1537
|
+
setCellWidth,
|
|
1538
|
+
onDrop,
|
|
1539
|
+
onResize,
|
|
1540
|
+
onEventClick,
|
|
1541
|
+
onEventHover,
|
|
1542
|
+
eventsResize,
|
|
1543
|
+
panZoom,
|
|
1544
|
+
animations
|
|
1545
|
+
}, contentRef) => {
|
|
1546
|
+
const staticCanvasRef = useRef6(null);
|
|
1547
|
+
const dynamicCanvasRef = useRef6(null);
|
|
1548
|
+
const ghostRef = useRef6(null);
|
|
1549
|
+
const [scrollTop, setScrollTop] = useState3(0);
|
|
1550
|
+
const [viewportHeight, setViewportHeight] = useState3(0);
|
|
1551
|
+
useEffect5(() => {
|
|
1552
|
+
if (!staticCanvasRef.current || !dynamicCanvasRef.current) return;
|
|
1553
|
+
const renderer = new TimelineRenderer(
|
|
1554
|
+
staticCanvasRef.current,
|
|
1555
|
+
dynamicCanvasRef.current,
|
|
1556
|
+
scene
|
|
1557
|
+
);
|
|
1558
|
+
rendererRef.current = renderer;
|
|
1559
|
+
return () => {
|
|
1560
|
+
renderer.dispose();
|
|
1561
|
+
rendererRef.current = null;
|
|
1562
|
+
};
|
|
1563
|
+
}, [scene, rendererRef]);
|
|
1564
|
+
useEffect5(() => {
|
|
1565
|
+
var _a, _b;
|
|
1566
|
+
(_a = rendererRef.current) == null ? void 0 : _a.animator.setDurations(
|
|
1567
|
+
animations.layoutMs,
|
|
1568
|
+
animations.fadeMs
|
|
1569
|
+
);
|
|
1570
|
+
(_b = rendererRef.current) == null ? void 0 : _b.setView({
|
|
1571
|
+
windowTime: [windowTime[0], windowTime[1]],
|
|
1572
|
+
tick,
|
|
1573
|
+
cellWidth,
|
|
1574
|
+
theme,
|
|
1575
|
+
drawEvent,
|
|
1576
|
+
eventsResize
|
|
1577
|
+
});
|
|
1578
|
+
}, [
|
|
1579
|
+
windowTime,
|
|
1580
|
+
tick,
|
|
1581
|
+
cellWidth,
|
|
1582
|
+
theme,
|
|
1583
|
+
drawEvent,
|
|
1584
|
+
eventsResize,
|
|
1585
|
+
animations,
|
|
1586
|
+
rendererRef
|
|
1587
|
+
]);
|
|
1588
|
+
useEffect5(() => {
|
|
1589
|
+
const column = contentRef && "current" in contentRef ? contentRef.current : null;
|
|
1590
|
+
const body = bodyRef.current;
|
|
1591
|
+
if (!column || !body) return;
|
|
1592
|
+
const measure = () => {
|
|
1593
|
+
var _a;
|
|
1594
|
+
const height = Math.min(body.clientHeight, window.innerHeight);
|
|
1595
|
+
setViewportHeight(height);
|
|
1596
|
+
(_a = rendererRef.current) == null ? void 0 : _a.setView({
|
|
1597
|
+
width: column.getBoundingClientRect().width,
|
|
1598
|
+
height
|
|
1599
|
+
});
|
|
1600
|
+
};
|
|
1601
|
+
measure();
|
|
1602
|
+
const observer = new ResizeObserver(measure);
|
|
1603
|
+
observer.observe(column);
|
|
1604
|
+
observer.observe(body);
|
|
1605
|
+
return () => observer.disconnect();
|
|
1606
|
+
}, [bodyRef, contentRef, rendererRef]);
|
|
1607
|
+
useEffect5(() => {
|
|
1608
|
+
const body = bodyRef.current;
|
|
1609
|
+
if (!body) return;
|
|
1610
|
+
const handleScroll = () => {
|
|
1611
|
+
var _a;
|
|
1612
|
+
(_a = rendererRef.current) == null ? void 0 : _a.setView({ scrollTop: body.scrollTop });
|
|
1613
|
+
setScrollTop(body.scrollTop);
|
|
1614
|
+
};
|
|
1615
|
+
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
1616
|
+
return () => body.removeEventListener("scroll", handleScroll);
|
|
1617
|
+
}, [bodyRef, rendererRef]);
|
|
1618
|
+
useSyncExternalStore(
|
|
1619
|
+
useCallback2((listener) => scene.subscribe(listener), [scene]),
|
|
1620
|
+
() => scene.version
|
|
1621
|
+
);
|
|
1622
|
+
const {
|
|
1623
|
+
handlePointerDown,
|
|
1624
|
+
handlePointerMove,
|
|
1625
|
+
handlePointerUp,
|
|
1626
|
+
handlePointerLeave,
|
|
1627
|
+
handleAuxClick
|
|
1628
|
+
} = use_canvas_interactions_default({
|
|
1629
|
+
scene,
|
|
1630
|
+
rendererRef,
|
|
1631
|
+
dynamicCanvasRef,
|
|
1632
|
+
bodyRef,
|
|
1633
|
+
ghostRef,
|
|
1634
|
+
eventPromptRef,
|
|
1635
|
+
setWindowTime,
|
|
1636
|
+
setCellWidth,
|
|
1637
|
+
onDrop,
|
|
1638
|
+
onResize,
|
|
1639
|
+
onEventClick,
|
|
1640
|
+
onEventHover,
|
|
1641
|
+
eventsResize,
|
|
1642
|
+
panZoom
|
|
1643
|
+
});
|
|
1644
|
+
const { offsetOf, totalHeight } = scene.getRowOffsets(
|
|
1645
|
+
windowTime[0],
|
|
1646
|
+
windowTime[1]
|
|
1647
|
+
);
|
|
1648
|
+
const visibleHeaders = [];
|
|
1649
|
+
for (let i = 0; i < rows.length; i++) {
|
|
1650
|
+
const row = rows[i];
|
|
1651
|
+
const top = offsetOf.get(row.id);
|
|
1652
|
+
const height = scene.getRowHeight(row.id, windowTime[0], windowTime[1]);
|
|
1653
|
+
if (top + height < scrollTop) continue;
|
|
1654
|
+
if (top > scrollTop + viewportHeight) break;
|
|
1655
|
+
visibleHeaders.push(
|
|
1656
|
+
/* @__PURE__ */ React5.createElement(
|
|
1657
|
+
"div",
|
|
1658
|
+
{
|
|
1659
|
+
key: `row_header_${row.id}`,
|
|
1660
|
+
className: "row-header canvas-row-header",
|
|
1661
|
+
style: {
|
|
1662
|
+
top,
|
|
1663
|
+
height,
|
|
1664
|
+
borderBottom: i === rows.length - 1 ? "none" : "1px solid yellow",
|
|
1665
|
+
// keeps the DOM header in step with the canvas layout tween
|
|
1666
|
+
transition: animations.layoutMs > 0 ? `top ${animations.layoutMs}ms ease-in-out, height ${animations.layoutMs}ms ease-in-out` : "none"
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
row.name
|
|
1670
|
+
)
|
|
1671
|
+
);
|
|
1672
|
+
}
|
|
1673
|
+
const headerClassNames = rowsHeaderClassName ? `rows-header-wrapper canvas-rows-header ${rowsHeaderClassName}` : "rows-header-wrapper canvas-rows-header";
|
|
1674
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { className: headerClassNames, style: { height: totalHeight } }, visibleHeaders), /* @__PURE__ */ React5.createElement("div", { className: "canvas-content-column", ref: contentRef }, /* @__PURE__ */ React5.createElement("div", { className: "canvas-sticky" }, /* @__PURE__ */ React5.createElement("canvas", { ref: staticCanvasRef }), /* @__PURE__ */ React5.createElement(
|
|
1675
|
+
"canvas",
|
|
1676
|
+
{
|
|
1677
|
+
ref: dynamicCanvasRef,
|
|
1678
|
+
onPointerDown: handlePointerDown,
|
|
1679
|
+
onPointerMove: handlePointerMove,
|
|
1680
|
+
onPointerUp: handlePointerUp,
|
|
1681
|
+
onPointerLeave: handlePointerLeave,
|
|
1682
|
+
onAuxClick: handleAuxClick
|
|
1683
|
+
}
|
|
1684
|
+
), /* @__PURE__ */ React5.createElement("div", { ref: ghostRef, className: "event canvas-drag-ghost" })), /* @__PURE__ */ React5.createElement(
|
|
1685
|
+
"div",
|
|
1686
|
+
{
|
|
1687
|
+
className: "canvas-scroll-spacer",
|
|
1688
|
+
style: { height: totalHeight }
|
|
1689
|
+
}
|
|
1690
|
+
)));
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
var canvas_board_default = CanvasBoard;
|
|
1694
|
+
|
|
1695
|
+
// src/core/scene.ts
|
|
1696
|
+
var binaryInsertIndex = (events, event) => {
|
|
1697
|
+
let lo = 0;
|
|
1698
|
+
let hi = events.length;
|
|
1699
|
+
while (lo < hi) {
|
|
1700
|
+
const mid = lo + hi >> 1;
|
|
1701
|
+
if (sort_events_default(events[mid], event) < 0) {
|
|
1702
|
+
lo = mid + 1;
|
|
1703
|
+
} else {
|
|
1704
|
+
hi = mid;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
return lo;
|
|
1708
|
+
};
|
|
1709
|
+
var SceneStore = class {
|
|
1710
|
+
constructor() {
|
|
1711
|
+
this.rowIndexes = /* @__PURE__ */ new Map();
|
|
1712
|
+
this.rowOrder = [];
|
|
1713
|
+
this.eventRow = /* @__PURE__ */ new Map();
|
|
1714
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
1715
|
+
this.version = 0;
|
|
1716
|
+
}
|
|
1717
|
+
setRows(rows) {
|
|
1718
|
+
const next = /* @__PURE__ */ new Map();
|
|
1719
|
+
for (const row of rows) {
|
|
1720
|
+
const existing = this.rowIndexes.get(row.id);
|
|
1721
|
+
next.set(
|
|
1722
|
+
row.id,
|
|
1723
|
+
existing ? __spreadProps(__spreadValues({}, existing), { row }) : {
|
|
1724
|
+
row,
|
|
1725
|
+
events: [],
|
|
1726
|
+
staticEvents: [],
|
|
1727
|
+
lanesDirty: true,
|
|
1728
|
+
lanes: null,
|
|
1729
|
+
laneWindowStart: NaN,
|
|
1730
|
+
laneWindowEnd: NaN
|
|
1731
|
+
}
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1734
|
+
for (const [id, rowId] of this.eventRow) {
|
|
1735
|
+
if (!next.has(rowId)) this.eventRow.delete(id);
|
|
1736
|
+
}
|
|
1737
|
+
this.rowIndexes = next;
|
|
1738
|
+
this.rowOrder = rows.map((row) => row.id);
|
|
1739
|
+
this.bump();
|
|
1740
|
+
}
|
|
1741
|
+
setEvents(events) {
|
|
1742
|
+
for (const index of this.rowIndexes.values()) {
|
|
1743
|
+
index.events = [];
|
|
1744
|
+
index.lanesDirty = true;
|
|
1745
|
+
}
|
|
1746
|
+
this.eventRow.clear();
|
|
1747
|
+
for (const event of events) {
|
|
1748
|
+
const index = this.rowIndexes.get(event.rowId);
|
|
1749
|
+
if (!index) continue;
|
|
1750
|
+
index.events.push(event);
|
|
1751
|
+
this.eventRow.set(event.id, event.rowId);
|
|
1752
|
+
}
|
|
1753
|
+
for (const index of this.rowIndexes.values()) {
|
|
1754
|
+
index.events.sort(sort_events_default);
|
|
1755
|
+
}
|
|
1756
|
+
this.bump();
|
|
1757
|
+
}
|
|
1758
|
+
setStaticEvents(events) {
|
|
1759
|
+
for (const index of this.rowIndexes.values()) {
|
|
1760
|
+
index.staticEvents = [];
|
|
1761
|
+
}
|
|
1762
|
+
for (const event of events) {
|
|
1763
|
+
const index = this.rowIndexes.get(event.rowId);
|
|
1764
|
+
if (!index) continue;
|
|
1765
|
+
index.staticEvents.push(event);
|
|
1766
|
+
}
|
|
1767
|
+
for (const index of this.rowIndexes.values()) {
|
|
1768
|
+
index.staticEvents.sort(sort_events_default);
|
|
1769
|
+
}
|
|
1770
|
+
this.bump();
|
|
1771
|
+
}
|
|
1772
|
+
applyPatches(patches) {
|
|
1773
|
+
for (const patch of patches) {
|
|
1774
|
+
if (patch.op === "upsert") {
|
|
1775
|
+
this.remove(patch.event.id);
|
|
1776
|
+
this.insert(patch.event);
|
|
1777
|
+
} else if (patch.op === "update") {
|
|
1778
|
+
const existing = this.getEvent(patch.id);
|
|
1779
|
+
if (!existing) continue;
|
|
1780
|
+
this.remove(patch.id);
|
|
1781
|
+
this.insert(__spreadProps(__spreadValues(__spreadValues({}, existing), patch.changes), { id: patch.id }));
|
|
1782
|
+
} else {
|
|
1783
|
+
this.remove(patch.id);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
this.bump();
|
|
1787
|
+
}
|
|
1788
|
+
getEvent(id) {
|
|
1789
|
+
var _a;
|
|
1790
|
+
const rowId = this.eventRow.get(id);
|
|
1791
|
+
if (rowId === void 0) return void 0;
|
|
1792
|
+
return (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.events.find((event) => event.id === id);
|
|
1793
|
+
}
|
|
1794
|
+
getRowIds() {
|
|
1795
|
+
return this.rowOrder;
|
|
1796
|
+
}
|
|
1797
|
+
getRow(rowId) {
|
|
1798
|
+
var _a;
|
|
1799
|
+
return (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.row;
|
|
1800
|
+
}
|
|
1801
|
+
getRowEvents(rowId) {
|
|
1802
|
+
var _a, _b;
|
|
1803
|
+
return (_b = (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.events) != null ? _b : [];
|
|
1804
|
+
}
|
|
1805
|
+
getRowStaticEvents(rowId) {
|
|
1806
|
+
var _a, _b;
|
|
1807
|
+
return (_b = (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.staticEvents) != null ? _b : [];
|
|
1808
|
+
}
|
|
1809
|
+
getLanes(rowId, windowStart, windowEnd) {
|
|
1810
|
+
const index = this.rowIndexes.get(rowId);
|
|
1811
|
+
if (!index) return { laneOf: /* @__PURE__ */ new Map(), highestLane: 0 };
|
|
1812
|
+
if (index.lanesDirty || index.lanes === null || index.laneWindowStart !== windowStart || index.laneWindowEnd !== windowEnd) {
|
|
1813
|
+
index.lanes = assignLanes(index.events, windowStart, windowEnd);
|
|
1814
|
+
index.laneWindowStart = windowStart;
|
|
1815
|
+
index.laneWindowEnd = windowEnd;
|
|
1816
|
+
index.lanesDirty = false;
|
|
1817
|
+
}
|
|
1818
|
+
return index.lanes;
|
|
1819
|
+
}
|
|
1820
|
+
getRowHeight(rowId, windowStart, windowEnd) {
|
|
1821
|
+
return rowMinHeight(this.getLanes(rowId, windowStart, windowEnd).highestLane);
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
1825
|
+
* the total content height — drives both drawing and the scroll spacer.
|
|
1826
|
+
*/
|
|
1827
|
+
getRowOffsets(windowStart, windowEnd) {
|
|
1828
|
+
const offsetOf = /* @__PURE__ */ new Map();
|
|
1829
|
+
let y = 0;
|
|
1830
|
+
for (const rowId of this.rowOrder) {
|
|
1831
|
+
offsetOf.set(rowId, y);
|
|
1832
|
+
y += this.getRowHeight(rowId, windowStart, windowEnd);
|
|
1833
|
+
}
|
|
1834
|
+
return { offsetOf, totalHeight: y };
|
|
1835
|
+
}
|
|
1836
|
+
subscribe(listener) {
|
|
1837
|
+
this.listeners.add(listener);
|
|
1838
|
+
return () => this.listeners.delete(listener);
|
|
1839
|
+
}
|
|
1840
|
+
insert(event) {
|
|
1841
|
+
const index = this.rowIndexes.get(event.rowId);
|
|
1842
|
+
if (!index) return;
|
|
1843
|
+
index.events.splice(binaryInsertIndex(index.events, event), 0, event);
|
|
1844
|
+
index.lanesDirty = true;
|
|
1845
|
+
this.eventRow.set(event.id, event.rowId);
|
|
1846
|
+
}
|
|
1847
|
+
remove(id) {
|
|
1848
|
+
const rowId = this.eventRow.get(id);
|
|
1849
|
+
if (rowId === void 0) return;
|
|
1850
|
+
const index = this.rowIndexes.get(rowId);
|
|
1851
|
+
if (index) {
|
|
1852
|
+
const at = index.events.findIndex((event) => event.id === id);
|
|
1853
|
+
if (at !== -1) index.events.splice(at, 1);
|
|
1854
|
+
index.lanesDirty = true;
|
|
1855
|
+
}
|
|
1856
|
+
this.eventRow.delete(id);
|
|
1857
|
+
}
|
|
1858
|
+
bump() {
|
|
1859
|
+
this.version++;
|
|
1860
|
+
for (const listener of this.listeners) listener();
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
|
|
1864
|
+
// src/timeline.tsx
|
|
1865
|
+
var Timeline = forwardRef3(
|
|
1866
|
+
({
|
|
1867
|
+
rows,
|
|
1868
|
+
events,
|
|
1869
|
+
staticEvents,
|
|
1870
|
+
onDrop,
|
|
1871
|
+
onResize,
|
|
1872
|
+
onEventClick,
|
|
1873
|
+
onEventHover,
|
|
1874
|
+
startDate,
|
|
1875
|
+
endDate,
|
|
1876
|
+
theme,
|
|
1877
|
+
drawEvent,
|
|
1878
|
+
additionalClassNames,
|
|
1879
|
+
showRTIndicator = true,
|
|
1880
|
+
eventsResize = true,
|
|
1881
|
+
eventPromptTemplate,
|
|
1882
|
+
showEventPrompt = true,
|
|
1883
|
+
panZoom,
|
|
1884
|
+
animations = true
|
|
1885
|
+
}, handleRef) => {
|
|
1886
|
+
const [windowTime, setWindowTime] = useState4([
|
|
1887
|
+
new Date(
|
|
1888
|
+
startDate.getFullYear(),
|
|
1889
|
+
startDate.getMonth(),
|
|
1890
|
+
startDate.getDate(),
|
|
1891
|
+
startDate.getHours(),
|
|
1892
|
+
0,
|
|
1893
|
+
0
|
|
1894
|
+
).getTime() / 1e3,
|
|
1895
|
+
new Date(
|
|
1896
|
+
endDate.getFullYear(),
|
|
1897
|
+
endDate.getMonth(),
|
|
1898
|
+
endDate.getDate(),
|
|
1899
|
+
endDate.getHours(),
|
|
1900
|
+
0,
|
|
1901
|
+
0
|
|
1902
|
+
).getTime() / 1e3
|
|
1903
|
+
]);
|
|
1904
|
+
const [cellWidth, setCellWidth] = useState4(0);
|
|
1905
|
+
const contentRef = useRef7(null);
|
|
1906
|
+
const mainRef = useRef7(null);
|
|
1907
|
+
const bodyRef = useRef7(null);
|
|
1908
|
+
const [tick, setTick] = useState4(null);
|
|
1909
|
+
const [scrollWidth, setScrollWidth] = useState4(0);
|
|
1910
|
+
const eventPromptRef = useRef7(null);
|
|
1911
|
+
const rendererRef = useRef7(null);
|
|
1912
|
+
const sceneRef = useRef7(null);
|
|
1913
|
+
if (sceneRef.current === null) {
|
|
1914
|
+
sceneRef.current = new SceneStore();
|
|
1915
|
+
}
|
|
1916
|
+
const scene = sceneRef.current;
|
|
1917
|
+
useEffect6(() => {
|
|
1918
|
+
scene.setRows(rows);
|
|
1919
|
+
}, [scene, rows]);
|
|
1920
|
+
useEffect6(() => {
|
|
1921
|
+
scene.setEvents([...events].sort(sort_events_default));
|
|
1922
|
+
}, [scene, events]);
|
|
1923
|
+
useEffect6(() => {
|
|
1924
|
+
scene.setStaticEvents(staticEvents ? [...staticEvents] : []);
|
|
1925
|
+
}, [scene, staticEvents]);
|
|
1926
|
+
const windowTimeRef = useRef7(windowTime);
|
|
1927
|
+
windowTimeRef.current = windowTime;
|
|
1928
|
+
useImperativeHandle2(
|
|
1929
|
+
handleRef,
|
|
1930
|
+
() => ({
|
|
1931
|
+
setEvents: (next) => scene.setEvents([...next].sort(sort_events_default)),
|
|
1932
|
+
updateEvents: (patches) => scene.applyPatches(patches),
|
|
1933
|
+
getEvent: (id) => scene.getEvent(id),
|
|
1934
|
+
scrollToRow: (rowId) => {
|
|
1935
|
+
const [windowStart, windowEnd] = windowTimeRef.current;
|
|
1936
|
+
const offset2 = scene.getRowOffsets(windowStart, windowEnd).offsetOf.get(rowId);
|
|
1937
|
+
if (offset2 !== void 0 && bodyRef.current) {
|
|
1938
|
+
bodyRef.current.scrollTop = offset2;
|
|
1939
|
+
}
|
|
1940
|
+
},
|
|
1941
|
+
scrollToTime: (time) => {
|
|
1942
|
+
setWindowTime((prev) => [time, time + (prev[1] - prev[0])]);
|
|
1943
|
+
},
|
|
1944
|
+
setWindow: (startTime, endTime) => setWindowTime([startTime, endTime]),
|
|
1945
|
+
getVisibleRange: () => ({
|
|
1946
|
+
startTime: windowTimeRef.current[0],
|
|
1947
|
+
endTime: windowTimeRef.current[1]
|
|
1948
|
+
}),
|
|
1949
|
+
redraw: () => {
|
|
1950
|
+
var _a;
|
|
1951
|
+
return (_a = rendererRef.current) == null ? void 0 : _a.invalidate("all");
|
|
1952
|
+
}
|
|
1953
|
+
}),
|
|
1954
|
+
[scene]
|
|
1955
|
+
);
|
|
1956
|
+
useEffect6(() => {
|
|
1957
|
+
if (contentRef.current) {
|
|
1958
|
+
const windowDuration = windowTime[1] - windowTime[0];
|
|
1959
|
+
const numberOfHourBlocks = windowDuration / 3600;
|
|
1960
|
+
setTick(
|
|
1961
|
+
windowDuration / contentRef.current.getBoundingClientRect().width
|
|
1962
|
+
);
|
|
1963
|
+
setCellWidth(
|
|
1964
|
+
contentRef.current.getBoundingClientRect().width / numberOfHourBlocks
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
}, []);
|
|
1968
|
+
useEffect6(() => {
|
|
1969
|
+
if (bodyRef.current) {
|
|
1970
|
+
setScrollWidth(
|
|
1971
|
+
bodyRef.current.getBoundingClientRect().width - bodyRef.current.scrollWidth
|
|
1972
|
+
);
|
|
1973
|
+
}
|
|
1974
|
+
}, []);
|
|
1975
|
+
use_resize_observer_default({ contentRef, setCellWidth, setTick, windowTime });
|
|
1976
|
+
const resolvedTheme = useMemo4(() => resolveTheme(theme), [theme]);
|
|
1977
|
+
const resolvedAnimations = useMemo4(() => {
|
|
1978
|
+
var _a, _b;
|
|
1979
|
+
if (animations === false) return { layoutMs: 0, fadeMs: 0 };
|
|
1980
|
+
if (animations === true) {
|
|
1981
|
+
return {
|
|
1982
|
+
layoutMs: DEFAULT_LAYOUT_DURATION_MS,
|
|
1983
|
+
fadeMs: DEFAULT_FADE_DURATION_MS
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1986
|
+
return {
|
|
1987
|
+
layoutMs: (_a = animations.layoutMs) != null ? _a : DEFAULT_LAYOUT_DURATION_MS,
|
|
1988
|
+
fadeMs: (_b = animations.fadeMs) != null ? _b : DEFAULT_FADE_DURATION_MS
|
|
1989
|
+
};
|
|
1990
|
+
}, [animations]);
|
|
1991
|
+
const eventPrompt = useMemo4(
|
|
1992
|
+
() => /* @__PURE__ */ React6.createElement(
|
|
1993
|
+
event_prompt_default,
|
|
1994
|
+
{
|
|
1995
|
+
ref: eventPromptRef,
|
|
1996
|
+
template: eventPromptTemplate
|
|
1997
|
+
}
|
|
1998
|
+
),
|
|
1999
|
+
[eventPromptTemplate]
|
|
2000
|
+
);
|
|
2001
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ React6.createElement(rt_indicator_default, { tick, windowTime }), /* @__PURE__ */ React6.createElement(
|
|
2002
|
+
canvas_time_bar_default,
|
|
2003
|
+
{
|
|
2004
|
+
windowTime,
|
|
2005
|
+
tick,
|
|
2006
|
+
contentWidth: contentRef.current ? contentRef.current.getBoundingClientRect().width : null,
|
|
2007
|
+
scrollWidth,
|
|
2008
|
+
theme: resolvedTheme
|
|
2009
|
+
}
|
|
2010
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ React6.createElement(
|
|
2011
|
+
canvas_board_default,
|
|
2012
|
+
{
|
|
2013
|
+
scene,
|
|
2014
|
+
rows,
|
|
2015
|
+
windowTime,
|
|
2016
|
+
tick,
|
|
2017
|
+
cellWidth,
|
|
2018
|
+
theme: resolvedTheme,
|
|
2019
|
+
drawEvent,
|
|
2020
|
+
bodyRef,
|
|
2021
|
+
rendererRef,
|
|
2022
|
+
eventPromptRef,
|
|
2023
|
+
rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
|
|
2024
|
+
setWindowTime,
|
|
2025
|
+
setCellWidth,
|
|
2026
|
+
onDrop,
|
|
2027
|
+
onResize,
|
|
2028
|
+
onEventClick,
|
|
2029
|
+
onEventHover,
|
|
2030
|
+
eventsResize,
|
|
2031
|
+
panZoom,
|
|
2032
|
+
animations: resolvedAnimations,
|
|
2033
|
+
ref: contentRef
|
|
2034
|
+
}
|
|
2035
|
+
), showEventPrompt && eventPrompt));
|
|
2036
|
+
}
|
|
2037
|
+
);
|
|
2038
|
+
export {
|
|
2039
|
+
Timeline
|
|
2040
|
+
};
|
|
1911
2041
|
//# sourceMappingURL=index.mjs.map
|