@tasknotes/calendar 0.1.8 → 0.1.10

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.
@@ -340,6 +340,7 @@ export interface CalendarOptions<D = unknown> {
340
340
  firstDay: number | undefined;
341
341
  /** undefined = locale default. */
342
342
  hour12: boolean | undefined;
343
+ formatTime?: (minute: number) => string;
343
344
  weekNumbers: boolean;
344
345
  weekends: boolean;
345
346
  hiddenDays: number[];
@@ -356,11 +357,14 @@ export interface CalendarOptions<D = unknown> {
356
357
  scrollTime: string | number;
357
358
  /** Pixel height of one slot. */
358
359
  slotHeight: number;
360
+ /** A two-finger pinch on a time grid rescales `slotHeight`. False leaves the pinch to the browser. */
361
+ pinchZoom: boolean;
359
362
  /** Stretch slots to fill the available height ("fill" mode only). */
360
363
  expandRows: boolean;
361
364
  nowIndicator: boolean;
362
365
  selectMirror: boolean;
363
366
  slotEventOverlap: boolean;
367
+ overlapStackThreshold?: number;
364
368
  /** Minimum item height in px in time grids. */
365
369
  eventMinHeight: number;
366
370
  /** Max side-by-side items in a time-grid cluster before "+N". 0 = unlimited. */
@@ -392,6 +396,8 @@ export interface CalendarOptions<D = unknown> {
392
396
  selected: string | readonly string[] | null;
393
397
  onRangeChange?: (view: ViewInfo) => void;
394
398
  onViewChange?: (view: ViewInfo) => void;
399
+ /** A pinch settled on a new `slotHeight`, whole pixels. Store it to keep the scale across reloads. */
400
+ onSlotHeightChange?: (slotHeight: number) => void;
395
401
  onItemClick?: (arg: ItemPointerArg<D>) => void;
396
402
  onItemDoubleClick?: (arg: ItemPointerArg<D>) => void;
397
403
  onItemContextMenu?: (arg: ItemPointerArg<D>) => void;
@@ -340,6 +340,7 @@ export interface CalendarOptions<D = unknown> {
340
340
  firstDay: number | undefined;
341
341
  /** undefined = locale default. */
342
342
  hour12: boolean | undefined;
343
+ formatTime?: (minute: number) => string;
343
344
  weekNumbers: boolean;
344
345
  weekends: boolean;
345
346
  hiddenDays: number[];
@@ -356,11 +357,14 @@ export interface CalendarOptions<D = unknown> {
356
357
  scrollTime: string | number;
357
358
  /** Pixel height of one slot. */
358
359
  slotHeight: number;
360
+ /** A two-finger pinch on a time grid rescales `slotHeight`. False leaves the pinch to the browser. */
361
+ pinchZoom: boolean;
359
362
  /** Stretch slots to fill the available height ("fill" mode only). */
360
363
  expandRows: boolean;
361
364
  nowIndicator: boolean;
362
365
  selectMirror: boolean;
363
366
  slotEventOverlap: boolean;
367
+ overlapStackThreshold?: number;
364
368
  /** Minimum item height in px in time grids. */
365
369
  eventMinHeight: number;
366
370
  /** Max side-by-side items in a time-grid cluster before "+N". 0 = unlimited. */
@@ -392,6 +396,8 @@ export interface CalendarOptions<D = unknown> {
392
396
  selected: string | readonly string[] | null;
393
397
  onRangeChange?: (view: ViewInfo) => void;
394
398
  onViewChange?: (view: ViewInfo) => void;
399
+ /** A pinch settled on a new `slotHeight`, whole pixels. Store it to keep the scale across reloads. */
400
+ onSlotHeightChange?: (slotHeight: number) => void;
395
401
  onItemClick?: (arg: ItemPointerArg<D>) => void;
396
402
  onItemDoubleClick?: (arg: ItemPointerArg<D>) => void;
397
403
  onItemContextMenu?: (arg: ItemPointerArg<D>) => void;
@@ -14,10 +14,12 @@ export declare class DayGridView<D> implements View {
14
14
  private topPx;
15
15
  private lastHeights;
16
16
  private dotsMode;
17
+ private dragPreviews;
17
18
  constructor(ctx: ViewContext<D>);
18
19
  private daysPerWeek;
19
20
  private sizeKey;
20
21
  render(_change: StoreChange | null): void;
22
+ private clearDragPreviews;
21
23
  /** Height of a "+N more" link as the host styles it (`--tnc-more-h`, or a taller min-height). */
22
24
  private measureMore;
23
25
  private limitFor;
@@ -14,10 +14,12 @@ export declare class DayGridView<D> implements View {
14
14
  private topPx;
15
15
  private lastHeights;
16
16
  private dotsMode;
17
+ private dragPreviews;
17
18
  constructor(ctx: ViewContext<D>);
18
19
  private daysPerWeek;
19
20
  private sizeKey;
20
21
  render(_change: StoreChange | null): void;
22
+ private clearDragPreviews;
21
23
  /** Height of a "+N more" link as the host styles it (`--tnc-more-h`, or a taller min-height). */
22
24
  private measureMore;
23
25
  private limitFor;
@@ -22,6 +22,7 @@ export declare class ListView<D> implements View {
22
22
  private frame;
23
23
  /** A picked day stays marked until the list is scrolled by hand. */
24
24
  private pinned;
25
+ private pinnedTop;
25
26
  constructor(ctx: ViewContext<D>);
26
27
  private itemsOn;
27
28
  render(_change: StoreChange | null): void;
@@ -22,6 +22,7 @@ export declare class ListView<D> implements View {
22
22
  private frame;
23
23
  /** A picked day stays marked until the list is scrolled by hand. */
24
24
  private pinned;
25
+ private pinnedTop;
25
26
  constructor(ctx: ViewContext<D>);
26
27
  private itemsOn;
27
28
  render(_change: StoreChange | null): void;
@@ -12,6 +12,7 @@ export declare class DateStrip<D> {
12
12
  private readonly pick;
13
13
  /** Called when the days on show change, so their items can be loaded. */
14
14
  private readonly onShown;
15
+ private readonly onPage?;
15
16
  readonly el: HTMLElement;
16
17
  private readonly title;
17
18
  private readonly dows;
@@ -31,7 +32,7 @@ export declare class DateStrip<D> {
31
32
  expanded: boolean;
32
33
  constructor(ctx: ViewContext<D>, pick: (day: Day, ev: MouseEvent | KeyboardEvent) => void, focus: Day,
33
34
  /** Called when the days on show change, so their items can be loaded. */
34
- onShown: () => void);
35
+ onShown: () => void, onPage?: ((day: Day) => void) | undefined);
35
36
  /** The list scrolled or the grid moved: mark the day and keep it in view. */
36
37
  setFocus(day: Day, range?: {
37
38
  start: Day;
@@ -55,6 +56,7 @@ export declare class DateStrip<D> {
55
56
  private readonly onClick;
56
57
  private readonly onKeyDown;
57
58
  private readonly onPointerDown;
59
+ private readonly ownTouch;
58
60
  private readonly onPointerUp;
59
61
  private readonly onPointerCancel;
60
62
  /** A swipe that ends on a day is not a pick. */
@@ -12,6 +12,7 @@ export declare class DateStrip<D> {
12
12
  private readonly pick;
13
13
  /** Called when the days on show change, so their items can be loaded. */
14
14
  private readonly onShown;
15
+ private readonly onPage?;
15
16
  readonly el: HTMLElement;
16
17
  private readonly title;
17
18
  private readonly dows;
@@ -31,7 +32,7 @@ export declare class DateStrip<D> {
31
32
  expanded: boolean;
32
33
  constructor(ctx: ViewContext<D>, pick: (day: Day, ev: MouseEvent | KeyboardEvent) => void, focus: Day,
33
34
  /** Called when the days on show change, so their items can be loaded. */
34
- onShown: () => void);
35
+ onShown: () => void, onPage?: ((day: Day) => void) | undefined);
35
36
  /** The list scrolled or the grid moved: mark the day and keep it in view. */
36
37
  setFocus(day: Day, range?: {
37
38
  start: Day;
@@ -55,6 +56,7 @@ export declare class DateStrip<D> {
55
56
  private readonly onClick;
56
57
  private readonly onKeyDown;
57
58
  private readonly onPointerDown;
59
+ private readonly ownTouch;
58
60
  private readonly onPointerUp;
59
61
  private readonly onPointerCancel;
60
62
  /** A swipe that ends on a day is not a pick. */
@@ -26,7 +26,10 @@ export declare class TimeGridView<D> implements View {
26
26
  private get minutes();
27
27
  private build;
28
28
  private buildGutter;
29
- private applyScale;
29
+ /** Slot height as drawn, which `expandRows` can stretch past the option. */
30
+ get drawnSlotHeight(): number;
31
+ /** Applies `slotHeight`. Items are placed in percentages, so they follow without a render. */
32
+ applyScale(): void;
30
33
  /** In fill mode with expandRows, stretches slots so the grid fills the height. */
31
34
  private fitRows;
32
35
  render(change: StoreChange | null): void;
@@ -26,7 +26,10 @@ export declare class TimeGridView<D> implements View {
26
26
  private get minutes();
27
27
  private build;
28
28
  private buildGutter;
29
- private applyScale;
29
+ /** Slot height as drawn, which `expandRows` can stretch past the option. */
30
+ get drawnSlotHeight(): number;
31
+ /** Applies `slotHeight`. Items are placed in percentages, so they follow without a render. */
32
+ applyScale(): void;
30
33
  /** In fill mode with expandRows, stretches slots so the grid fills the height. */
31
34
  private fitRows;
32
35
  render(change: StoreChange | null): void;
@@ -24,6 +24,8 @@ export interface BasesCalendarLayout {
24
24
  slotDuration?: string | null;
25
25
  snapDuration?: string | null;
26
26
  scrollTime?: string | null;
27
+ slotHeight?: number | null;
28
+ pinchZoom?: boolean | null;
27
29
  nowIndicator?: boolean | null;
28
30
  showTimeGrid?: boolean | null;
29
31
  selectMirror?: boolean | null;
@@ -24,6 +24,8 @@ export interface BasesCalendarLayout {
24
24
  slotDuration?: string | null;
25
25
  snapDuration?: string | null;
26
26
  scrollTime?: string | null;
27
+ slotHeight?: number | null;
28
+ pinchZoom?: boolean | null;
27
29
  nowIndicator?: boolean | null;
28
30
  showTimeGrid?: boolean | null;
29
31
  selectMirror?: boolean | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tasknotes/calendar",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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",