@tasknotes/calendar 0.1.2 → 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 +10 -0
- package/README.md +2 -1
- package/dist/calendar.css +196 -0
- package/dist/cjs/index.cjs +358 -29
- package/dist/cjs/react.cjs +358 -29
- package/dist/esm/{chunk-ZJQMMA6W.js → chunk-XHPZ7K4W.js} +358 -29
- package/dist/esm/index.js +1 -1
- package/dist/esm/react.js +1 -1
- package/dist/types/dom/calendar.d.cts +8 -0
- package/dist/types/dom/calendar.d.ts +8 -0
- package/dist/types/dom/context.d.cts +8 -0
- package/dist/types/dom/context.d.ts +8 -0
- package/dist/types/dom/options.d.cts +19 -0
- package/dist/types/dom/options.d.ts +19 -0
- package/dist/types/dom/views/list.d.cts +23 -2
- package/dist/types/dom/views/list.d.ts +23 -2
- package/dist/types/dom/views/strip.d.cts +43 -0
- package/dist/types/dom/views/strip.d.ts +43 -0
- package/package.json +1 -1
|
@@ -283,6 +283,14 @@ export interface CalendarOptions<D = unknown> {
|
|
|
283
283
|
* start of its week ("week", like FullCalendar's stock `listWeek`).
|
|
284
284
|
*/
|
|
285
285
|
listStart: "date" | "week";
|
|
286
|
+
/**
|
|
287
|
+
* Turns the "list" view into a phone-style agenda: a date strip (one week,
|
|
288
|
+
* or the month when expanded) above a list of every day, empty ones
|
|
289
|
+
* included, that loads more days as it nears its end. The strip marks the
|
|
290
|
+
* day at the top of the list, picking a day scrolls to it, and items
|
|
291
|
+
* dragged onto a strip day or another day's section move there.
|
|
292
|
+
*/
|
|
293
|
+
listAgenda: boolean;
|
|
286
294
|
/**
|
|
287
295
|
* Month cells: "full" draws bars and titled entries; "dots" draws every
|
|
288
296
|
* item as a small dot that wraps across the cell, with a "+N" count when
|
|
@@ -393,6 +401,17 @@ export interface CalendarOptions<D = unknown> {
|
|
|
393
401
|
listItemContent?: (arg: ItemArg<D>) => Node | null | undefined;
|
|
394
402
|
dayHeaderContent?: (arg: DayArg) => Node | string | null | undefined;
|
|
395
403
|
dayHeaderDidMount?: (arg: DayHeaderArg) => void;
|
|
404
|
+
/**
|
|
405
|
+
* The agenda strip's header has an empty slot after its arrows. Mount host
|
|
406
|
+
* controls (a layout menu, say) into `el`; the calendar leaves it alone.
|
|
407
|
+
*/
|
|
408
|
+
stripSlotDidMount?: (arg: {
|
|
409
|
+
el: HTMLElement;
|
|
410
|
+
}) => void;
|
|
411
|
+
/** The agenda strip's slot is about to be removed. */
|
|
412
|
+
stripSlotWillUnmount?: (arg: {
|
|
413
|
+
el: HTMLElement;
|
|
414
|
+
}) => void;
|
|
396
415
|
dayClassNames?: (arg: DayArg) => string[] | string | undefined;
|
|
397
416
|
}
|
|
398
417
|
export declare const DEFAULT_TEXT: CalendarText;
|
|
@@ -1,7 +1,12 @@
|
|
|
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";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* N-day agenda: one section per day that has items. With `listAgenda`, every
|
|
7
|
+
* day gets a section, a date strip follows the day at the top, and more days
|
|
8
|
+
* load as the list nears its end.
|
|
9
|
+
*/
|
|
5
10
|
export declare class ListView<D> implements View {
|
|
6
11
|
private readonly ctx;
|
|
7
12
|
readonly el: HTMLElement;
|
|
@@ -9,11 +14,27 @@ export declare class ListView<D> implements View {
|
|
|
9
14
|
private readonly body;
|
|
10
15
|
private pools;
|
|
11
16
|
private sections;
|
|
17
|
+
private readonly strip;
|
|
18
|
+
private readonly sentinel;
|
|
19
|
+
private readonly loader;
|
|
20
|
+
private readonly stripSize;
|
|
21
|
+
private frame;
|
|
22
|
+
/** A picked day stays marked until the list is scrolled by hand. */
|
|
23
|
+
private pinned;
|
|
12
24
|
constructor(ctx: ViewContext<D>);
|
|
13
25
|
private itemsOn;
|
|
14
26
|
render(_change: StoreChange | null): void;
|
|
27
|
+
/** A strip day: the host hears of it, and the list brings it to the top. */
|
|
28
|
+
private pick;
|
|
29
|
+
/** Brings a day's section to the top, under the strip. */
|
|
30
|
+
scrollToDay(day: Day): void;
|
|
31
|
+
private readonly fold;
|
|
32
|
+
private readonly onScroll;
|
|
33
|
+
/** Marks the first day not hidden under the strip. */
|
|
34
|
+
private followTop;
|
|
15
35
|
showSelection(_sel: Selection | null): void;
|
|
16
|
-
hit(
|
|
36
|
+
hit(x: number, y: number): Hit | null;
|
|
37
|
+
dragEnded(): void;
|
|
17
38
|
getScroll(): {
|
|
18
39
|
top: number;
|
|
19
40
|
left: number;
|
|
@@ -1,7 +1,12 @@
|
|
|
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";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* N-day agenda: one section per day that has items. With `listAgenda`, every
|
|
7
|
+
* day gets a section, a date strip follows the day at the top, and more days
|
|
8
|
+
* load as the list nears its end.
|
|
9
|
+
*/
|
|
5
10
|
export declare class ListView<D> implements View {
|
|
6
11
|
private readonly ctx;
|
|
7
12
|
readonly el: HTMLElement;
|
|
@@ -9,11 +14,27 @@ export declare class ListView<D> implements View {
|
|
|
9
14
|
private readonly body;
|
|
10
15
|
private pools;
|
|
11
16
|
private sections;
|
|
17
|
+
private readonly strip;
|
|
18
|
+
private readonly sentinel;
|
|
19
|
+
private readonly loader;
|
|
20
|
+
private readonly stripSize;
|
|
21
|
+
private frame;
|
|
22
|
+
/** A picked day stays marked until the list is scrolled by hand. */
|
|
23
|
+
private pinned;
|
|
12
24
|
constructor(ctx: ViewContext<D>);
|
|
13
25
|
private itemsOn;
|
|
14
26
|
render(_change: StoreChange | null): void;
|
|
27
|
+
/** A strip day: the host hears of it, and the list brings it to the top. */
|
|
28
|
+
private pick;
|
|
29
|
+
/** Brings a day's section to the top, under the strip. */
|
|
30
|
+
scrollToDay(day: Day): void;
|
|
31
|
+
private readonly fold;
|
|
32
|
+
private readonly onScroll;
|
|
33
|
+
/** Marks the first day not hidden under the strip. */
|
|
34
|
+
private followTop;
|
|
15
35
|
showSelection(_sel: Selection | null): void;
|
|
16
|
-
hit(
|
|
36
|
+
hit(x: number, y: number): Hit | null;
|
|
37
|
+
dragEnded(): void;
|
|
17
38
|
getScroll(): {
|
|
18
39
|
top: number;
|
|
19
40
|
left: number;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Day } from "../../core/date.cjs";
|
|
2
|
+
import type { ViewContext } from "../context.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* The agenda's date strip: one week, or the whole month when expanded. Days
|
|
5
|
+
* with items carry a dot; the day at the top of the list is marked. Picking a
|
|
6
|
+
* day hands it to the list, and swipes step a week (or a month).
|
|
7
|
+
*/
|
|
8
|
+
export declare class DateStrip<D> {
|
|
9
|
+
private readonly ctx;
|
|
10
|
+
private readonly pick;
|
|
11
|
+
readonly el: HTMLElement;
|
|
12
|
+
private readonly title;
|
|
13
|
+
private readonly dows;
|
|
14
|
+
private readonly grid;
|
|
15
|
+
private readonly slot;
|
|
16
|
+
/** Day at the top of the list. */
|
|
17
|
+
private focus;
|
|
18
|
+
/** First day of the week shown, or the month shown when expanded. */
|
|
19
|
+
private shown;
|
|
20
|
+
private target;
|
|
21
|
+
private swipe;
|
|
22
|
+
private swallowClick;
|
|
23
|
+
expanded: boolean;
|
|
24
|
+
constructor(ctx: ViewContext<D>, pick: (day: Day, ev: MouseEvent | KeyboardEvent) => void, focus: Day);
|
|
25
|
+
/** The list scrolled: mark its top day and keep it in view. */
|
|
26
|
+
setFocus(day: Day): void;
|
|
27
|
+
setExpanded(on: boolean): void;
|
|
28
|
+
/** Highlights the day a dragged item would land on. */
|
|
29
|
+
markTarget(day: Day | null): void;
|
|
30
|
+
dayAt(el: Element): Day | null;
|
|
31
|
+
private step;
|
|
32
|
+
private days;
|
|
33
|
+
/** Redraws the cells; also called on every list render to refresh the dots. */
|
|
34
|
+
draw(): void;
|
|
35
|
+
private readonly onClick;
|
|
36
|
+
private readonly onKeyDown;
|
|
37
|
+
private readonly onPointerDown;
|
|
38
|
+
private readonly onPointerUp;
|
|
39
|
+
private readonly onPointerCancel;
|
|
40
|
+
/** A swipe that ends on a day is not a pick. */
|
|
41
|
+
private readonly onClickCapture;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Day } from "../../core/date.js";
|
|
2
|
+
import type { ViewContext } from "../context.js";
|
|
3
|
+
/**
|
|
4
|
+
* The agenda's date strip: one week, or the whole month when expanded. Days
|
|
5
|
+
* with items carry a dot; the day at the top of the list is marked. Picking a
|
|
6
|
+
* day hands it to the list, and swipes step a week (or a month).
|
|
7
|
+
*/
|
|
8
|
+
export declare class DateStrip<D> {
|
|
9
|
+
private readonly ctx;
|
|
10
|
+
private readonly pick;
|
|
11
|
+
readonly el: HTMLElement;
|
|
12
|
+
private readonly title;
|
|
13
|
+
private readonly dows;
|
|
14
|
+
private readonly grid;
|
|
15
|
+
private readonly slot;
|
|
16
|
+
/** Day at the top of the list. */
|
|
17
|
+
private focus;
|
|
18
|
+
/** First day of the week shown, or the month shown when expanded. */
|
|
19
|
+
private shown;
|
|
20
|
+
private target;
|
|
21
|
+
private swipe;
|
|
22
|
+
private swallowClick;
|
|
23
|
+
expanded: boolean;
|
|
24
|
+
constructor(ctx: ViewContext<D>, pick: (day: Day, ev: MouseEvent | KeyboardEvent) => void, focus: Day);
|
|
25
|
+
/** The list scrolled: mark its top day and keep it in view. */
|
|
26
|
+
setFocus(day: Day): void;
|
|
27
|
+
setExpanded(on: boolean): void;
|
|
28
|
+
/** Highlights the day a dragged item would land on. */
|
|
29
|
+
markTarget(day: Day | null): void;
|
|
30
|
+
dayAt(el: Element): Day | null;
|
|
31
|
+
private step;
|
|
32
|
+
private days;
|
|
33
|
+
/** Redraws the cells; also called on every list render to refresh the dots. */
|
|
34
|
+
draw(): void;
|
|
35
|
+
private readonly onClick;
|
|
36
|
+
private readonly onKeyDown;
|
|
37
|
+
private readonly onPointerDown;
|
|
38
|
+
private readonly onPointerUp;
|
|
39
|
+
private readonly onPointerCancel;
|
|
40
|
+
/** A swipe that ends on a day is not a pick. */
|
|
41
|
+
private readonly onClickCapture;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
}
|
package/package.json
CHANGED