@tasknotes/calendar 0.1.10 → 0.1.11
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/CHANGELOG.md +5 -0
- package/dist/calendar.css +36 -2
- package/dist/cjs/core.cjs +20 -26
- package/dist/cjs/index.cjs +21 -27
- package/dist/cjs/react.cjs +21 -27
- package/dist/esm/{chunk-66A6EMCU.js → chunk-JWORVABV.js} +20 -26
- package/dist/esm/{chunk-5PHSJK36.js → chunk-TTM45UAN.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/react.js +2 -2
- package/dist/types/core/layout.d.cts +5 -0
- package/dist/types/core/layout.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.11
|
|
4
|
+
|
|
5
|
+
- Hour-long timed items keep their time in narrow columns. Only single-row short items drop the time label when narrow; in the stacked layout the title is clamped to the lines left above the time (callumalpass/tasknotes#2528).
|
|
6
|
+
- Back-to-back timed items no longer count as overlapping: an item starting exactly where a short item ends stays in the same column instead of going side by side or into a collision stack, and the short item is drawn at its real height (callumalpass/tasknotes#2529).
|
|
7
|
+
|
|
3
8
|
## 0.1.10
|
|
4
9
|
|
|
5
10
|
- Freeze Month source layout during a move and draw an inert target placeholder; preserve timed drag width across collision layouts.
|
package/dist/calendar.css
CHANGED
|
@@ -293,8 +293,42 @@
|
|
|
293
293
|
.tnc-item--timed.is-short .tnc-item-time {
|
|
294
294
|
flex: none;
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
/* Stacked layout: the time keeps its line and the title gets the lines left over
|
|
297
|
+
(11px text: n title lines need 13.75 * (n + 1) + 1px). Single-row short items drop the time when narrow. */
|
|
298
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
299
|
+
flex: 0 1 auto;
|
|
300
|
+
min-height: 0;
|
|
301
|
+
}
|
|
302
|
+
.tnc-item--timed:not(.is-short) .tnc-item-time {
|
|
303
|
+
flex: none;
|
|
304
|
+
}
|
|
305
|
+
@container (max-height: 97.2px) {
|
|
306
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
307
|
+
-webkit-line-clamp: 5;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
@container (max-height: 83.4px) {
|
|
311
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
312
|
+
-webkit-line-clamp: 4;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
@container (max-height: 69.7px) {
|
|
316
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
317
|
+
-webkit-line-clamp: 3;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
@container (max-height: 55.9px) {
|
|
321
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
322
|
+
-webkit-line-clamp: 2;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
@container (max-height: 42.2px) {
|
|
326
|
+
.tnc-item--timed:not(.is-short) .tnc-item-title {
|
|
327
|
+
-webkit-line-clamp: 1;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
@container (max-width: 239px) {
|
|
331
|
+
.tnc-item--timed.is-short .tnc-item-time {
|
|
298
332
|
display: none;
|
|
299
333
|
}
|
|
300
334
|
}
|
package/dist/cjs/core.cjs
CHANGED
|
@@ -490,43 +490,44 @@ function segmentInWindow(n, day, minMinute, maxMinute, zone) {
|
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
var defaultOrder = (a, b) => a.startMs - b.startMs || b.endMs - b.startMs - (a.endMs - a.startMs) || Number(b.allDay) - Number(a.allDay) || a.item.title.localeCompare(b.item.title);
|
|
493
|
+
function collides(a, b, minMinutes) {
|
|
494
|
+
if (b.startMin < a.endMin) return true;
|
|
495
|
+
if (b.startMin === a.endMin && a.endMin > a.startMin) return false;
|
|
496
|
+
return b.startMin < a.startMin + minMinutes;
|
|
497
|
+
}
|
|
498
|
+
function overlaps(a, b, minMinutes) {
|
|
499
|
+
return a.startMin <= b.startMin ? collides(a, b, minMinutes) : collides(b, a, minMinutes);
|
|
500
|
+
}
|
|
493
501
|
function packTimed(segs, minMinutes, order = defaultOrder) {
|
|
494
|
-
const sorted = segs.
|
|
502
|
+
const sorted = [...segs].sort((a, b) => a.startMin - b.startMin || Math.max(b.endMin, b.startMin + minMinutes) - Math.max(a.endMin, a.startMin + minMinutes) || order(a.item, b.item));
|
|
495
503
|
const out = [];
|
|
496
504
|
let cluster = [];
|
|
497
|
-
let
|
|
498
|
-
let clusterEnd = -Infinity;
|
|
505
|
+
let colLast = [];
|
|
499
506
|
let clusterIndex = 0;
|
|
500
507
|
const flush = () => {
|
|
501
508
|
if (cluster.length) clusterIndex++;
|
|
502
|
-
const cols =
|
|
509
|
+
const cols = colLast.length;
|
|
503
510
|
for (const p of cluster) {
|
|
504
511
|
p.cols = cols;
|
|
505
512
|
let span = 1;
|
|
506
|
-
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && o
|
|
513
|
+
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && overlaps(o, p, minMinutes))) span++;
|
|
507
514
|
p.span = span;
|
|
508
515
|
}
|
|
509
516
|
cluster = [];
|
|
510
|
-
|
|
517
|
+
colLast = [];
|
|
511
518
|
};
|
|
512
519
|
for (const s of sorted) {
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
let col = colEnds.findIndex((end) => end <= s.startMin);
|
|
518
|
-
if (col < 0) {
|
|
519
|
-
col = colEnds.length;
|
|
520
|
-
colEnds.push(0);
|
|
521
|
-
}
|
|
522
|
-
colEnds[col] = s.end;
|
|
520
|
+
if (!cluster.some((o) => collides(o, s, minMinutes))) flush();
|
|
521
|
+
let col = colLast.findIndex((last) => !collides(last, s, minMinutes));
|
|
522
|
+
if (col < 0) col = colLast.length;
|
|
523
523
|
const p = { ...s, col, cols: 1, span: 1, cluster: clusterIndex, split: false };
|
|
524
|
+
colLast[col] = p;
|
|
524
525
|
cluster.push(p);
|
|
525
526
|
out.push(p);
|
|
526
|
-
clusterEnd = Math.max(clusterEnd, s.end);
|
|
527
527
|
}
|
|
528
528
|
flush();
|
|
529
|
-
|
|
529
|
+
const starts = new Set(out.map((p) => p.startMin));
|
|
530
|
+
for (const p of out) if (p.endMin > p.startMin && p.startMin + minMinutes > p.endMin && starts.has(p.endMin)) p.abutted = true;
|
|
530
531
|
return out;
|
|
531
532
|
}
|
|
532
533
|
function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTES_PER_DAY]) {
|
|
@@ -548,15 +549,8 @@ function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTE
|
|
|
548
549
|
}
|
|
549
550
|
function markSplit(lane, other, minMinutes) {
|
|
550
551
|
if (!lane.length || !other.length) return;
|
|
551
|
-
const end = (p) => Math.max(p.endMin, p.startMin + minMinutes);
|
|
552
|
-
const ranges = /* @__PURE__ */ new Map();
|
|
553
|
-
for (const p of lane) {
|
|
554
|
-
const r = ranges.get(p.cluster);
|
|
555
|
-
if (r) r[1] = Math.max(r[1], end(p));
|
|
556
|
-
else ranges.set(p.cluster, [p.startMin, end(p)]);
|
|
557
|
-
}
|
|
558
552
|
const split = /* @__PURE__ */ new Set();
|
|
559
|
-
for (const
|
|
553
|
+
for (const p of lane) if (!split.has(p.cluster) && other.some((o) => overlaps(p, o, minMinutes))) split.add(p.cluster);
|
|
560
554
|
for (const p of lane) p.split = split.has(p.cluster);
|
|
561
555
|
}
|
|
562
556
|
function layoutRow(items, days, order = defaultOrder) {
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -502,43 +502,44 @@ function segmentInWindow(n, day, minMinute, maxMinute, zone) {
|
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
var defaultOrder = (a, b) => a.startMs - b.startMs || b.endMs - b.startMs - (a.endMs - a.startMs) || Number(b.allDay) - Number(a.allDay) || a.item.title.localeCompare(b.item.title);
|
|
505
|
+
function collides(a, b, minMinutes) {
|
|
506
|
+
if (b.startMin < a.endMin) return true;
|
|
507
|
+
if (b.startMin === a.endMin && a.endMin > a.startMin) return false;
|
|
508
|
+
return b.startMin < a.startMin + minMinutes;
|
|
509
|
+
}
|
|
510
|
+
function overlaps(a, b, minMinutes) {
|
|
511
|
+
return a.startMin <= b.startMin ? collides(a, b, minMinutes) : collides(b, a, minMinutes);
|
|
512
|
+
}
|
|
505
513
|
function packTimed(segs, minMinutes, order = defaultOrder) {
|
|
506
|
-
const sorted = segs.
|
|
514
|
+
const sorted = [...segs].sort((a, b) => a.startMin - b.startMin || Math.max(b.endMin, b.startMin + minMinutes) - Math.max(a.endMin, a.startMin + minMinutes) || order(a.item, b.item));
|
|
507
515
|
const out = [];
|
|
508
516
|
let cluster = [];
|
|
509
|
-
let
|
|
510
|
-
let clusterEnd = -Infinity;
|
|
517
|
+
let colLast = [];
|
|
511
518
|
let clusterIndex = 0;
|
|
512
519
|
const flush = () => {
|
|
513
520
|
if (cluster.length) clusterIndex++;
|
|
514
|
-
const cols =
|
|
521
|
+
const cols = colLast.length;
|
|
515
522
|
for (const p of cluster) {
|
|
516
523
|
p.cols = cols;
|
|
517
524
|
let span = 1;
|
|
518
|
-
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && o
|
|
525
|
+
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && overlaps(o, p, minMinutes))) span++;
|
|
519
526
|
p.span = span;
|
|
520
527
|
}
|
|
521
528
|
cluster = [];
|
|
522
|
-
|
|
529
|
+
colLast = [];
|
|
523
530
|
};
|
|
524
531
|
for (const s of sorted) {
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
let col = colEnds.findIndex((end) => end <= s.startMin);
|
|
530
|
-
if (col < 0) {
|
|
531
|
-
col = colEnds.length;
|
|
532
|
-
colEnds.push(0);
|
|
533
|
-
}
|
|
534
|
-
colEnds[col] = s.end;
|
|
532
|
+
if (!cluster.some((o) => collides(o, s, minMinutes))) flush();
|
|
533
|
+
let col = colLast.findIndex((last) => !collides(last, s, minMinutes));
|
|
534
|
+
if (col < 0) col = colLast.length;
|
|
535
535
|
const p = { ...s, col, cols: 1, span: 1, cluster: clusterIndex, split: false };
|
|
536
|
+
colLast[col] = p;
|
|
536
537
|
cluster.push(p);
|
|
537
538
|
out.push(p);
|
|
538
|
-
clusterEnd = Math.max(clusterEnd, s.end);
|
|
539
539
|
}
|
|
540
540
|
flush();
|
|
541
|
-
|
|
541
|
+
const starts = new Set(out.map((p) => p.startMin));
|
|
542
|
+
for (const p of out) if (p.endMin > p.startMin && p.startMin + minMinutes > p.endMin && starts.has(p.endMin)) p.abutted = true;
|
|
542
543
|
return out;
|
|
543
544
|
}
|
|
544
545
|
function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTES_PER_DAY]) {
|
|
@@ -560,15 +561,8 @@ function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTE
|
|
|
560
561
|
}
|
|
561
562
|
function markSplit(lane, other, minMinutes) {
|
|
562
563
|
if (!lane.length || !other.length) return;
|
|
563
|
-
const end = (p) => Math.max(p.endMin, p.startMin + minMinutes);
|
|
564
|
-
const ranges = /* @__PURE__ */ new Map();
|
|
565
|
-
for (const p of lane) {
|
|
566
|
-
const r = ranges.get(p.cluster);
|
|
567
|
-
if (r) r[1] = Math.max(r[1], end(p));
|
|
568
|
-
else ranges.set(p.cluster, [p.startMin, end(p)]);
|
|
569
|
-
}
|
|
570
564
|
const split = /* @__PURE__ */ new Set();
|
|
571
|
-
for (const
|
|
565
|
+
for (const p of lane) if (!split.has(p.cluster) && other.some((o) => overlaps(p, o, minMinutes))) split.add(p.cluster);
|
|
572
566
|
for (const p of lane) p.split = split.has(p.cluster);
|
|
573
567
|
}
|
|
574
568
|
function layoutRow(items, days, order = defaultOrder) {
|
|
@@ -2292,7 +2286,7 @@ var TimeGridView = class {
|
|
|
2292
2286
|
el.classList.toggle("is-short", short);
|
|
2293
2287
|
setStyle(el, {
|
|
2294
2288
|
top: top(p.startMin),
|
|
2295
|
-
height: `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
2289
|
+
height: p.abutted ? height(p) : `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
2296
2290
|
...inLane(lane, p.split, left, width),
|
|
2297
2291
|
"--tnc-event-readable-width": pct(span / cols / width),
|
|
2298
2292
|
"z-index": String(p.col + 1)
|
package/dist/cjs/react.cjs
CHANGED
|
@@ -838,43 +838,44 @@ function segmentInWindow(n, day, minMinute, maxMinute, zone) {
|
|
|
838
838
|
};
|
|
839
839
|
}
|
|
840
840
|
var defaultOrder = (a, b) => a.startMs - b.startMs || b.endMs - b.startMs - (a.endMs - a.startMs) || Number(b.allDay) - Number(a.allDay) || a.item.title.localeCompare(b.item.title);
|
|
841
|
+
function collides(a, b, minMinutes) {
|
|
842
|
+
if (b.startMin < a.endMin) return true;
|
|
843
|
+
if (b.startMin === a.endMin && a.endMin > a.startMin) return false;
|
|
844
|
+
return b.startMin < a.startMin + minMinutes;
|
|
845
|
+
}
|
|
846
|
+
function overlaps(a, b, minMinutes) {
|
|
847
|
+
return a.startMin <= b.startMin ? collides(a, b, minMinutes) : collides(b, a, minMinutes);
|
|
848
|
+
}
|
|
841
849
|
function packTimed(segs, minMinutes, order = defaultOrder) {
|
|
842
|
-
const sorted = segs.
|
|
850
|
+
const sorted = [...segs].sort((a, b) => a.startMin - b.startMin || Math.max(b.endMin, b.startMin + minMinutes) - Math.max(a.endMin, a.startMin + minMinutes) || order(a.item, b.item));
|
|
843
851
|
const out = [];
|
|
844
852
|
let cluster = [];
|
|
845
|
-
let
|
|
846
|
-
let clusterEnd = -Infinity;
|
|
853
|
+
let colLast = [];
|
|
847
854
|
let clusterIndex = 0;
|
|
848
855
|
const flush = () => {
|
|
849
856
|
if (cluster.length) clusterIndex++;
|
|
850
|
-
const cols =
|
|
857
|
+
const cols = colLast.length;
|
|
851
858
|
for (const p of cluster) {
|
|
852
859
|
p.cols = cols;
|
|
853
860
|
let span = 1;
|
|
854
|
-
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && o
|
|
861
|
+
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && overlaps(o, p, minMinutes))) span++;
|
|
855
862
|
p.span = span;
|
|
856
863
|
}
|
|
857
864
|
cluster = [];
|
|
858
|
-
|
|
865
|
+
colLast = [];
|
|
859
866
|
};
|
|
860
867
|
for (const s of sorted) {
|
|
861
|
-
if (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
let col = colEnds.findIndex((end) => end <= s.startMin);
|
|
866
|
-
if (col < 0) {
|
|
867
|
-
col = colEnds.length;
|
|
868
|
-
colEnds.push(0);
|
|
869
|
-
}
|
|
870
|
-
colEnds[col] = s.end;
|
|
868
|
+
if (!cluster.some((o) => collides(o, s, minMinutes))) flush();
|
|
869
|
+
let col = colLast.findIndex((last) => !collides(last, s, minMinutes));
|
|
870
|
+
if (col < 0) col = colLast.length;
|
|
871
871
|
const p = { ...s, col, cols: 1, span: 1, cluster: clusterIndex, split: false };
|
|
872
|
+
colLast[col] = p;
|
|
872
873
|
cluster.push(p);
|
|
873
874
|
out.push(p);
|
|
874
|
-
clusterEnd = Math.max(clusterEnd, s.end);
|
|
875
875
|
}
|
|
876
876
|
flush();
|
|
877
|
-
|
|
877
|
+
const starts = new Set(out.map((p) => p.startMin));
|
|
878
|
+
for (const p of out) if (p.endMin > p.startMin && p.startMin + minMinutes > p.endMin && starts.has(p.endMin)) p.abutted = true;
|
|
878
879
|
return out;
|
|
879
880
|
}
|
|
880
881
|
function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTES_PER_DAY]) {
|
|
@@ -896,15 +897,8 @@ function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTE
|
|
|
896
897
|
}
|
|
897
898
|
function markSplit(lane, other, minMinutes) {
|
|
898
899
|
if (!lane.length || !other.length) return;
|
|
899
|
-
const end = (p) => Math.max(p.endMin, p.startMin + minMinutes);
|
|
900
|
-
const ranges = /* @__PURE__ */ new Map();
|
|
901
|
-
for (const p of lane) {
|
|
902
|
-
const r = ranges.get(p.cluster);
|
|
903
|
-
if (r) r[1] = Math.max(r[1], end(p));
|
|
904
|
-
else ranges.set(p.cluster, [p.startMin, end(p)]);
|
|
905
|
-
}
|
|
906
900
|
const split = /* @__PURE__ */ new Set();
|
|
907
|
-
for (const
|
|
901
|
+
for (const p of lane) if (!split.has(p.cluster) && other.some((o) => overlaps(p, o, minMinutes))) split.add(p.cluster);
|
|
908
902
|
for (const p of lane) p.split = split.has(p.cluster);
|
|
909
903
|
}
|
|
910
904
|
function layoutRow(items, days, order = defaultOrder) {
|
|
@@ -2200,7 +2194,7 @@ var TimeGridView = class {
|
|
|
2200
2194
|
el.classList.toggle("is-short", short);
|
|
2201
2195
|
setStyle(el, {
|
|
2202
2196
|
top: top(p.startMin),
|
|
2203
|
-
height: `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
2197
|
+
height: p.abutted ? height(p) : `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
2204
2198
|
...inLane(lane, p.split, left, width),
|
|
2205
2199
|
"--tnc-event-readable-width": pct(span / cols / width),
|
|
2206
2200
|
"z-index": String(p.col + 1)
|
|
@@ -425,43 +425,44 @@ function segmentInWindow(n, day, minMinute, maxMinute, zone) {
|
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
var defaultOrder = (a, b) => a.startMs - b.startMs || b.endMs - b.startMs - (a.endMs - a.startMs) || Number(b.allDay) - Number(a.allDay) || a.item.title.localeCompare(b.item.title);
|
|
428
|
+
function collides(a, b, minMinutes) {
|
|
429
|
+
if (b.startMin < a.endMin) return true;
|
|
430
|
+
if (b.startMin === a.endMin && a.endMin > a.startMin) return false;
|
|
431
|
+
return b.startMin < a.startMin + minMinutes;
|
|
432
|
+
}
|
|
433
|
+
function overlaps(a, b, minMinutes) {
|
|
434
|
+
return a.startMin <= b.startMin ? collides(a, b, minMinutes) : collides(b, a, minMinutes);
|
|
435
|
+
}
|
|
428
436
|
function packTimed(segs, minMinutes, order = defaultOrder) {
|
|
429
|
-
const sorted = segs.
|
|
437
|
+
const sorted = [...segs].sort((a, b) => a.startMin - b.startMin || Math.max(b.endMin, b.startMin + minMinutes) - Math.max(a.endMin, a.startMin + minMinutes) || order(a.item, b.item));
|
|
430
438
|
const out = [];
|
|
431
439
|
let cluster = [];
|
|
432
|
-
let
|
|
433
|
-
let clusterEnd = -Infinity;
|
|
440
|
+
let colLast = [];
|
|
434
441
|
let clusterIndex = 0;
|
|
435
442
|
const flush = () => {
|
|
436
443
|
if (cluster.length) clusterIndex++;
|
|
437
|
-
const cols =
|
|
444
|
+
const cols = colLast.length;
|
|
438
445
|
for (const p of cluster) {
|
|
439
446
|
p.cols = cols;
|
|
440
447
|
let span = 1;
|
|
441
|
-
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && o
|
|
448
|
+
while (p.col + span < cols && !cluster.some((o) => o.col === p.col + span && overlaps(o, p, minMinutes))) span++;
|
|
442
449
|
p.span = span;
|
|
443
450
|
}
|
|
444
451
|
cluster = [];
|
|
445
|
-
|
|
452
|
+
colLast = [];
|
|
446
453
|
};
|
|
447
454
|
for (const s of sorted) {
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
let col = colEnds.findIndex((end) => end <= s.startMin);
|
|
453
|
-
if (col < 0) {
|
|
454
|
-
col = colEnds.length;
|
|
455
|
-
colEnds.push(0);
|
|
456
|
-
}
|
|
457
|
-
colEnds[col] = s.end;
|
|
455
|
+
if (!cluster.some((o) => collides(o, s, minMinutes))) flush();
|
|
456
|
+
let col = colLast.findIndex((last) => !collides(last, s, minMinutes));
|
|
457
|
+
if (col < 0) col = colLast.length;
|
|
458
458
|
const p = { ...s, col, cols: 1, span: 1, cluster: clusterIndex, split: false };
|
|
459
|
+
colLast[col] = p;
|
|
459
460
|
cluster.push(p);
|
|
460
461
|
out.push(p);
|
|
461
|
-
clusterEnd = Math.max(clusterEnd, s.end);
|
|
462
462
|
}
|
|
463
463
|
flush();
|
|
464
|
-
|
|
464
|
+
const starts = new Set(out.map((p) => p.startMin));
|
|
465
|
+
for (const p of out) if (p.endMin > p.startMin && p.startMin + minMinutes > p.endMin && starts.has(p.endMin)) p.abutted = true;
|
|
465
466
|
return out;
|
|
466
467
|
}
|
|
467
468
|
function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTES_PER_DAY]) {
|
|
@@ -483,15 +484,8 @@ function layoutTimedDay(items, day, zone, minMinutes, order, window = [0, MINUTE
|
|
|
483
484
|
}
|
|
484
485
|
function markSplit(lane, other, minMinutes) {
|
|
485
486
|
if (!lane.length || !other.length) return;
|
|
486
|
-
const end = (p) => Math.max(p.endMin, p.startMin + minMinutes);
|
|
487
|
-
const ranges = /* @__PURE__ */ new Map();
|
|
488
|
-
for (const p of lane) {
|
|
489
|
-
const r = ranges.get(p.cluster);
|
|
490
|
-
if (r) r[1] = Math.max(r[1], end(p));
|
|
491
|
-
else ranges.set(p.cluster, [p.startMin, end(p)]);
|
|
492
|
-
}
|
|
493
487
|
const split = /* @__PURE__ */ new Set();
|
|
494
|
-
for (const
|
|
488
|
+
for (const p of lane) if (!split.has(p.cluster) && other.some((o) => overlaps(p, o, minMinutes))) split.add(p.cluster);
|
|
495
489
|
for (const p of lane) p.split = split.has(p.cluster);
|
|
496
490
|
}
|
|
497
491
|
function layoutRow(items, days, order = defaultOrder) {
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
wallTime,
|
|
28
28
|
weekdayOf,
|
|
29
29
|
ymdOfDay
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-JWORVABV.js";
|
|
31
31
|
|
|
32
32
|
// src/dom/format.ts
|
|
33
33
|
var Formatter = class {
|
|
@@ -1577,7 +1577,7 @@ var TimeGridView = class {
|
|
|
1577
1577
|
el.classList.toggle("is-short", short);
|
|
1578
1578
|
setStyle(el, {
|
|
1579
1579
|
top: top(p.startMin),
|
|
1580
|
-
height: `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
1580
|
+
height: p.abutted ? height(p) : `max(${height(p)}, ${opts.eventMinHeight}px)`,
|
|
1581
1581
|
...inLane(lane, p.split, left, width),
|
|
1582
1582
|
"--tnc-event-readable-width": pct(span / cols / width),
|
|
1583
1583
|
"z-index": String(p.col + 1)
|
package/dist/esm/core.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TIMELINE_UNIT_DAYS,
|
|
8
8
|
defaultOptions,
|
|
9
9
|
localeFirstDay
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TTM45UAN.js";
|
|
11
11
|
import {
|
|
12
12
|
DAY_MS,
|
|
13
13
|
ItemStore,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
wallTime,
|
|
50
50
|
weekdayOf,
|
|
51
51
|
ymdOfDay
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-JWORVABV.js";
|
|
53
53
|
|
|
54
54
|
// src/tasknotes/bases.ts
|
|
55
55
|
var FROM_BASES = {
|
package/dist/esm/react.js
CHANGED
|
@@ -24,6 +24,11 @@ export interface TimedPlacement<D = unknown> extends TimedSegment<D> {
|
|
|
24
24
|
* Only then does the item keep to its lane's share of the column.
|
|
25
25
|
*/
|
|
26
26
|
split: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Another item starts exactly where this short one ends, so it is drawn at
|
|
29
|
+
* its real height instead of being stretched to the minimum height.
|
|
30
|
+
*/
|
|
31
|
+
abutted?: boolean;
|
|
27
32
|
}
|
|
28
33
|
export interface TimedDayLayout<D = unknown> {
|
|
29
34
|
day: Day;
|
|
@@ -24,6 +24,11 @@ export interface TimedPlacement<D = unknown> extends TimedSegment<D> {
|
|
|
24
24
|
* Only then does the item keep to its lane's share of the column.
|
|
25
25
|
*/
|
|
26
26
|
split: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Another item starts exactly where this short one ends, so it is drawn at
|
|
29
|
+
* its real height instead of being stretched to the minimum height.
|
|
30
|
+
*/
|
|
31
|
+
abutted?: boolean;
|
|
27
32
|
}
|
|
28
33
|
export interface TimedDayLayout<D = unknown> {
|
|
29
34
|
day: Day;
|
package/package.json
CHANGED