@tasknotes/calendar 0.0.0-stage → 0.1.1

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +163 -2
  4. package/dist/calendar.css +1358 -0
  5. package/dist/cjs/core.cjs +716 -0
  6. package/dist/cjs/index.cjs +4240 -0
  7. package/dist/cjs/react.cjs +4068 -0
  8. package/dist/esm/chunk-6RRDNLZM.js +3435 -0
  9. package/dist/esm/chunk-DVMZ5OXN.js +694 -0
  10. package/dist/esm/chunk-L4WKZ6WT.js +0 -0
  11. package/dist/esm/core.js +85 -0
  12. package/dist/esm/index.js +223 -0
  13. package/dist/esm/react.js +46 -0
  14. package/dist/types/core/date.d.cts +30 -0
  15. package/dist/types/core/date.d.ts +30 -0
  16. package/dist/types/core/index.d.cts +7 -0
  17. package/dist/types/core/index.d.ts +7 -0
  18. package/dist/types/core/layout.d.cts +82 -0
  19. package/dist/types/core/layout.d.ts +82 -0
  20. package/dist/types/core/order.d.cts +7 -0
  21. package/dist/types/core/order.d.ts +7 -0
  22. package/dist/types/core/plan.d.cts +42 -0
  23. package/dist/types/core/plan.d.ts +42 -0
  24. package/dist/types/core/store.d.cts +60 -0
  25. package/dist/types/core/store.d.ts +60 -0
  26. package/dist/types/core/types.d.cts +69 -0
  27. package/dist/types/core/types.d.ts +69 -0
  28. package/dist/types/core/zone.d.cts +43 -0
  29. package/dist/types/core/zone.d.ts +43 -0
  30. package/dist/types/dom/calendar.d.cts +215 -0
  31. package/dist/types/dom/calendar.d.ts +215 -0
  32. package/dist/types/dom/context.d.cts +107 -0
  33. package/dist/types/dom/context.d.ts +107 -0
  34. package/dist/types/dom/dom.d.cts +8 -0
  35. package/dist/types/dom/dom.d.ts +8 -0
  36. package/dist/types/dom/format.d.cts +30 -0
  37. package/dist/types/dom/format.d.ts +30 -0
  38. package/dist/types/dom/options.d.cts +401 -0
  39. package/dist/types/dom/options.d.ts +401 -0
  40. package/dist/types/dom/views/daygrid.d.cts +42 -0
  41. package/dist/types/dom/views/daygrid.d.ts +42 -0
  42. package/dist/types/dom/views/list.d.cts +27 -0
  43. package/dist/types/dom/views/list.d.ts +27 -0
  44. package/dist/types/dom/views/timegrid.d.cts +54 -0
  45. package/dist/types/dom/views/timegrid.d.ts +54 -0
  46. package/dist/types/dom/views/timeline.d.cts +83 -0
  47. package/dist/types/dom/views/timeline.d.ts +83 -0
  48. package/dist/types/dom/views/year.d.cts +26 -0
  49. package/dist/types/dom/views/year.d.ts +26 -0
  50. package/dist/types/index.d.cts +6 -0
  51. package/dist/types/index.d.ts +6 -0
  52. package/dist/types/react/index.d.cts +20 -0
  53. package/dist/types/react/index.d.ts +20 -0
  54. package/dist/types/tasknotes/bases.d.cts +50 -0
  55. package/dist/types/tasknotes/bases.d.ts +50 -0
  56. package/package.json +108 -5
