@tasknotes/calendar 0.1.2 → 0.1.4

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,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Added
6
+
7
+ - `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.
8
+ - Agenda lists can show a lead section above the first day (`listLeadTitle`, `listLeadIncludes`, `listLeadDidMount`) and an add row under every day (`listAddText`, `onListAdd`).
9
+ - The strip shows a Today chip when it is away from today.
10
+ - `ViewInfo.dataRange` covers the days a strip shows past the visible range, so hosts can load items for every strip dot.
11
+
12
+ ### Changed
13
+
14
+ - 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.
15
+
16
+ ## 0.1.3
17
+
18
+ ### Added
19
+
20
+ - `listAgenda` turns the list view into a phone-style agenda. A date strip sits above a list of every day, and more days load as you scroll. The strip shows a week, or the month after a tap on its title. It marks busy days and follows the day at the top of the list. Picking a strip day scrolls the list to it. Rows can be dragged onto another day or a strip day.
21
+
22
+ ### Fixed
23
+
24
+ - On touch screens, a swipe that starts on a draggable item scrolls whatever actually scrolls. At `height: "auto"` that is the page, which these swipes did not scroll before.
25
+
3
26
  ## 0.1.2
4
27
 
5
28
  ### Changed
package/README.md CHANGED
@@ -73,6 +73,11 @@ custom DOM. The exported `CalendarOptions<D>` type documents the full API.
73
73
  - `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
74
  - **"+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
75
  - `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. 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`.
