@tasknotes/calendar 0.1.1 → 0.1.3

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,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Added
6
+
7
+ - `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.
8
+
9
+ ### Fixed
10
+
11
+ - 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.
12
+
13
+ ## 0.1.2
14
+
15
+ ### Changed
16
+
17
+ - Year views narrower than 520px (phones, sidebars) show two compact months a row. Days are shaded by how busy they are, with no dots, and any day with items is visibly shaded.
18
+
19
+ ### Fixed
20
+
21
+ - Clicking or tapping a day in the year view reports it through `onDateClick`. Before, only Enter or Space on a focused day did.
22
+ - The calendar keeps its sticky headers and popovers in its own stacking context, so host overlays such as side sheets and dialogs draw above the week header and all-day row.
23
+
3
24
  ## 0.1.1
4
25
 
5
26
  ### Fixed
package/README.md CHANGED
@@ -73,6 +73,7 @@ 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.
76
77
 
77
78
  ### Timeline
78
79
 
@@ -161,4 +162,4 @@ Append `-- --update-snapshots` to the test command to regenerate baselines
161
162
  the date, timezone, locale, viewport, colour scheme and motion preference.
162
163
  Keep the image version and the exact `@playwright/test` pin in sync.
163
164
 
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.
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.
package/dist/calendar.css CHANGED
@@ -40,6 +40,8 @@
40
40
  --tnc-item-c: var(--tnc-accent);
41
41
 
42
42
  position: relative;
43
+ /* Keep the calendar's own layers (sticky headers, popovers) below host overlays. */
44
+ isolation: isolate;
43
45
  display: flex;
44
46
  flex-direction: column;
45
47
  min-height: 0;
@@ -873,11 +875,209 @@
873
875
  color: var(--tnc-faint);
874
876
  }
875
877
 
878
+ /* ---------------------------------------------------------------- agenda */
879
+ .tnc-list--agenda {
880
+ --tnc-strip-cell: 40px;
881
+ }
882
+ .tnc-strip {
883
+ flex: none;
884
+ z-index: 3;
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-list--agenda .tnc-list-day {
898
+ top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
899
+ }
900
+ .tnc--height-auto .tnc-list--agenda .tnc-list-section {
901
+ scroll-margin-top: calc(var(--tnc-sticky-top, 0px) + var(--tnc-strip-h, 0px));
902
+ }
903
+ .tnc-strip-head {
904
+ display: flex;
905
+ align-items: center;
906
+ gap: 2px;
907
+ padding: 0 6px 6px;
908
+ }
909
+ .tnc-strip-title {
910
+ display: inline-flex;
911
+ align-items: center;
912
+ gap: 6px;
913
+ margin-right: auto;
914
+ padding: 4px 6px;
915
+ border: 0;
916
+ border-radius: var(--tnc-radius);
917
+ background: none;
918
+ color: var(--tnc-text);
919
+ font: inherit;
920
+ font-size: 15px;
921
+ font-weight: 650;
922
+ cursor: pointer;
923
+ }
924
+ .tnc-strip-caret {
925
+ width: 0;
926
+ height: 0;
927
+ border-left: 5px solid transparent;
928
+ border-right: 5px solid transparent;
929
+ border-top: 6px solid currentColor;
930
+ transition: transform 0.15s;
931
+ }
932
+ .tnc-strip.is-expanded .tnc-strip-title {
933
+ color: var(--tnc-accent);
934
+ }
935
+ .tnc-strip.is-expanded .tnc-strip-caret {
936
+ transform: rotate(180deg);
937
+ }
938
+ .tnc-strip-slot {
939
+ display: flex;
940
+ align-items: center;
941
+ }
942
+ .tnc-strip-slot:empty {
943
+ display: none;
944
+ }
945
+ .tnc-strip-nav {
946
+ width: 32px;
947
+ height: 32px;
948
+ border: 0;
949
+ border-radius: var(--tnc-radius);
950
+ background: none;
951
+ color: var(--tnc-muted);
952
+ font-size: 20px;
953
+ line-height: 1;
954
+ cursor: pointer;
955
+ }
956
+ .tnc-strip-title:hover,
957
+ .tnc-strip-nav:hover {
958
+ background: var(--tnc-surface-2);
959
+ }
960
+ .tnc-strip-dows,
961
+ .tnc-strip-grid {
962
+ display: grid;
963
+ grid-template-columns: repeat(7, minmax(0, 1fr));
964
+ }
965
+ .tnc-strip-dows span {
966
+ padding-bottom: 4px;
967
+ text-align: center;
968
+ color: var(--tnc-muted);
969
+ font-size: var(--tnc-small);
970
+ font-weight: 600;
971
+ }
972
+ .tnc-strip-day {
973
+ position: relative;
974
+ display: flex;
975
+ flex-direction: column;
976
+ align-items: center;
977
+ justify-content: center;
978
+ min-height: calc(var(--tnc-strip-cell) + 10px);
979
+ padding: 0;
980
+ border: 0;
981
+ border-radius: var(--tnc-radius);
982
+ background: none;
983
+ color: var(--tnc-text);
984
+ font: inherit;
985
+ cursor: pointer;
986
+ }
987
+ .tnc-strip-num {
988
+ display: grid;
989
+ place-items: center;
990
+ width: min(var(--tnc-strip-cell), 100%);
991
+ aspect-ratio: 1;
992
+ border-radius: 50%;
993
+ font-size: 15px;
994
+ font-variant-numeric: tabular-nums;
995
+ }
996
+ .tnc-strip-month {
997
+ position: absolute;
998
+ top: 0;
999
+ color: var(--tnc-muted);
1000
+ font-size: 10px;
1001
+ font-weight: 650;
1002
+ line-height: 1;
1003
+ }
1004
+ .tnc-strip-dot {
1005
+ width: 5px;
1006
+ height: 5px;
1007
+ margin-top: 1px;
1008
+ border-radius: 50%;
1009
+ visibility: hidden;
1010
+ background: var(--tnc-muted);
1011
+ }
1012
+ .tnc-strip-day.has-items .tnc-strip-dot {
1013
+ visibility: visible;
1014
+ }
1015
+ .tnc-strip-day.is-past,
1016
+ .tnc-strip-day.is-other-month {
1017
+ color: var(--tnc-faint);
1018
+ }
1019
+ .tnc-strip-day.is-today .tnc-strip-num {
1020
+ color: var(--tnc-accent);
1021
+ font-weight: 700;
1022
+ }
1023
+ .tnc-strip-day.is-focus .tnc-strip-num {
1024
+ background: var(--tnc-accent);
1025
+ color: var(--tnc-accent-text);
1026
+ font-weight: 700;
1027
+ }
1028
+ .tnc-strip-day:hover .tnc-strip-num {
1029
+ background: var(--tnc-surface-2);
1030
+ }
1031
+ .tnc-strip-day.is-focus:hover .tnc-strip-num {
1032
+ background: var(--tnc-accent);
1033
+ }
1034
+ .tnc-strip-day.is-drop-target .tnc-strip-num {
1035
+ box-shadow: 0 0 0 2px var(--tnc-accent);
1036
+ background: var(--tnc-accent-soft);
1037
+ }
1038
+ .tnc-strip-day:focus-visible,
1039
+ .tnc-strip-title:focus-visible,
1040
+ .tnc-strip-nav:focus-visible {
1041
+ outline: 2px solid var(--tnc-accent);
1042
+ outline-offset: -2px;
1043
+ }
1044
+ .tnc-strip-handle {
1045
+ display: block;
1046
+ width: 36px;
1047
+ height: 14px;
1048
+ margin: 0 auto;
1049
+ padding: 0;
1050
+ border: 0;
1051
+ background: none;
1052
+ cursor: pointer;
1053
+ }
1054
+ .tnc-strip-handle::before {
1055
+ content: "";
1056
+ display: block;
1057
+ width: 36px;
1058
+ height: 4px;
1059
+ margin: 0 auto;
1060
+ border-radius: 2px;
1061
+ background: var(--tnc-line-strong);
1062
+ }
1063
+ .tnc-list--agenda .tnc-list-section.is-empty .tnc-list-day {
1064
+ color: var(--tnc-faint);
1065
+ font-weight: 600;
1066
+ }
1067
+ .tnc-list--agenda .tnc-list-section.is-empty .tnc-list-rows {
1068
+ min-height: 28px;
1069
+ }
1070
+ .tnc-list-more {
1071
+ height: 1px;
1072
+ }
1073
+
876
1074
  /* ------------------------------------------------------------------ year */
877
1075
  .tnc-year {
878
1076
  display: flex;
879
1077
  flex-direction: column;
880
1078
  min-height: 0;
1079
+ /* Narrow calendars (phones, sidebars) use the compact year below. */
1080
+ container-type: inline-size;
881
1081
  }
882
1082
  .tnc-year-scroll {
883
1083
  flex: 1 1 auto;
@@ -948,6 +1148,35 @@
948
1148
  background: var(--tnc-c, var(--tnc-accent));
949
1149
  }
950
1150
 
1151
+ /* Two months a row: each day is a shaded square, and its count is in its label. */
1152
+ @container (max-width: 520px) {
1153
+ .tnc-year-scroll {
1154
+ padding: 8px 4px;
1155
+ }
1156
+ .tnc-year-grid {
1157
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1158
+ gap: 14px 12px;
1159
+ }
1160
+ .tnc-ym-title {
1161
+ font-size: 12px;
1162
+ padding-bottom: 4px;
1163
+ }
1164
+ .tnc-ym-days {
1165
+ gap: 1px;
1166
+ }
1167
+ .tnc-ym-day {
1168
+ border-radius: 4px;
1169
+ font-size: 10px;
1170
+ }
1171
+ /* Without dots, one item must still read as busy. */
1172
+ .tnc-ym-day.has-items {
1173
+ background: color-mix(in srgb, var(--tnc-accent) calc((0.3 + var(--tnc-heat) * 0.7) * 50%), transparent);
1174
+ }
1175
+ .tnc-ym-dots {
1176
+ display: none;
1177
+ }
1178
+ }
1179
+
951
1180
  /* -------------------------------------------------------------- timeline */
952
1181
  .tnc-tl {
953
1182
  display: flex;