@@ -0,0 +1,215 @@
1
+ import { type Day } from "../core/date.js";
2
+ import type { ItemOrder } from "../core/layout.js";
3
+ import { ItemStore } from "../core/store.js";
4
+ import type { CalendarItem, DateInput, NormalizedItem } from "../core/types.js";
5
+ import { type TimeZone } from "../core/zone.js";
6
+ import { type ElMeta, type ViewContext } from "./context.js";
7
+ import { Formatter } from "./format.js";
8
+ import { type CalendarOptions, type CalendarText, type DayArg, type ExternalDragSource, type Hit, type TimelineAnchor, type ViewInfo, type ViewType } from "./options.js";
9
+ /**
10
+ * A calendar bound to one element. Works in any document, including Obsidian
11
+ * popout windows: all listeners, timers and observers use the element's window.
12
+ */
13
+ export declare class Calendar<D = unknown> implements ViewContext<D> {
14
+ readonly host: HTMLElement;
15
+ /** The document/window the calendar currently lives in; see `adopt()`. */
16
+ doc: Document;
17
+ win: Window;
18
+ readonly root: HTMLElement;
19
+ readonly store: ItemStore<D>;
20
+ readonly meta: WeakMap<Element, ElMeta<D>>;
21
+ opts: CalendarOptions<D>;
22
+ zone: TimeZone;
23
+ fmt: Formatter;
24
+ text: CalendarText;
25
+ order: ItemOrder<D>;
26
+ view: ViewInfo;
27
+ firstDay: number;
28
+ days: Day[];
29
+ today: Day;
30
+ conflicts: Map<string, string[]>;
31
+ slot: {
32
+ min: number;
33
+ max: number;
34
+ duration: number;
35
+ snap: number;
36
+ scroll: number;
37
+ };
38
+ draggingId: string | null;
39
+ dragRow: {
40
+ id: string;
41
+ rowId: string;
42
+ } | null;
43
+ private readonly toolbarEl;
44
+ private readonly viewHost;
45
+ private current;
46
+ private anchor;
47
+ private session;
48
+ private selection;
49
+ private suppressClick;
50
+ private selectedIds;
51
+ private popover;
52
+ private timer;
53
+ private resizeObs;
54
+ private destroyed;
55
+ private pendingChange;
56
+ private frame;
57
+ constructor(host: HTMLElement, options?: Partial<CalendarOptions<D>>, items?: Iterable<CalendarItem<D>>);
58
+ private observeResize;
59
+ private readonly onAdoptCheck;
60
+ /**
61
+ * Hosts may move a live calendar into another window (e.g. Obsidian's
62
+ * "Move to new window"). Listeners, timers and observers belong to a window,
63
+ * so rebind them to the root's current document and rebuild the view there.
64
+ */
65
+ adopt(): void;
66
+ /** Replaces all items, re-rendering only what changed. */
67
+ setItems(items: Iterable<CalendarItem<D>>): void;
68
+ upsertItems(items: Iterable<CalendarItem<D>>): void;
69
+ removeItems(ids: Iterable<string>): void;
70
+ getItem(id: string): CalendarItem<D> | undefined;
71
+ /**
72
+ * Updates options. Only what the change affects is rebuilt.
73
+ *
74
+ * In the timeline, a new `date`, range or scale keeps what is on screen
75
+ * instead of jumping back to the anchor date: a scale change keeps the
76
+ * instant at the middle of the visible track, other changes keep the left
77
+ * edge. Pass `anchor` to pin a different instant, e.g. the one under the
78
+ * pointer when zooming with the wheel.
79
+ */
80
+ setOptions(next: Partial<CalendarOptions<D>>, how?: {
81
+ anchor?: TimelineAnchor;
82
+ }): void;
83
+ /** What a timeline rebuild should keep on screen. */
84
+ private timelineKeep;
85
+ /** Re-renders everything, e.g. after render hooks start returning different content. */
86
+ rerender(): void;
87
+ getOptions(): Readonly<CalendarOptions<D>>;
88
+ changeView(view: ViewType, date?: DateInput): void;
89
+ gotoDate(date: DateInput): void;
90
+ prev(): void;
91
+ next(): void;
92
+ goToday(): void;
93
+ /** The anchor date, as local midnight of that civil day in the calendar zone. */
94
+ getDate(): Date;
95
+ getView(): ViewInfo;
96
+ /** Clears the current selection. */
97
+ unselect(): void;
98
+ /** Re-measures (e.g. after the host was shown or resized by a parent). */
99
+ updateSize(): void;
100
+ getScroll(): {
101
+ top: number;
102
+ left: number;
103
+ };
104
+ setScroll(s: {
105
+ top: number;
106
+ left: number;
107
+ }): void;
108
+ scrollToTime(time: string | number): void;
109
+ /**
110
+ * Scrolls a date (or instant) into view. In the timeline `align` places it
111
+ * at the start, middle or end of the visible track; other views move to
112
+ * the date if it is outside the range, and time grids scroll to its time.
113
+ */
114
+ scrollToDate(date: DateInput, opts?: {
115
+ align?: "start" | "center" | "end";
116
+ smooth?: boolean;
117
+ }): void;
118
+ /** What is under a client point: a time slot, a day, or a timeline row and date. Null outside the view. */
119
+ hitTest(clientX: number, clientY: number): Hit | null;
120
+ /** Item elements currently rendered for an id. */
121
+ elementsFor(id: string): HTMLElement[];
122
+ /**
123
+ * Starts dragging something from outside the calendar (a task tray, an
124
+ * unscheduled list). Call from a pointerdown handler; the calendar follows
125
+ * the pointer and fires `onExternalDrop` on release.
126
+ */
127
+ beginExternalDrag(ev: PointerEvent, source: ExternalDragSource<D>): void;
128
+ destroy(): void;
129
+ now(): number;
130
+ suppressNextClick(): void;
131
+ dayArg(day: Day): DayArg;
132
+ dayClasses(day: Day): string[];
133
+ isEditable(n: NormalizedItem<D>, what: "start" | "duration"): boolean;
134
+ navLink(day: Day, label: Node | string, cls: string): HTMLElement;
135
+ navigate(day: Day, jsEvent: MouseEvent | KeyboardEvent, view?: "day" | "month"): void;
136
+ createItemEl(meta: ElMeta<D>): HTMLElement;
137
+ refreshItemEl(el: HTMLElement, meta: ElMeta<D>): void;
138
+ private selectedSet;
139
+ private applySelected;
140
+ destroyItemEl(el: HTMLElement): void;
141
+ openMore(day: Day, anchor: HTMLElement, jsEvent: MouseEvent | KeyboardEvent): void;
142
+ private resolveText;
143
+ private todayDay;
144
+ private toDay;
145
+ private toMs;
146
+ private step;
147
+ private computeRange;
148
+ private computeTitle;
149
+ private rebuild;
150
+ private createView;
151
+ private renderToolbar;
152
+ private applyChange;
153
+ /** Renders pending changes now. Called automatically on the next frame. */
154
+ flush(): void;
155
+ private merge;
156
+ private scheduleTick;
157
+ private itemArg;
158
+ /** Start and (for timed and list items) end labels; the end is hidden on short items by CSS. */
159
+ private timeLabel;
160
+ private fillTime;
161
+ private ariaLabel;
162
+ private defaultContent;
163
+ private addHandles;
164
+ /** Start and finish link handles (a milestone has one). */
165
+ private addPorts;
166
+ private refreshMore;
167
+ private closeMore;
168
+ private bindEvents;
169
+ private unbindEvents;
170
+ private listenDoc;
171
+ private itemElFrom;
172
+ private readonly onDocPointerDown;
173
+ private readonly onPointerDown;
174
+ private activate;
175
+ private readonly onTouchMove;
176
+ private readonly onPointerMove;
177
+ private readonly onPointerUp;
178
+ private readonly onPointerCancel;
179
+ private readonly onDocKeyDown;
180
+ /** Proposal for the current pointer position. */
181
+ private track;
182
+ private trackExternal;
183
+ private externalItem;
184
+ private timelineSnap;
185
+ private civil;
186
+ private civilToMs;
187
+ private hitCivil;
188
+ private dayProposal;
189
+ private timedProposal;
190
+ private moveProposal;
191
+ private resizeProposal;
192
+ private withProposal;
193
+ private selectionFor;
194
+ private clickSlot;
195
+ private fireSelect;
196
+ private unselectSilently;
197
+ /** Ends the current pointer session, committing unless `cancel`. */
198
+ private endSession;
199
+ private commit;
200
+ /** Runs in the capture phase so the click ending a drag never reaches content inside the calendar, React portals included. */
201
+ private readonly onClickCapture;
202
+ private readonly onClick;
203
+ private readonly onDblClick;
204
+ private readonly onContextMenu;
205
+ private hoverId;
206
+ private readonly onMouseOver;
207
+ private readonly onMouseOut;
208
+ private leaveHover;
209
+ private readonly onKeyDown;
210
+ /** Alt+Arrow moves an item; Alt+Shift+Arrow changes its end; arrows on a focused grip move that edge. */
211
+ private nudge;
212
+ private readonly onNativeDragOver;
213
+ private readonly onNativeDragLeave;
214
+ private readonly onNativeDrop;
215
+ }
@@ -0,0 +1,107 @@
1
+ import type { Day } from "../core/date.cjs";
2
+ import type { ItemOrder } from "../core/layout.cjs";
3
+ import type { ItemStore, StoreChange } from "../core/store.cjs";
4
+ import type { NormalizedItem } from "../core/types.cjs";
5
+ import type { TimeZone } from "../core/zone.cjs";
6
+ import type { Formatter } from "./format.cjs";
7
+ import type { CalendarOptions, CalendarText, DayArg, Hit, ItemVariant, ViewInfo } from "./options.cjs";
8
+ export type Variant = ItemVariant;
9
+ export interface ElMeta<D = unknown> {
10
+ n: NormalizedItem<D>;
11
+ day: Day;
12
+ isStart: boolean;
13
+ isEnd: boolean;
14
+ variant: Variant;
15
+ mirror: boolean;
16
+ }
17
+ /** A time or day range being selected, or previewed for an external drop. */
18
+ export interface Selection {
19
+ startMs: number;
20
+ endMs: number;
21
+ allDay: boolean;
22
+ startDay: Day;
23
+ endDay: Day;
24
+ rowId?: string;
25
+ }
26
+ /** What views get from the calendar. */
27
+ export interface ViewContext<D = unknown> {
28
+ readonly doc: Document;
29
+ readonly win: Window;
30
+ readonly store: ItemStore<D>;
31
+ readonly opts: CalendarOptions<D>;
32
+ readonly zone: TimeZone;
33
+ readonly fmt: Formatter;
34
+ readonly text: CalendarText;
35
+ readonly order: ItemOrder<D>;
36
+ readonly view: ViewInfo;
37
+ readonly firstDay: number;
38
+ /** Visible days in order (hidden weekdays removed). */
39
+ readonly days: Day[];
40
+ readonly today: Day;
41
+ readonly conflicts: ReadonlyMap<string, string[]>;
42
+ readonly slot: {
43
+ min: number;
44
+ max: number;
45
+ duration: number;
46
+ snap: number;
47
+ scroll: number;
48
+ };
49
+ /** Item currently being dragged, if any. */
50
+ readonly draggingId: string | null;
51
+ now(): number;
52
+ meta: WeakMap<Element, ElMeta<D>>;
53
+ dayArg(day: Day): DayArg;
54
+ dayClasses(day: Day): string[];
55
+ isEditable(n: NormalizedItem<D>, what: "start" | "duration"): boolean;
56
+ /** Renders the element for an item (no position). */
57
+ createItemEl(meta: ElMeta<D>): HTMLElement;
58
+ /** Refreshes parts of an item element that depend on position (time label). */
59
+ refreshItemEl(el: HTMLElement, meta: ElMeta<D>): void;
60
+ destroyItemEl(el: HTMLElement): void;
61
+ /** Builds a nav link (day number / header) for a day. */
62
+ navLink(day: Day, label: Node | string, cls: string): HTMLElement;
63
+ openMore(day: Day, anchor: HTMLElement, jsEvent: MouseEvent | KeyboardEvent): void;
64
+ /** Follows a date link: `onNavLink`, or switches to `view` at `day`. */
65
+ navigate(day: Day, jsEvent: MouseEvent | KeyboardEvent, view?: "day" | "month"): void;
66
+ /** Swallows the click that follows a drag the view handled itself. */
67
+ suppressNextClick(): void;
68
+ /** Row override for the item being dragged in the timeline. */
69
+ readonly dragRow: {
70
+ id: string;
71
+ rowId: string;
72
+ } | null;
73
+ }
74
+ export interface View {
75
+ readonly el: HTMLElement;
76
+ /** Rebuilds everything when `change` is null; otherwise only what it touched. */
77
+ render(change: StoreChange | null): void;
78
+ hit(clientX: number, clientY: number): Hit | null;
79
+ showSelection(sel: Selection | null): void;
80
+ /** Called once a minute. */
81
+ tick?(): void;
82
+ resize?(): void;
83
+ getScroll(): {
84
+ top: number;
85
+ left: number;
86
+ };
87
+ setScroll(s: {
88
+ top: number;
89
+ left: number;
90
+ }): void;
91
+ scrollToTime?(minute: number): void;
92
+ /** Item elements currently shown for an id. */
93
+ elementsFor(id: string): HTMLElement[];
94
+ destroy(): void;
95
+ }
96
+ export declare class ItemPool<D> {
97
+ private readonly ctx;
98
+ readonly container: HTMLElement;
99
+ private readonly recs;
100
+ private used;
101
+ constructor(ctx: ViewContext<D>, container: HTMLElement);
102
+ begin(): void;
103
+ place(key: string, meta: ElMeta<D>): HTMLElement;
104
+ end(): void;
105
+ clear(): void;
106
+ elementsFor(id: string): HTMLElement[];
107
+ }
@@ -0,0 +1,107 @@
1
+ import type { Day } from "../core/date.js";
2
+ import type { ItemOrder } from "../core/layout.js";
3
+ import type { ItemStore, StoreChange } from "../core/store.js";
4
+ import type { NormalizedItem } from "../core/types.js";
5
+ import type { TimeZone } from "../core/zone.js";
6
+ import type { Formatter } from "./format.js";
7
+ import type { CalendarOptions, CalendarText, DayArg, Hit, ItemVariant, ViewInfo } from "./options.js";
8
+ export type Variant = ItemVariant;
9
+ export interface ElMeta<D = unknown> {
10
+ n: NormalizedItem<D>;
11
+ day: Day;
12
+ isStart: boolean;
13
+ isEnd: boolean;
14
+ variant: Variant;
15
+ mirror: boolean;
16
+ }
17
+ /** A time or day range being selected, or previewed for an external drop. */
18
+ export interface Selection {
19
+ startMs: number;
20
+ endMs: number;
21
+ allDay: boolean;
22
+ startDay: Day;
23
+ endDay: Day;
24
+ rowId?: string;
25
+ }
26
+ /** What views get from the calendar. */
27
+ export interface ViewContext<D = unknown> {
28
+ readonly doc: Document;
29
+ readonly win: Window;
30
+ readonly store: ItemStore<D>;
31
+ readonly opts: CalendarOptions<D>;
32
+ readonly zone: TimeZone;
33
+ readonly fmt: Formatter;
34
+ readonly text: CalendarText;
35
+ readonly order: ItemOrder<D>;
36
+ readonly view: ViewInfo;
37
+ readonly firstDay: number;
38
+ /** Visible days in order (hidden weekdays removed). */
39
+ readonly days: Day[];
40
+ readonly today: Day;
41
+ readonly conflicts: ReadonlyMap<string, string[]>;
42
+ readonly slot: {
43
+ min: number;
44
+ max: number;
45
+ duration: number;
46
+ snap: number;
47
+ scroll: number;
48
+ };
49
+ /** Item currently being dragged, if any. */
50
+ readonly draggingId: string | null;
51
+ now(): number;
52
+ meta: WeakMap<Element, ElMeta<D>>;
53
+ dayArg(day: Day): DayArg;
54
+ dayClasses(day: Day): string[];
55
+ isEditable(n: NormalizedItem<D>, what: "start" | "duration"): boolean;
56
+ /** Renders the element for an item (no position). */
57
+ createItemEl(meta: ElMeta<D>): HTMLElement;
58
+ /** Refreshes parts of an item element that depend on position (time label). */
59
+ refreshItemEl(el: HTMLElement, meta: ElMeta<D>): void;
60
+ destroyItemEl(el: HTMLElement): void;
61
+ /** Builds a nav link (day number / header) for a day. */
62
+ navLink(day: Day, label: Node | string, cls: string): HTMLElement;
63
+ openMore(day: Day, anchor: HTMLElement, jsEvent: MouseEvent | KeyboardEvent): void;
64
+ /** Follows a date link: `onNavLink`, or switches to `view` at `day`. */
65
+ navigate(day: Day, jsEvent: MouseEvent | KeyboardEvent, view?: "day" | "month"): void;
66
+ /** Swallows the click that follows a drag the view handled itself. */
67
+ suppressNextClick(): void;
68
+ /** Row override for the item being dragged in the timeline. */
69
+ readonly dragRow: {
70
+ id: string;
71
+ rowId: string;
72
+ } | null;
73
+ }
74
+ export interface View {
75
+ readonly el: HTMLElement;
76
+ /** Rebuilds everything when `change` is null; otherwise only what it touched. */
77
+ render(change: StoreChange | null): void;
78
+ hit(clientX: number, clientY: number): Hit | null;
79
+ showSelection(sel: Selection | null): void;
80
+ /** Called once a minute. */
81
+ tick?(): void;
82
+ resize?(): void;
83
+ getScroll(): {
84
+ top: number;
85
+ left: number;
86
+ };
87
+ setScroll(s: {
88
+ top: number;
89
+ left: number;
90
+ }): void;
91
+ scrollToTime?(minute: number): void;
92
+ /** Item elements currently shown for an id. */
93
+ elementsFor(id: string): HTMLElement[];
94
+ destroy(): void;
95
+ }
96
+ export declare class ItemPool<D> {
97
+ private readonly ctx;
98
+ readonly container: HTMLElement;
99
+ private readonly recs;
100
+ private used;
101
+ constructor(ctx: ViewContext<D>, container: HTMLElement);
102
+ begin(): void;
103
+ place(key: string, meta: ElMeta<D>): HTMLElement;
104
+ end(): void;
105
+ clear(): void;
106
+ elementsFor(id: string): HTMLElement[];
107
+ }
@@ -0,0 +1,8 @@
1
+ type Attrs = Record<string, string | number | boolean | null | undefined>;
2
+ /** Creates an element in `doc` (popout windows have their own document). */
3
+ export declare function h<K extends keyof HTMLElementTagNameMap>(doc: Document, tag: K, cls?: string | null, attrs?: Attrs | null, ...children: (Node | string | null | undefined | false)[]): HTMLElementTagNameMap[K];
4
+ export declare function setAttrs(el: Element, attrs: Attrs): void;
5
+ export declare function classList(value: string[] | string | undefined | null): string[];
6
+ export declare function setStyle(el: HTMLElement, props: Record<string, string | number | null>): void;
7
+ export declare function pct(n: number): string;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ type Attrs = Record<string, string | number | boolean | null | undefined>;
2
+ /** Creates an element in `doc` (popout windows have their own document). */
3
+ export declare function h<K extends keyof HTMLElementTagNameMap>(doc: Document, tag: K, cls?: string | null, attrs?: Attrs | null, ...children: (Node | string | null | undefined | false)[]): HTMLElementTagNameMap[K];
4
+ export declare function setAttrs(el: Element, attrs: Attrs): void;
5
+ export declare function classList(value: string[] | string | undefined | null): string[];
6
+ export declare function setStyle(el: HTMLElement, props: Record<string, string | number | null>): void;
7
+ export declare function pct(n: number): string;
8
+ export {};
@@ -0,0 +1,30 @@
1
+ import { type Day } from "../core/date.cjs";
2
+ /** Locale-aware labels. Formatting happens on UTC dates built from civil days, so zones never shift them. */
3
+ export declare class Formatter {
4
+ private readonly cache;
5
+ readonly locale: string | undefined;
6
+ readonly hour12: boolean;
7
+ constructor(locale: string | undefined, hour12: boolean | undefined);
8
+ private fmt;
9
+ private d;
10
+ weekdayShort(day: Day): string;
11
+ weekdayLong(day: Day): string;
12
+ weekdayNarrow(day: Day): string;
13
+ dayNumber(day: Day): string;
14
+ monthShort(day: Day): string;
15
+ monthLong(day: Day): string;
16
+ monthYear(day: Day): string;
17
+ year(day: Day): string;
18
+ fullDate(day: Day): string;
19
+ longDate(day: Day): string;
20
+ listDay(day: Day): string;
21
+ /** "Oct 19 – 25, 2026" style. */
22
+ range(startDay: Day, lastDay: Day): string;
23
+ /** Wall-clock minutes to a label. `compact` drops ":00" in 12-hour formats ("9am"). */
24
+ time(minute: number, compact?: boolean): string;
25
+ /** Hour labels for the gutter. */
26
+ slotLabel(minute: number): string;
27
+ isoDate(day: Day): string;
28
+ }
29
+ /** First day of the week for a locale (0 = Sunday), from Intl.Locale weekInfo where supported. */
30
+ export declare function localeFirstDay(locale: string | undefined): number;
@@ -0,0 +1,30 @@
1
+ import { type Day } from "../core/date.js";
2
+ /** Locale-aware labels. Formatting happens on UTC dates built from civil days, so zones never shift them. */
3
+ export declare class Formatter {
4
+ private readonly cache;
5
+ readonly locale: string | undefined;
6
+ readonly hour12: boolean;
7
+ constructor(locale: string | undefined, hour12: boolean | undefined);
8
+ private fmt;
9
+ private d;
10
+ weekdayShort(day: Day): string;
11
+ weekdayLong(day: Day): string;
12
+ weekdayNarrow(day: Day): string;
13
+ dayNumber(day: Day): string;
14
+ monthShort(day: Day): string;
15
+ monthLong(day: Day): string;
16
+ monthYear(day: Day): string;
17
+ year(day: Day): string;
18
+ fullDate(day: Day): string;
19
+ longDate(day: Day): string;
20
+ listDay(day: Day): string;
21
+ /** "Oct 19 – 25, 2026" style. */
22
+ range(startDay: Day, lastDay: Day): string;
23
+ /** Wall-clock minutes to a label. `compact` drops ":00" in 12-hour formats ("9am"). */
24
+ time(minute: number, compact?: boolean): string;
25
+ /** Hour labels for the gutter. */
26
+ slotLabel(minute: number): string;
27
+ isoDate(day: Day): string;
28
+ }
29
+ /** First day of the week for a locale (0 = Sunday), from Intl.Locale weekInfo where supported. */
30
+ export declare function localeFirstDay(locale: string | undefined): number;