77
+ - `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.
78
+ - `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.
79
+ - `listAddText: string | null` and `onListAdd(arg)`: in an agenda, an add row under every day, reported with that day.
80
+ - `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.
76
81
 
77
82
  ### Timeline
78
83
 
@@ -161,4 +166,4 @@ Append `-- --update-snapshots` to the test command to regenerate baselines
161
166
  the date, timezone, locale, viewport, colour scheme and motion preference.
162
167
  Keep the image version and the exact `@playwright/test` pin in sync.
163
168
 
164
- The playground reads URL parameters (`view`, `tz`, `locale`, `date`, `theme`, `stress`, `height`, `capacity`, `display=dots`, `listStart=week`) and exposes `window.tnc` for scripted checks.
169
+ 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
@@ -875,6 +875,273 @@
875
875
  color: var(--tnc-faint);
876
876
  }
877
877
 
878
+ /* ---------------------------------------------------------------- agenda */
879
+ .tnc-strip {
880
+ --tnc-strip-cell: 40px;
881
+ flex: none;
882
+ /* Above a time grid's sticky header and now line; popovers stay on top. */
883
+ position: relative;
884
+ z-index: 55;
885
+ padding: 6px 4px 0;
886
+ background: var(--tnc-surface);
887
+ border-bottom: 1px solid var(--tnc-line);
888
+ /* Vertical pans scroll the page; sideways swipes step the strip. */
889
+ touch-action: pan-y;
890
+ user-select: none;
891
+ }
892
+ /* At auto height the page scrolls, so the strip sticks below `--tnc-sticky-top`. */
893
+ .tnc--height-auto .tnc-strip {
894
+ position: sticky;
895
+ top: var(--tnc-sticky-top, 0px);
896
+ }
897
+ .tnc--height-auto.tnc--has-strip .tnc-tg-top {
898
+ top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
899
+ }
900
+ .tnc--height-auto .tnc-list--agenda .tnc-list-day {
901
+ top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
902
+ }
903
+ .tnc--height-auto .tnc-list--agenda .tnc-list-section {
904
+ scroll-margin-top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
905
+ }
906
+ .tnc-strip-head {
907
+ display: flex;
908
+ align-items: center;
909
+ gap: 2px;
910
+ padding: 0 6px 6px;
911
+ }
912
+ .tnc-strip-title {
913
+ display: inline-flex;
914
+ align-items: center;
915
+ gap: 6px;
916
+ margin-right: auto;
917
+ padding: 4px 6px;
918
+ border: 0;
919
+ border-radius: var(--tnc-radius);
920
+ background: none;
921
+ color: var(--tnc-text);
922
+ font: inherit;
923
+ font-size: 15px;
924
+ font-weight: 650;
925
+ cursor: pointer;
926
+ }
927
+ .tnc-strip-caret {
928
+ width: 0;
929
+ height: 0;
930
+ border-left: 5px solid transparent;
931
+ border-right: 5px solid transparent;
932
+ border-top: 6px solid currentColor;
933
+ transition: transform 0.15s;
934
+ }
935
+ .tnc-strip.is-expanded .tnc-strip-title {
936
+ color: var(--tnc-accent);
937
+ }
938
+ .tnc-strip.is-expanded .tnc-strip-caret {
939
+ transform: rotate(180deg);
940
+ }
941
+ .tnc-strip-today {
942
+ margin-right: 4px;
943
+ padding: 4px 10px;
944
+ border: 1px solid var(--tnc-line-strong);
945
+ border-radius: 999px;
946
+ background: none;
947
+ color: var(--tnc-text);
948
+ font: inherit;
949
+ font-size: var(--tnc-small);
950
+ font-weight: 600;
951
+ cursor: pointer;
952
+ }
953
+ .tnc-strip-today[hidden] {
954
+ display: none;
955
+ }
956
+ .tnc-strip-today:hover {
957
+ background: var(--tnc-surface-2);
958
+ }
959
+ .tnc-strip-slot {
960
+ display: flex;
961
+ align-items: center;
962
+ }
963
+ .tnc-strip-slot:empty {
964
+ display: none;
965
+ }
966
+ .tnc-strip-nav {
967
+ width: 32px;
968
+ height: 32px;
969
+ border: 0;
970
+ border-radius: var(--tnc-radius);
971
+ background: none;
972
+ color: var(--tnc-muted);
973
+ font-size: 20px;
974
+ line-height: 1;
975
+ cursor: pointer;
976
+ }
977
+ .tnc-strip-title:hover,
978
+ .tnc-strip-nav:hover {
979
+ background: var(--tnc-surface-2);
980
+ }
981
+ .tnc-strip-dows,
982
+ .tnc-strip-grid {
983
+ display: grid;
984
+ grid-template-columns: repeat(7, minmax(0, 1fr));
985
+ }
986
+ .tnc-strip-dows span {
987
+ padding-bottom: 4px;
988
+ text-align: center;
989
+ color: var(--tnc-muted);
990
+ font-size: var(--tnc-small);
991
+ font-weight: 600;
992
+ }
993
+ .tnc-strip-day {
994
+ position: relative;
995
+ display: flex;
996
+ flex-direction: column;
997
+ align-items: center;
998
+ justify-content: center;
999
+ min-height: calc(var(--tnc-strip-cell) + 10px);
1000
+ padding: 0;
1001
+ border: 0;
1002
+ border-radius: var(--tnc-radius);
1003
+ background: none;
1004
+ color: var(--tnc-text);
1005
+ font: inherit;
1006
+ cursor: pointer;
1007
+ }
1008
+ .tnc-strip-num {
1009
+ display: grid;
1010
+ place-items: center;
1011
+ width: min(var(--tnc-strip-cell), 100%);
1012
+ aspect-ratio: 1;
1013
+ border-radius: 50%;
1014
+ font-size: 15px;
1015
+ font-variant-numeric: tabular-nums;
1016
+ }
1017
+ .tnc-strip-month {
1018
+ position: absolute;
1019
+ top: 0;
1020
+ color: var(--tnc-muted);
1021
+ font-size: 10px;
1022
+ font-weight: 650;
1023
+ line-height: 1;
1024
+ }
1025
+ .tnc-strip-dot {
1026
+ width: 5px;
1027
+ height: 5px;
1028
+ margin-top: 1px;
1029
+ border-radius: 50%;
1030
+ visibility: hidden;
1031
+ background: var(--tnc-muted);
1032
+ }
1033
+ .tnc-strip-day.has-items .tnc-strip-dot {
1034
+ visibility: visible;
1035
+ }
1036
+ .tnc-strip-day.is-past,
1037
+ .tnc-strip-day.is-other-month {
1038
+ color: var(--tnc-faint);
1039
+ }
1040
+ .tnc-strip-day.is-today .tnc-strip-num {
1041
+ color: var(--tnc-accent);
1042
+ font-weight: 700;
1043
+ }
1044
+ .tnc-strip-day.is-focus .tnc-strip-num {
1045
+ background: var(--tnc-accent);
1046
+ color: var(--tnc-accent-text);
1047
+ font-weight: 700;
1048
+ }
1049
+ .tnc-strip-day.is-in-range .tnc-strip-num {
1050
+ background: var(--tnc-accent-soft);
1051
+ }
1052
+ .tnc-strip-day:hover .tnc-strip-num {
1053
+ background: var(--tnc-surface-2);
1054
+ }
1055
+ .tnc-strip-day.is-focus:hover .tnc-strip-num {
1056
+ background: var(--tnc-accent);
1057
+ }
1058
+ .tnc-strip-day.is-drop-target .tnc-strip-num {
1059
+ box-shadow: 0 0 0 2px var(--tnc-accent);
1060
+ background: var(--tnc-accent-soft);
1061
+ }
1062
+ .tnc-strip-day:focus-visible,
1063
+ .tnc-strip-title:focus-visible,
1064
+ .tnc-strip-today:focus-visible,
1065
+ .tnc-strip-nav:focus-visible {
1066
+ outline: 2px solid var(--tnc-accent);
1067
+ outline-offset: -2px;
1068
+ }
1069
+ .tnc-strip-handle {
1070
+ display: block;
1071
+ width: 36px;
1072
+ height: 14px;
1073
+ margin: 0 auto;
1074
+ padding: 0;
1075
+ border: 0;
1076
+ background: none;
1077
+ cursor: pointer;
1078
+ }
1079
+ .tnc-strip-handle::before {
1080
+ content: "";
1081
+ display: block;
1082
+ width: 36px;
1083
+ height: 4px;
1084
+ margin: 0 auto;
1085
+ border-radius: 2px;
1086
+ background: var(--tnc-line-strong);
1087
+ }
1088
+ .tnc-list--agenda .tnc-list-section.is-empty .tnc-list-day {
1089
+ color: var(--tnc-faint);
1090
+ font-weight: 600;
1091
+ }
1092
+ .tnc-list--agenda .tnc-list-section.is-empty:not(:has(.tnc-list-add)) .tnc-list-rows {
1093
+ min-height: 28px;
1094
+ }
1095
+ .tnc-list-lead-head {
1096
+ display: flex;
1097
+ align-items: center;
1098
+ gap: 8px;
1099
+ color: var(--tnc-text);
1100
+ }
1101
+ .tnc-list-lead-title {
1102
+ margin-right: auto;
1103
+ }
1104
+ .tnc-list-lead-slot {
1105
+ display: flex;
1106
+ align-items: center;
1107
+ font-weight: 400;
1108
+ }
1109
+ .tnc-list-lead-slot:empty {
1110
+ display: none;
1111
+ }
1112
+ .tnc-list-add {
1113
+ display: block;
1114
+ width: 100%;
1115
+ padding: 6px 10px;
1116
+ border: 0;
1117
+ background: none;
1118
+ color: var(--tnc-muted);
1119
+ font: inherit;
1120
+ font-size: var(--tnc-small);
1121
+ text-align: left;
1122
+ cursor: pointer;
1123
+ }
1124
+ .tnc-list-add::before {
1125
+ content: "+";
1126
+ display: inline-block;
1127
+ width: 1em;
1128
+ margin-right: 6px;
1129
+ color: var(--tnc-accent);
1130
+ font-weight: 700;
1131
+ text-align: center;
1132
+ }
1133
+ .tnc-list-add:hover {
1134
+ color: var(--tnc-accent);
1135
+ background: var(--tnc-surface-2);
1136
+ }
1137
+ .tnc-list-add:focus-visible {
1138
+ outline: 2px solid var(--tnc-accent);
1139
+ outline-offset: -2px;
1140
+ }
1141
+ .tnc-list-more {
1142
+ height: 1px;
1143
+ }
1144
+
878
1145
  /* ------------------------------------------------------------------ year */
879
1146
  .tnc-year {
880
1147
  display: flex;