@tasknotes/calendar 0.1.1 → 0.1.2

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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Changed
6
+
7
+ - 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.
8
+
9
+ ### Fixed
10
+
11
+ - Clicking or tapping a day in the year view reports it through `onDateClick`. Before, only Enter or Space on a focused day did.
12
+ - 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.
13
+
3
14
  ## 0.1.1
4
15
 
5
16
  ### Fixed
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;
@@ -878,6 +880,8 @@
878
880
  display: flex;
879
881
  flex-direction: column;
880
882
  min-height: 0;
883
+ /* Narrow calendars (phones, sidebars) use the compact year below. */
884
+ container-type: inline-size;
881
885
  }
882
886
  .tnc-year-scroll {
883
887
  flex: 1 1 auto;
@@ -948,6 +952,35 @@
948
952
  background: var(--tnc-c, var(--tnc-accent));
949
953
  }
950
954
 
955
+ /* Two months a row: each day is a shaded square, and its count is in its label. */
956
+ @container (max-width: 520px) {
957
+ .tnc-year-scroll {
958
+ padding: 8px 4px;
959
+ }
960
+ .tnc-year-grid {
961
+ grid-template-columns: repeat(2, minmax(0, 1fr));
962
+ gap: 14px 12px;
963
+ }
964
+ .tnc-ym-title {
965
+ font-size: 12px;
966
+ padding-bottom: 4px;
967
+ }
968
+ .tnc-ym-days {
969
+ gap: 1px;
970
+ }
971
+ .tnc-ym-day {
972
+ border-radius: 4px;
973
+ font-size: 10px;
974
+ }
975
+ /* Without dots, one item must still read as busy. */
976
+ .tnc-ym-day.has-items {
977
+ background: color-mix(in srgb, var(--tnc-accent) calc((0.3 + var(--tnc-heat) * 0.7) * 50%), transparent);
978
+ }
979
+ .tnc-ym-dots {
980
+ display: none;
981
+ }
982
+ }
983
+
951
984
  /* -------------------------------------------------------------- timeline */
952
985
  .tnc-tl {
953
986
  display: flex;
@@ -3934,6 +3934,12 @@ var Calendar = class {
3934
3934
  ev.preventDefault();
3935
3935
  };
3936
3936
  onClick = (ev) => {
3937
+ const yearDay = ev.target.closest?.(".tnc-ym-day");
3938
+ if (yearDay && this.root.contains(yearDay)) {
3939
+ const day = parseDay(yearDay.dataset.date ?? "");
3940
+ if (day !== null) this.clickSlot({ kind: "day", day }, ev, true);
3941
+ return;
3942
+ }
3937
3943
  const el = this.itemElFrom(ev.target);
3938
3944
  if (!el || ev.target.closest(".tnc-resize, .tnc-port")) return;
3939
3945
  const meta = this.meta.get(el);
@@ -3993,7 +3999,7 @@ var Calendar = class {
3993
3999
  return;
3994
4000
  }
3995
4001
  const target = ev.target;
3996
- if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-ym-day, .tnc-dg-day[tabindex]")) {
4002
+ if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-dg-day[tabindex]")) {
3997
4003
  const day = parseDay(target.dataset.date ?? "");
3998
4004
  if (day !== null) {
3999
4005
  ev.preventDefault();
@@ -3842,6 +3842,12 @@ var Calendar = class {
3842
3842
  ev.preventDefault();
3843
3843
  };
3844
3844
  onClick = (ev) => {
3845
+ const yearDay = ev.target.closest?.(".tnc-ym-day");
3846
+ if (yearDay && this.root.contains(yearDay)) {
3847
+ const day = parseDay(yearDay.dataset.date ?? "");
3848
+ if (day !== null) this.clickSlot({ kind: "day", day }, ev, true);
3849
+ return;
3850
+ }
3845
3851
  const el = this.itemElFrom(ev.target);
3846
3852
  if (!el || ev.target.closest(".tnc-resize, .tnc-port")) return;
3847
3853
  const meta = this.meta.get(el);
@@ -3901,7 +3907,7 @@ var Calendar = class {
3901
3907
  return;
3902
3908
  }
3903
3909
  const target = ev.target;
3904
- if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-ym-day, .tnc-dg-day[tabindex]")) {
3910
+ if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-dg-day[tabindex]")) {
3905
3911
  const day = parseDay(target.dataset.date ?? "");
3906
3912
  if (day !== null) {
3907
3913
  ev.preventDefault();
@@ -3236,6 +3236,12 @@ var Calendar = class {
3236
3236
  ev.preventDefault();
3237
3237
  };
3238
3238
  onClick = (ev) => {
3239
+ const yearDay = ev.target.closest?.(".tnc-ym-day");
3240
+ if (yearDay && this.root.contains(yearDay)) {
3241
+ const day = parseDay(yearDay.dataset.date ?? "");
3242
+ if (day !== null) this.clickSlot({ kind: "day", day }, ev, true);
3243
+ return;
3244
+ }
3239
3245
  const el = this.itemElFrom(ev.target);
3240
3246
  if (!el || ev.target.closest(".tnc-resize, .tnc-port")) return;
3241
3247
  const meta = this.meta.get(el);
@@ -3295,7 +3301,7 @@ var Calendar = class {
3295
3301
  return;
3296
3302
  }
3297
3303
  const target = ev.target;
3298
- if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-ym-day, .tnc-dg-day[tabindex]")) {
3304
+ if ((ev.key === "Enter" || ev.key === " ") && target.matches(".tnc-dg-day[tabindex]")) {
3299
3305
  const day = parseDay(target.dataset.date ?? "");
3300
3306
  if (day !== null) {
3301
3307
  ev.preventDefault();
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-6RRDNLZM.js";
10
+ } from "./chunk-ZJQMMA6W.js";
11
11
  import {
12
12
  DAY_MS,
13
13
  ItemStore,
package/dist/esm/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Calendar
3
- } from "./chunk-6RRDNLZM.js";
3
+ } from "./chunk-ZJQMMA6W.js";
4
4
  import "./chunk-DVMZ5OXN.js";
5
5
 
6
6
  // src/react/index.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tasknotes/calendar",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Task-native calendar engine for TaskNotes: incremental layout, time grid, month, list, year and timeline views.",
5
5
  "license": "MIT",
6
6
  "type": "module",