@tasknotes/calendar 0.1.8 → 0.1.11
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 +23 -1
- package/README.md +1 -0
- package/dist/calendar.css +62 -2
- package/dist/cjs/core.cjs +20 -26
- package/dist/cjs/index.cjs +225 -53
- package/dist/cjs/react.cjs +221 -53
- package/dist/esm/{chunk-66A6EMCU.js → chunk-JWORVABV.js} +20 -26
- package/dist/esm/{chunk-EXKFHPW2.js → chunk-TTM45UAN.js} +202 -28
- package/dist/esm/core.js +1 -1
- package/dist/esm/index.js +6 -2
- package/dist/esm/react.js +2 -2
- package/dist/types/core/layout.d.cts +5 -0
- package/dist/types/core/layout.d.ts +5 -0
- package/dist/types/dom/calendar.d.cts +8 -0
- package/dist/types/dom/calendar.d.ts +8 -0
- package/dist/types/dom/format.d.cts +2 -1
- package/dist/types/dom/format.d.ts +2 -1
- package/dist/types/dom/options.d.cts +6 -0
- package/dist/types/dom/options.d.ts +6 -0
- package/dist/types/dom/views/daygrid.d.cts +2 -0
- package/dist/types/dom/views/daygrid.d.ts +2 -0
- package/dist/types/dom/views/list.d.cts +1 -0
- package/dist/types/dom/views/list.d.ts +1 -0
- package/dist/types/dom/views/strip.d.cts +3 -1
- package/dist/types/dom/views/strip.d.ts +3 -1
- package/dist/types/dom/views/timegrid.d.cts +4 -1
- package/dist/types/dom/views/timegrid.d.ts +4 -1
- package/dist/types/tasknotes/bases.d.cts +2 -0
- package/dist/types/tasknotes/bases.d.ts +2 -0
- package/package.json +1 -1
|
@@ -24,6 +24,11 @@ export interface TimedPlacement<D = unknown> extends TimedSegment<D> {
|
|
|
24
24
|
* Only then does the item keep to its lane's share of the column.
|
|
25
25
|
*/
|
|
26
26
|
split: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Another item starts exactly where this short one ends, so it is drawn at
|
|
29
|
+
* its real height instead of being stretched to the minimum height.
|
|
30
|
+
*/
|
|
31
|
+
abutted?: boolean;
|
|
27
32
|
}
|
|
28
33
|
export interface TimedDayLayout<D = unknown> {
|
|
29
34
|
day: Day;
|
|
@@ -24,6 +24,11 @@ export interface TimedPlacement<D = unknown> extends TimedSegment<D> {
|
|
|
24
24
|
* Only then does the item keep to its lane's share of the column.
|
|
25
25
|
*/
|
|
26
26
|
split: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Another item starts exactly where this short one ends, so it is drawn at
|
|
29
|
+
* its real height instead of being stretched to the minimum height.
|
|
30
|
+
*/
|
|
31
|
+
abutted?: boolean;
|
|
27
32
|
}
|
|
28
33
|
export interface TimedDayLayout<D = unknown> {
|
|
29
34
|
day: Day;
|
|
@@ -39,8 +39,10 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
39
39
|
draggingId: string | null;
|
|
40
40
|
private listDragPreview;
|
|
41
41
|
private dragSources;
|
|
42
|
+
private dragWidth;
|
|
42
43
|
private dragScrollFrame;
|
|
43
44
|
private readonly dragScrollOrigins;
|
|
45
|
+
private readonly dragScrollEdges;
|
|
44
46
|
private readonly itemWriteStates;
|
|
45
47
|
dragRow: {
|
|
46
48
|
id: string;
|
|
@@ -49,6 +51,7 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
49
51
|
strip: DateStrip<D> | null;
|
|
50
52
|
private stripSize;
|
|
51
53
|
private rebuilding;
|
|
54
|
+
private pinch;
|
|
52
55
|
private readonly toolbarEl;
|
|
53
56
|
private readonly viewHost;
|
|
54
57
|
private current;
|
|
@@ -204,7 +207,12 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
204
207
|
private readonly onPointerDown;
|
|
205
208
|
private activate;
|
|
206
209
|
private startDragScroll;
|
|
210
|
+
private readonly onTouchStart;
|
|
207
211
|
private readonly onTouchMove;
|
|
212
|
+
private readonly onTouchEnd;
|
|
213
|
+
/** Rescales the grid, keeping the anchored time under the fingers. */
|
|
214
|
+
private pinchTo;
|
|
215
|
+
private endPinch;
|
|
208
216
|
private readonly onPointerMove;
|
|
209
217
|
private readonly onPointerUp;
|
|
210
218
|
private readonly onPointerCancel;
|
|
@@ -39,8 +39,10 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
39
39
|
draggingId: string | null;
|
|
40
40
|
private listDragPreview;
|
|
41
41
|
private dragSources;
|
|
42
|
+
private dragWidth;
|
|
42
43
|
private dragScrollFrame;
|
|
43
44
|
private readonly dragScrollOrigins;
|
|
45
|
+
private readonly dragScrollEdges;
|
|
44
46
|
private readonly itemWriteStates;
|
|
45
47
|
dragRow: {
|
|
46
48
|
id: string;
|
|
@@ -49,6 +51,7 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
49
51
|
strip: DateStrip<D> | null;
|
|
50
52
|
private stripSize;
|
|
51
53
|
private rebuilding;
|
|
54
|
+
private pinch;
|
|
52
55
|
private readonly toolbarEl;
|
|
53
56
|
private readonly viewHost;
|
|
54
57
|
private current;
|
|
@@ -204,7 +207,12 @@ export declare class Calendar<D = unknown> implements ViewContext<D> {
|
|
|
204
207
|
private readonly onPointerDown;
|
|
205
208
|
private activate;
|
|
206
209
|
private startDragScroll;
|
|
210
|
+
private readonly onTouchStart;
|
|
207
211
|
private readonly onTouchMove;
|
|
212
|
+
private readonly onTouchEnd;
|
|
213
|
+
/** Rescales the grid, keeping the anchored time under the fingers. */
|
|
214
|
+
private pinchTo;
|
|
215
|
+
private endPinch;
|
|
208
216
|
private readonly onPointerMove;
|
|
209
217
|
private readonly onPointerUp;
|
|
210
218
|
private readonly onPointerCancel;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Day } from "../core/date.cjs";
|
|
2
2
|
/** Locale-aware labels. Formatting happens on UTC dates built from civil days, so zones never shift them. */
|
|
3
3
|
export declare class Formatter {
|
|
4
|
+
private readonly formatTime?;
|
|
4
5
|
private readonly cache;
|
|
5
6
|
readonly locale: string | undefined;
|
|
6
7
|
readonly hour12: boolean;
|
|
7
|
-
constructor(locale: string | undefined, hour12: boolean | undefined);
|
|
8
|
+
constructor(locale: string | undefined, hour12: boolean | undefined, formatTime?: ((minute: number) => string) | undefined);
|
|
8
9
|
private fmt;
|
|
9
10
|
private d;
|
|
10
11
|
weekdayShort(day: Day): string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type Day } from "../core/date.js";
|
|
2
2
|
/** Locale-aware labels. Formatting happens on UTC dates built from civil days, so zones never shift them. */
|
|
3
3
|
export declare class Formatter {
|
|
4
|
+
private readonly formatTime?;
|
|
4
5
|
private readonly cache;
|
|
5
6
|
readonly locale: string | undefined;
|
|
6
7
|
readonly hour12: boolean;
|
|
7
|
-
constructor(locale: string | undefined, hour12: boolean | undefined);
|
|
8
|
+
constructor(locale: string | undefined, hour12: boolean | undefined, formatTime?: ((minute: number) => string) | undefined);
|
|
8
9
|
private fmt;
|
|
9
10
|
private d;
|
|
10
11
|
weekdayShort(day: Day): string;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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