@tasknotes/calendar 0.1.5 → 0.1.7

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.
@@ -61,7 +61,7 @@ export interface ViewContext<D = unknown> {
61
61
  destroyItemEl(el: HTMLElement): void;
62
62
  /** Builds a nav link (day number / header) for a day. */
63
63
  navLink(day: Day, label: Node | string, cls: string): HTMLElement;
64
- openMore(day: Day, anchor: HTMLElement, jsEvent: MouseEvent | KeyboardEvent): void;
64
+ openMore(day: Day, anchor: HTMLElement, jsEvent: MouseEvent | KeyboardEvent, itemIds?: readonly string[]): void;
65
65
  /** Follows a date link: `onNavLink`, or switches to `view` at `day`. */
66
66
  navigate(day: Day, jsEvent: MouseEvent | KeyboardEvent, view?: "day" | "month"): void;
67
67
  /** Swallows the click that follows a drag the view handled itself. */
@@ -258,6 +258,7 @@ export interface ToolbarButton {
258
258
  export interface ToolbarOptions {
259
259
  /** View buttons, in order. */
260
260
  views?: ViewType[];
261
+ viewDisplay?: "auto" | "buttons" | "select";
261
262
  extraButtons?: ToolbarButton[];
262
263
  /** Extra buttons go before prev/next ("start") or after the view buttons ("end"). */
263
264
  extraPlacement?: "start" | "end";
@@ -269,6 +270,7 @@ export interface CalendarText {
269
270
  allDay: string;
270
271
  noItems: string;
271
272
  more: (n: number) => string;
273
+ appointments: (n: number) => string;
272
274
  /** Day-cell label suffix in `monthDisplay: "dots"`. */
273
275
  itemCount: (n: number) => string;
274
276
  weekNumber: (n: number) => string;
@@ -319,6 +321,7 @@ export interface CalendarOptions<D = unknown> {
319
321
  }) => void;
320
322
  /** Agenda lists: an add row with this label under every day, reported through `onListAdd`. Null for none. */
321
323
  listAddText: string | null;
324
+ listEmptyContent?: () => Node;
322
325
  onListAdd?: (arg: DayArg & {
323
326
  jsEvent: MouseEvent | KeyboardEvent;
324
327
  }) => void;
@@ -258,6 +258,7 @@ export interface ToolbarButton {
258
258
  export interface ToolbarOptions {
259
259
  /** View buttons, in order. */
260
260
  views?: ViewType[];
261
+ viewDisplay?: "auto" | "buttons" | "select";
261
262
  extraButtons?: ToolbarButton[];
262
263
  /** Extra buttons go before prev/next ("start") or after the view buttons ("end"). */
263
264
  extraPlacement?: "start" | "end";
@@ -269,6 +270,7 @@ export interface CalendarText {
269
270
  allDay: string;
270
271
  noItems: string;
271
272
  more: (n: number) => string;
273
+ appointments: (n: number) => string;
272
274
  /** Day-cell label suffix in `monthDisplay: "dots"`. */
273
275
  itemCount: (n: number) => string;
274
276
  weekNumber: (n: number) => string;
@@ -319,6 +321,7 @@ export interface CalendarOptions<D = unknown> {
319
321
  }) => void;
320
322
  /** Agenda lists: an add row with this label under every day, reported through `onListAdd`. Null for none. */
321
323
  listAddText: string | null;
324
+ listEmptyContent?: () => Node;
322
325
  onListAdd?: (arg: DayArg & {
323
326
  jsEvent: MouseEvent | KeyboardEvent;
324
327
  }) => void;
@@ -1,3 +1,4 @@
1
+ import { type Day } from "../../core/date.cjs";
1
2
  import type { StoreChange } from "../../core/store.cjs";
2
3
  import { type Selection, type View, type ViewContext } from "../context.cjs";
3
4
  import type { Hit } from "../options.cjs";
@@ -6,6 +7,7 @@ export declare class TimeGridView<D> implements View {
6
7
  private readonly ctx;
7
8
  readonly el: HTMLElement;
8
9
  private readonly scroller;
10
+ private readonly dayNavigation;
9
11
  private readonly top;
10
12
  private readonly headRow;
11
13
  private readonly allDayRow;
@@ -40,6 +42,8 @@ export declare class TimeGridView<D> implements View {
40
42
  hit(x: number, y: number): Hit | null;
41
43
  tick(): void;
42
44
  resize(): void;
45
+ revealDay(day: Day): void;
46
+ private updateDayNavigation;
43
47
  scrollToTime(minute: number): void;
44
48
  getScroll(): {
45
49
  top: number;
@@ -1,3 +1,4 @@
1
+ import { type Day } from "../../core/date.js";
1
2
  import type { StoreChange } from "../../core/store.js";
2
3
  import { type Selection, type View, type ViewContext } from "../context.js";
3
4
  import type { Hit } from "../options.js";
@@ -6,6 +7,7 @@ export declare class TimeGridView<D> implements View {
6
7
  private readonly ctx;
7
8
  readonly el: HTMLElement;
8
9
  private readonly scroller;
10
+ private readonly dayNavigation;
9
11
  private readonly top;
10
12
  private readonly headRow;
11
13
  private readonly allDayRow;
@@ -40,6 +42,8 @@ export declare class TimeGridView<D> implements View {
40
42
  hit(x: number, y: number): Hit | null;
41
43
  tick(): void;
42
44
  resize(): void;
45
+ revealDay(day: Day): void;
46
+ private updateDayNavigation;
43
47
  scrollToTime(minute: number): void;
44
48
  getScroll(): {
45
49
  top: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tasknotes/calendar",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
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",