@tasknotes/calendar 0.1.3 → 0.1.5

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Added
6
+
7
+ - Host-managed `CalendarItem.preview` placements for group drags. They use mirror styling, are non-interactive and hidden from assistive navigation, and remain visible beyond month/all-day event limits and timed stack limits. Multiple overflow previews stack separately.
8
+ - Supports the TaskNotes batch-scheduling workflow requested by @mnicolas94 in [Discussion 2435](https://github.com/callumalpass/tasknotes/discussions/2435), with the existing limitations clarified by @Thanatos9404.
9
+
10
+ ### Fixed
11
+
12
+ - The dragged anchor remains visible when moving into a timed cluster limited by `eventMaxStack`.
13
+
14
+ ## 0.1.4
15
+
16
+ ### Added
17
+
18
+ - `dateStrip` puts the agenda's date strip above day, multi-day and week views. Picking a strip day moves the grid there, and items can be dropped on strip days.
19
+ - Agenda lists can show a lead section above the first day (`listLeadTitle`, `listLeadIncludes`, `listLeadDidMount`) and an add row under every day (`listAddText`, `onListAdd`).
20
+ - The strip shows a Today chip when it is away from today.
21
+ - `ViewInfo.dataRange` covers the days a strip shows past the visible range, so hosts can load items for every strip dot.
22
+
23
+ ### Changed
24
+
25
+ - The date strip belongs to the calendar rather than the list, so it keeps its state (and any host controls in its slot) across navigation and view changes.
26
+
3
27
  ## 0.1.3
4
28
 
5
29
  ### Added
package/README.md CHANGED
@@ -41,6 +41,7 @@ The host persists changes; the calendar supplies optimistic updates and a
41
41
  - **Items** take `start`/`end` as `YYYY-MM-DD` (all-day) or `YYYY-MM-DDTHH:mm` (floating, read in the calendar's zone), ISO strings with an offset, or epoch ms. `end` is exclusive. Optional fields: `allDay`, `color`, `kind`, `lane` (`"plan"`/`"actual"`), `display: "background"`, `completed`, `dependsOn`, `rev` (cheap change signature), `data`.
42
42
  - **Updates** are incremental: `setItems` diffs against the previous set, and `upsertItems`/`removeItems` re-render only the days touched. Render hooks (`itemDidMount`, …) fire only for elements that actually change, but every callback's `item` is the object most recently passed in for that id, so `item.data` is never stale.
43
43
  - **Render hooks** (`itemContent`, `itemClassNames`, `itemDidMount`, `itemWillUnmount`, `listItemContent`) get `variant` (`"timed"`, `"bar"`, `"dot"`, `"indicator"`, `"list"`, `"timeline"`) and `timeText`, the time label in the calendar's locale and hour format (`"9am – 10:30am"` for timed, list and timeline items, the start for bars and dots, empty for all-day items).
44
+ - **Preview items**: set `preview: true` on a temporary item passed through `upsertItems` to show a host-managed group-drag placement. Previews have mirror styling, are hidden from assistive navigation, cannot be activated or edited, and remain visible beyond month/all-day event limits and timed stack limits. Multiple overflow previews stack without covering each other. `itemDidMount` reports `isMirror: true`. Restore the original item (or remove the preview ID) on drop, cancellation, source refresh and teardown; this flag does not persist or automatically commit a group.
44
45
  - **Drags** move the item itself with the pointer in every view (time grid, all-day row, month, timeline), for mouse and touch; the dragged item is never folded into "+N more".
45
46
  - **Changes** (`onItemDrop`, `onItemResize`, `onSelect`, `onExternalDrop`) report TaskNotes storage strings (`startStr`/`endStr`), `revert()`, and `source: "pointer" | "keyboard"`. Returning a rejected promise reverts.
46
47
  - **Clicks**: `onDateClick` reports `minute` (the slot's wall-clock minute, snapped to `slotDuration`; null for day cells and the all-day row), `allDay` and `startStr` (`"YYYY-MM-DD"` or `"YYYY-MM-DDTHH:mm"`), so a tap on a slot can prefill a time.
@@ -73,7 +74,11 @@ custom DOM. The exported `CalendarOptions<D>` type documents the full API.
73
74
  - `monthDisplay: "dots"` draws every item in a month cell as a small dot (`--tnc-dot-size`, `--tnc-dot-gap`) that wraps across the cell, with "+N" when they do not fit; `dayMaxEvents` caps the dots (`false` lets cells grow). The day cell is the tap target: dots ignore the pointer, are `aria-hidden`, get no content hook, and the cell is labelled "<date>, N items" (`text.itemCount`). Items in dots have `variant: "indicator"`; colour them with `color` or `itemDidMount` setting `--tnc-c`.
74
75
  - **"+N more" height**: day rows (and the time grid's all-day row) make room for the link at its rendered height, so a host may give it a 44px touch target (`--tnc-more-h`, or any min-height) without overflowing the row.
75
76
  - `listStart: "date" | "week"`: the list view starts at the date (default; FullCalendar `duration: { days: n }` lists, as the TaskNotes plugin and app used) or at the start of its week (FullCalendar's stock `listWeek`); week-aligned lists step by whole weeks.
76
- - `listAgenda: boolean`: turns the list view into a phone-style agenda. A date strip shows one week, or the whole month after a tap on its title, with a dot on busy days and the day at the top of the list marked. Below it, every day gets a section, empty days included, and more days load as the list nears its end. Picking a strip day scrolls the list to it and reports it through `onDateClick`. Rows can be dragged onto another day's section or a strip day; timed items keep their time. At `height: "auto"` the strip sticks to the top of the page; set `--tnc-sticky-top` to keep it below a fixed host header.
77
+ - `listAgenda: boolean`: turns the list view into a phone-style agenda. A date strip shows one week, or the whole month after a tap on its title, with a dot on busy days and the day at the top of the list marked. Below it, every day gets a section, empty days included, and more days load as the list nears its end. Picking a strip day scrolls the list to it and reports it through `onDateClick`. Rows can be dragged onto another day's section or a strip day; timed items keep their time. At `height: "auto"` the strip sticks to the top of the page; set `--tnc-sticky-top` to keep it below a fixed host header. A Today chip appears in the strip's header when the list is away from today. Hosts can mount controls after the strip's arrows with `stripSlotDidMount`.
78
+ - `dateStrip: boolean`: puts the same strip above the `day`, `days` and `week` views. Picking a day moves the grid to it, the rest of the grid's range is tinted, and items dragged onto a strip day move there at the same time.
79
+ - `listLeadTitle: string | null` and `listLeadIncludes(item)`: in an agenda, a section above the first day holds the items `listLeadIncludes` picks out (overdue work, say) instead of their days. `listLeadDidMount` gives hosts a slot in its header for actions.
80
+ - `listAddText: string | null` and `onListAdd(arg)`: in an agenda, an add row under every day, reported with that day.
81
+ - `ViewInfo.dataRange`: the visible range, run on to the end of the days a strip shows. Load items for `dataRange` so every strip day gets its dot; `onRangeChange` also fires when only it changes.
77
82
 
78
83
  ### Timeline
79
84
 
@@ -162,4 +167,4 @@ Append `-- --update-snapshots` to the test command to regenerate baselines
162
167
  the date, timezone, locale, viewport, colour scheme and motion preference.
163
168
  Keep the image version and the exact `@playwright/test` pin in sync.
164
169
 
165
- The playground reads URL parameters (`view`, `tz`, `locale`, `date`, `theme`, `stress`, `height`, `capacity`, `display=dots`, `listStart=week`, `agenda=1`) and exposes `window.tnc` for scripted checks.
170
+ The playground reads URL parameters (`view`, `tz`, `locale`, `date`, `theme`, `stress`, `height`, `capacity`, `display=dots`, `listStart=week`, `agenda=1` (agenda list and day strips with add rows), `lead=1` (a Due lead section)) and exposes `window.tnc` for scripted checks.
package/dist/calendar.css CHANGED
@@ -224,9 +224,10 @@
224
224
  opacity: 0.92;
225
225
  }
226
226
  .tnc-item.is-mirror {
227
+ z-index: 40 !important;
227
228
  opacity: 0.8;
228
229
  border-style: dashed !important;
229
- pointer-events: none;
230
+ pointer-events: none !important;
230
231
  }
231
232
 
232
233
  /* timed (time grid) */
@@ -876,12 +877,12 @@
876
877
  }
877
878
 
878
879
  /* ---------------------------------------------------------------- agenda */
879
- .tnc-list--agenda {
880
- --tnc-strip-cell: 40px;
881
- }
882
880
  .tnc-strip {
881
+ --tnc-strip-cell: 40px;
883
882
  flex: none;
884
- z-index: 3;
883
+ /* Above a time grid's sticky header and now line; popovers stay on top. */
884
+ position: relative;
885
+ z-index: 55;
885
886
  padding: 6px 4px 0;
886
887
  background: var(--tnc-surface);
887
888
  border-bottom: 1px solid var(--tnc-line);
@@ -894,6 +895,9 @@
894
895
  position: sticky;
895
896
  top: var(--tnc-sticky-top, 0px);
896
897
  }
898
+ .tnc--height-auto.tnc--has-strip .tnc-tg-top {
899
+ top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
900
+ }
897
901
  .tnc--height-auto .tnc-list--agenda .tnc-list-day {
898
902
  top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
899
903
  }
@@ -935,6 +939,24 @@
935
939
  .tnc-strip.is-expanded .tnc-strip-caret {
936
940
  transform: rotate(180deg);
937
941
  }
942
+ .tnc-strip-today {
943
+ margin-right: 4px;
944
+ padding: 4px 10px;
945
+ border: 1px solid var(--tnc-line-strong);
946
+ border-radius: 999px;
947
+ background: none;
948
+ color: var(--tnc-text);
949
+ font: inherit;
950
+ font-size: var(--tnc-small);
951
+ font-weight: 600;
952
+ cursor: pointer;
953
+ }
954
+ .tnc-strip-today[hidden] {
955
+ display: none;
956
+ }
957
+ .tnc-strip-today:hover {
958
+ background: var(--tnc-surface-2);
959
+ }
938
960
  .tnc-strip-slot {
939
961
  display: flex;
940
962
  align-items: center;
@@ -1025,6 +1047,9 @@
1025
1047
  color: var(--tnc-accent-text);
1026
1048
  font-weight: 700;
1027
1049
  }
1050
+ .tnc-strip-day.is-in-range .tnc-strip-num {
1051
+ background: var(--tnc-accent-soft);
1052
+ }
1028
1053
  .tnc-strip-day:hover .tnc-strip-num {
1029
1054
  background: var(--tnc-surface-2);
1030
1055
  }
@@ -1037,6 +1062,7 @@
1037
1062
  }
1038
1063
  .tnc-strip-day:focus-visible,
1039
1064
  .tnc-strip-title:focus-visible,
1065
+ .tnc-strip-today:focus-visible,
1040
1066
  .tnc-strip-nav:focus-visible {
1041
1067
  outline: 2px solid var(--tnc-accent);
1042
1068
  outline-offset: -2px;
@@ -1064,9 +1090,55 @@
1064
1090
  color: var(--tnc-faint);
1065
1091
  font-weight: 600;
1066
1092
  }
1067
- .tnc-list--agenda .tnc-list-section.is-empty .tnc-list-rows {
1093
+ .tnc-list--agenda .tnc-list-section.is-empty:not(:has(.tnc-list-add)) .tnc-list-rows {
1068
1094
  min-height: 28px;
1069
1095
  }
1096
+ .tnc-list-lead-head {
1097
+ display: flex;
1098
+ align-items: center;
1099
+ gap: 8px;
1100
+ color: var(--tnc-text);
1101
+ }
1102
+ .tnc-list-lead-title {
1103
+ margin-right: auto;
1104
+ }
1105
+ .tnc-list-lead-slot {
1106
+ display: flex;
1107
+ align-items: center;
1108
+ font-weight: 400;
1109
+ }
1110
+ .tnc-list-lead-slot:empty {
1111
+ display: none;
1112
+ }
1113
+ .tnc-list-add {
1114
+ display: block;
1115
+ width: 100%;
1116
+ padding: 6px 10px;
1117
+ border: 0;
1118
+ background: none;
1119
+ color: var(--tnc-muted);
1120
+ font: inherit;
1121
+ font-size: var(--tnc-small);
1122
+ text-align: left;
1123
+ cursor: pointer;
1124
+ }
1125
+ .tnc-list-add::before {
1126
+ content: "+";
1127
+ display: inline-block;
1128
+ width: 1em;
1129
+ margin-right: 6px;
1130
+ color: var(--tnc-accent);
1131
+ font-weight: 700;
1132
+ text-align: center;
1133
+ }
1134
+ .tnc-list-add:hover {
1135
+ color: var(--tnc-accent);
1136
+ background: var(--tnc-surface-2);
1137
+ }
1138
+ .tnc-list-add:focus-visible {
1139
+ outline: 2px solid var(--tnc-accent);
1140
+ outline-offset: -2px;
1141
+ }
1070
1142
  .tnc-list-more {
1071
1143
  height: 1px;
1072
1144
  }