@super-calendar/core 2.17.0 → 2.19.0
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/README.md +8 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -10
- package/dist/index.mjs +9 -11
- package/dist/{recurrence-CvIJfSMl.mjs → recurrence-BqpCShcV.mjs} +402 -101
- package/dist/{recurrence-D_oJ7A9D.js → recurrence-CTjr6nxJ.js} +454 -99
- package/dist/{timezone-vbd68uRS.d.mts → timezone-DhGhYIeB.d.mts} +150 -13
- package/dist/{timezone-vbd68uRS.d.ts → timezone-DhGhYIeB.d.ts} +150 -13
- package/dist/vanilla.d.mts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +10 -1
- package/dist/vanilla.mjs +1 -1
- package/package.json +1 -1
- package/src/types.ts +7 -0
- package/src/utils/dates.ts +7 -2
- package/src/utils/drag.ts +14 -6
- package/src/utils/eventSource.ts +2 -0
- package/src/utils/ical.ts +5 -0
- package/src/utils/layout.ts +19 -5
- package/src/utils/monthGrid.ts +135 -1
- package/src/utils/multiWeekGrid.ts +2 -1
- package/src/utils/recurrence.ts +203 -77
- package/src/utils/timezone.ts +151 -48
- package/src/utils/useMonthGrid.ts +5 -0
- package/src/utils/useNow.ts +4 -9
- package/src/utils/zoneFields.ts +71 -0
|
@@ -83,6 +83,13 @@ interface RecurrenceRule {
|
|
|
83
83
|
* the event's time of day. Omit to repeat on the start date's own weekday.
|
|
84
84
|
*/
|
|
85
85
|
weekdays?: WeekStartsOn[];
|
|
86
|
+
/**
|
|
87
|
+
* For `weekly` rules with `weekdays`: the day a week starts on (0 = Sunday …
|
|
88
|
+
* 6 = Saturday). It decides which of the `weekdays` share a week, so it only
|
|
89
|
+
* changes the result when `interval` is greater than 1. Default 1 (Monday),
|
|
90
|
+
* as in RFC 5545. Maps to iCal `WKST`.
|
|
91
|
+
*/
|
|
92
|
+
weekStartsOn?: WeekStartsOn;
|
|
86
93
|
/**
|
|
87
94
|
* For `monthly`/`yearly`: repeat on the Nth weekday of the period instead of the
|
|
88
95
|
* start date's day-of-month — e.g. `{ week: 3, weekday: 1 }` is the 3rd Monday.
|
|
@@ -365,8 +372,12 @@ declare const buildMonthWeeks: (month: Date, weekStartsOn: WeekStartsOn, { showS
|
|
|
365
372
|
declare const filterHiddenDays: (days: Date[], hiddenDays?: number[]) => Date[];
|
|
366
373
|
/** True when `date` is a Saturday or Sunday. */
|
|
367
374
|
declare const isWeekend: (date: Date) => boolean;
|
|
368
|
-
/**
|
|
369
|
-
|
|
375
|
+
/**
|
|
376
|
+
* True when `date` falls on the current calendar day. Pass `today` to compare
|
|
377
|
+
* against that day instead of the device clock, e.g. the result of
|
|
378
|
+
* `nowInTimeZone` for a calendar displayed in another time zone.
|
|
379
|
+
*/
|
|
380
|
+
declare const getIsToday: (date: Date, today?: Date) => boolean;
|
|
370
381
|
/** True when `a` and `b` are the same calendar day (ignoring the time of day). */
|
|
371
382
|
declare const isSameCalendarDay: (a: Date, b: Date) => boolean;
|
|
372
383
|
/** Minutes elapsed since midnight (0–1439). */
|
|
@@ -375,8 +386,10 @@ declare const minutesIntoDay: (date: Date) => number;
|
|
|
375
386
|
declare const getYearMonths: (date: Date) => Date[];
|
|
376
387
|
/**
|
|
377
388
|
* True when two time ranges overlap. Edges touching (one ends exactly when the
|
|
378
|
-
* next begins) do not count as an overlap.
|
|
379
|
-
*
|
|
389
|
+
* next begins) do not count as an overlap. A zero-length range occupies its own
|
|
390
|
+
* instant: it overlaps a range that contains that instant or starts at it, and
|
|
391
|
+
* another zero-length range at the same instant. Compares absolute instants, so
|
|
392
|
+
* events at the same wall-clock time on different days do not overlap.
|
|
380
393
|
*/
|
|
381
394
|
declare function eventsOverlap(aStart: Date, aEnd: Date, bStart: Date, bEnd: Date): boolean;
|
|
382
395
|
/**
|
|
@@ -444,8 +457,8 @@ declare function resolveDraggedBounds(start: Date, end: Date, deltaStartMinutes:
|
|
|
444
457
|
} | null;
|
|
445
458
|
/**
|
|
446
459
|
* The all-day range swept out between two day cells of the month grid, ordered
|
|
447
|
-
* whichever way the sweep ran: `start` is
|
|
448
|
-
*
|
|
460
|
+
* whichever way the sweep ran: `start` is the first local day's start and `end` is
|
|
461
|
+
* the next day's start after the last, so a one-day sweep yields a usable event. Shared
|
|
449
462
|
* by both renderers so a month drag-to-create means the same thing on each.
|
|
450
463
|
*/
|
|
451
464
|
declare function monthCreateRange(anchor: Date, hover: Date): {
|
|
@@ -888,6 +901,47 @@ interface MonthWeekEvents<T = unknown> {
|
|
|
888
901
|
* matching how calendars keep long events on the upper lanes.
|
|
889
902
|
*/
|
|
890
903
|
declare function layoutMonthWeek<T>(days: Date[], events: readonly CalendarEvent<T>[]): MonthWeekEvents<T>;
|
|
904
|
+
/**
|
|
905
|
+
* The columns of a week row that show one lane more than the row. A row whose
|
|
906
|
+
* lanes overflow shows `visibleLanes` of them and folds each day's rest into a
|
|
907
|
+
* "+N more" label. A day whose only hidden event sits on lane `visibleLanes` draws
|
|
908
|
+
* that event in the label's place instead of "+1 more". Call it only when
|
|
909
|
+
* a bar on lane `visibleLanes` fits in the cell.
|
|
910
|
+
*/
|
|
911
|
+
declare function monthExtraLaneColumns<T>(layout: MonthWeekEvents<T>, visibleLanes: number, columnCount: number): boolean[];
|
|
912
|
+
/**
|
|
913
|
+
* The bars a week row draws: every segment above `visibleLanes`, plus the parts of
|
|
914
|
+
* a segment on lane `visibleLanes` that cross `extraLane` columns (see
|
|
915
|
+
* {@link monthExtraLaneColumns}), one bar per run of such columns. A bar cut short
|
|
916
|
+
* by a column that hides the event is marked as continuing past that edge.
|
|
917
|
+
*/
|
|
918
|
+
declare function monthVisibleBars<T>(layout: MonthWeekEvents<T>, visibleLanes: number, extraLane: readonly boolean[]): MonthEventSegment<T>[];
|
|
919
|
+
/**
|
|
920
|
+
* `eventsByDay` with a create draft added to every day it covers, where an event
|
|
921
|
+
* appended to the calendar's events would go: last in each day, or among the
|
|
922
|
+
* day's events in `compareDayEvents` order when `sorted`. Lay a week row out
|
|
923
|
+
* from the result to place the draft where the created event will land.
|
|
924
|
+
*/
|
|
925
|
+
declare function withDraftEventDays<T>(eventsByDay: ReadonlyMap<string, CalendarEvent<T>[]>, draft: CalendarEvent<T>, sorted?: boolean): Map<string, CalendarEvent<T>[]>;
|
|
926
|
+
/** How a renderer shows a week row's lanes, for {@link keepMonthDraftVisible}. */
|
|
927
|
+
interface MonthRowLanes {
|
|
928
|
+
/** Lanes every day of a row with `laneCount` lanes shows. */
|
|
929
|
+
visibleLanes: (laneCount: number) => number;
|
|
930
|
+
/**
|
|
931
|
+
* Whether a day may draw lane `visibleLanes` in place of its "+N more" label
|
|
932
|
+
* (see {@link monthExtraLaneColumns}). Omit when the renderer never does.
|
|
933
|
+
*/
|
|
934
|
+
extraLaneFits?: (visibleLanes: number) => boolean;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* A week row's layout with a create draft kept in view. `withDraft` lays the row
|
|
938
|
+
* out with the draft where the created event will land. When the row would hide
|
|
939
|
+
* that lane, the draft moves to lane 0 instead and the row's other bars
|
|
940
|
+
* (`withoutDraft`) move down one lane. A draft on the first hidden lane stays put
|
|
941
|
+
* when every day it covers draws that lane in place of its label. A row the draft
|
|
942
|
+
* misses comes back as `withDraft`.
|
|
943
|
+
*/
|
|
944
|
+
declare function keepMonthDraftVisible<T>(withDraft: MonthWeekEvents<T>, withoutDraft: MonthWeekEvents<T>, draft: CalendarEvent<T>, { visibleLanes, extraLaneFits }: MonthRowLanes): MonthWeekEvents<T>;
|
|
891
945
|
/** A single day in the grid, with all the state a custom cell needs to render. */
|
|
892
946
|
interface MonthGridDay {
|
|
893
947
|
/** The day this cell represents. */
|
|
@@ -963,6 +1017,11 @@ interface UseMonthGridOptions extends DateSelectionConstraints {
|
|
|
963
1017
|
selectedRange?: DateRange;
|
|
964
1018
|
/** A date-fns locale for the weekday labels. */
|
|
965
1019
|
locale?: Locale;
|
|
1020
|
+
/**
|
|
1021
|
+
* The calendar day flagged `isToday`. Defaults to the device's current day;
|
|
1022
|
+
* pass `nowInTimeZone(now, timeZone)` for a grid shown in another time zone.
|
|
1023
|
+
*/
|
|
1024
|
+
today?: Date;
|
|
966
1025
|
}
|
|
967
1026
|
/**
|
|
968
1027
|
* Pure month-grid builder: the weeks and weekday headers for `month`, each day
|
|
@@ -1021,13 +1080,30 @@ interface MultiWeekGrid {
|
|
|
1021
1080
|
* safe integer, or the last week falls outside the range `Date` can represent.
|
|
1022
1081
|
*/
|
|
1023
1082
|
declare function buildMultiWeekGrid(date: Date, options?: MultiWeekGridOptions): MultiWeekGrid;
|
|
1083
|
+
/** Options for {@link expandRecurringEvents}. */
|
|
1084
|
+
interface ExpandRecurringEventsOptions {
|
|
1085
|
+
/**
|
|
1086
|
+
* The IANA time zone whose wall clock the rules repeat on (e.g.
|
|
1087
|
+
* `"America/New_York"`). A timed event keeps its clock time in that zone across
|
|
1088
|
+
* the zone's DST changes, and its weekday, month-day and exception rules read
|
|
1089
|
+
* that zone's calendar. An exception that reads the event's own time of day
|
|
1090
|
+
* there (or equals one of the `rdates`) drops the occurrence at that instant;
|
|
1091
|
+
* any other exception at midnight, on the device or in the zone, drops its
|
|
1092
|
+
* whole day. Omit it to repeat on the device's clock. All-day events
|
|
1093
|
+
* name calendar days, so they always repeat on the device's calendar.
|
|
1094
|
+
*/
|
|
1095
|
+
timeZone?: string;
|
|
1096
|
+
}
|
|
1024
1097
|
/**
|
|
1025
1098
|
* Materialise recurring events into concrete occurrences overlapping
|
|
1026
1099
|
* `[rangeStart, rangeEnd]`. Non-recurring events pass through untouched, so the
|
|
1027
1100
|
* result is ready to hand to `<Calendar events={...} />`. Each occurrence keeps
|
|
1028
1101
|
* the original event's duration and fields (minus `recurrence`).
|
|
1102
|
+
*
|
|
1103
|
+
* Pass `timeZone` to repeat timed events on that zone's wall clock instead of
|
|
1104
|
+
* the device's. `rangeStart` and `rangeEnd` are real instants either way.
|
|
1029
1105
|
*/
|
|
1030
|
-
declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart: Date, rangeEnd: Date): CalendarEvent<T>[];
|
|
1106
|
+
declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart: Date, rangeEnd: Date, { timeZone }?: ExpandRecurringEventsOptions): CalendarEvent<T>[];
|
|
1031
1107
|
/**
|
|
1032
1108
|
* Reinterpret an instant as its wall-clock time in `timeZone`, returned as a
|
|
1033
1109
|
* device-local `Date` whose fields (hours, minutes, …) read back as that zone's
|
|
@@ -1039,18 +1115,79 @@ declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart
|
|
|
1039
1115
|
* original UTC instant, so don't round-trip it back to a real time.
|
|
1040
1116
|
*/
|
|
1041
1117
|
declare function toZonedTime(date: Date, timeZone: string): Date;
|
|
1118
|
+
/**
|
|
1119
|
+
* The current instant, or the fixed `now` when given, as the wall clock of
|
|
1120
|
+
* `timeZone` (see {@link toZonedTime}). Without a `timeZone` it is the instant
|
|
1121
|
+
* itself, read on the device clock. Compare calendar days against it to find
|
|
1122
|
+
* "today" for a calendar displayed in another time zone.
|
|
1123
|
+
*/
|
|
1124
|
+
declare function nowInTimeZone(now?: Date, timeZone?: string): Date;
|
|
1042
1125
|
/**
|
|
1043
1126
|
* The inverse of {@link toZonedTime}: given a wall-clock time in `timeZone`,
|
|
1044
1127
|
* return the absolute UTC instant. Pass the wall clock as a `Date` whose **UTC**
|
|
1045
1128
|
* fields hold the components (e.g. `new Date(Date.UTC(y, m, d, h, min))`). Used to
|
|
1046
|
-
* resolve iCal `TZID` times; DST-correct via a two-pass offset
|
|
1047
|
-
*
|
|
1129
|
+
* resolve iCal `TZID` times; DST-correct via a two-pass offset. A time in the
|
|
1130
|
+
* hour a spring-forward change skips names no instant; it resolves the same
|
|
1131
|
+
* distance after the skipped hour (02:30 becomes 03:30), as a device clock does.
|
|
1048
1132
|
*/
|
|
1049
1133
|
declare function zonedTimeToUtc(wallClock: Date, timeZone: string): Date;
|
|
1050
1134
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1135
|
+
* The inverse of {@link toZonedTime}: the real instant for a date whose
|
|
1136
|
+
* device-local fields hold a wall-clock time in `timeZone`, such as a date a
|
|
1137
|
+
* calendar displaying that zone reports. DST-correct via {@link zonedTimeToUtc}.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function fromZonedTime(date: Date, timeZone: string): Date;
|
|
1140
|
+
/**
|
|
1141
|
+
* Shift every timed event's `start`/`end` through {@link toZonedTime} so the
|
|
1142
|
+
* calendar displays them in `timeZone`. Other fields are preserved. All-day
|
|
1143
|
+
* events (see `isAllDayEvent`) name calendar days, not instants, so they are
|
|
1144
|
+
* returned as they are and stay on their days. Memoize the result (e.g. with
|
|
1145
|
+
* `useMemo`) since it allocates new dates.
|
|
1054
1146
|
*/
|
|
1055
1147
|
declare function eventsInTimeZone<T>(events: CalendarEvent<T>[], timeZone: string): CalendarEvent<T>[];
|
|
1056
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* The event a display copy made by {@link eventsInTimeZone} stands for, with its
|
|
1150
|
+
* real `start` and `end`. Any other event is returned as it is. Use it in the
|
|
1151
|
+
* callbacks of a view that displays zoned events, to get back the event you
|
|
1152
|
+
* passed in.
|
|
1153
|
+
*/
|
|
1154
|
+
declare function zonedEventSource<T>(event: CalendarEvent<T>): CalendarEvent<T>;
|
|
1155
|
+
/** Options for {@link zonedDragBounds}. */
|
|
1156
|
+
interface ZonedDragBoundsOptions {
|
|
1157
|
+
/**
|
|
1158
|
+
* Keep the event's real elapsed duration when the drag moved both edges, as a
|
|
1159
|
+
* time-grid move does: the start is read off the zone's wall clock and the end
|
|
1160
|
+
* follows it, so a move across a DST change in the zone doesn't stretch or
|
|
1161
|
+
* shrink the event. Leave it off for a month-grid drop, which keeps the clock
|
|
1162
|
+
* time of both edges.
|
|
1163
|
+
*/
|
|
1164
|
+
keepDuration?: boolean;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Convert the bounds a view reports for a dragged event back to real instants.
|
|
1168
|
+
* `event` is the displayed event the view passed to `onDragEvent`, and `start`
|
|
1169
|
+
* / `end` the bounds it reported. For a display copy made by
|
|
1170
|
+
* {@link eventsInTimeZone}, each bound is read as a wall-clock time in that
|
|
1171
|
+
* zone, following the zone's own DST changes; an edge the drag left alone keeps
|
|
1172
|
+
* the source event's exact instant. Bounds of any other event (an all-day
|
|
1173
|
+
* event, or one that was never shifted) are returned unchanged.
|
|
1174
|
+
*
|
|
1175
|
+
* Returns `null` when the reported span doesn't survive the conversion: an edge
|
|
1176
|
+
* dropped into the hour a spring-forward change skips moves to after it, which
|
|
1177
|
+
* can leave the event ending at or before its start. Reject such a drop.
|
|
1178
|
+
*/
|
|
1179
|
+
declare function zonedDragBounds<T>(event: CalendarEvent<T>, start: Date, end: Date, { keepDuration }?: ZonedDragBoundsOptions): {
|
|
1180
|
+
start: Date;
|
|
1181
|
+
end: Date;
|
|
1182
|
+
} | null;
|
|
1183
|
+
/**
|
|
1184
|
+
* Convert a wall-clock range a view reports in `timeZone` (a created event, for
|
|
1185
|
+
* example) to real instants. Returns `null` when the span doesn't survive the
|
|
1186
|
+
* conversion: a time in the hour a spring-forward change skips moves to after
|
|
1187
|
+
* it, which can leave the range ending at or before its start.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function fromZonedRange(start: Date, end: Date, timeZone: string): {
|
|
1190
|
+
start: Date;
|
|
1191
|
+
end: Date;
|
|
1192
|
+
} | null;
|
|
1193
|
+
export { EventAccessibilityLabelContext as $, rangeBandKind as $t, monthExtraLaneColumns as A, getIsToday as At, eventDayKeys as B, DateRange as Bt, MonthRowLanes as C, overlapsOtherEvents as Ct, buildMonthGrid as D, snapDeltaMinutes as Dt, WeekdayFormat as E, shiftMinutes as Et, backgroundBandsForDay as F, isWeekend as Ft, wallClockHours as G, isDateSelectable as Gt, isAllDayEvent as H, DaySelectionState as Ht, clockHoursBetween as I, minutesIntoDay as It, loadEventSource as J, nextDateRange as Jt, EventSource as K, isRangeEndpoint as Kt, closedHourBands as L, viewDayCount as Lt, weekdayFormatToken as M, getWeekDays as Mt, withDraftEventDays as N, getYearMonths as Nt, keepMonthDraftVisible as O, buildMonthWeeks as Ot, PositionedEvent as P, isSameCalendarDay as Pt, toICalendar as Q, dayBadgeKind as Qt, compareDayEvents as R, weekDaysCount as Rt, MonthGridWeekday as S, movedClockSpan as St, UseMonthGridOptions as T, resolveDraggedBounds as Tt, isBackgroundEvent as U, UseDateRangeOptions as Ut, groupEventsByDay as V, DateSelectionConstraints as Vt, layoutDayEvents as W, daySelectionState as Wt, ToICalendarOptions as X, RangeBandKind as Xt, ICalEvent as Y, DayBadgeKind as Yt, parseICalendar as Z, bandRounding as Zt, buildMultiWeekGrid as _, cellRangeFromDrag as _t, nowInTimeZone as a, BusinessHoursValue as an, eventChipLayout as at, MonthGridDay as b, monthCreateRange as bt, zonedEventSource as c, CalendarMode as cn, isTimeVisibleAtHeight as ct, expandRecurringEvents as d, ICalendarEvent as dn, titleEllipsizeMode as dt, CalendarColors as en, EventAccessibilityLabeler as et, MultiWeekGrid as f, RecurrenceFrequency as fn, titleNumberOfLines as ft, MultiWeekGridWeek as g, WeekStartsOn as gn, resolveCalendarLabels as gt, MultiWeekGridOptions as h, TimeGridMode as hn, defaultCalendarLabels as ht, fromZonedTime as i, BusinessHoursBand as in, eventAccessibilityLabel as it, monthVisibleBars as j, getViewDays as jt, layoutMonthWeek as k, filterHiddenDays as kt, zonedTimeToUtc as l, CreateGhostArgs as ln, monthEventCapacity as lt, MultiWeekGridInterval as m, ScrollToTimeOptions as mn, dayAccessibilityLabel as mt, eventsInTimeZone as n, lightColors as nn, MIN_BOX_HEIGHT_FOR_TIME as nt, toZonedTime as o, CalendarEvent as on, eventTimeLabel as ot, MultiWeekGridDay as p, RecurrenceRule as pn, CalendarLabels as pt, EventSourceOptions as q, isWithinDateRange as qt, fromZonedRange as r, BusinessHours as rn, MonthEventCapacity as rt, zonedDragBounds as s, CalendarHandle as sn, formatHour as st, ZonedDragBoundsOptions as t, darkColors as tn, EventChipLayout as tt, ExpandRecurringEventsOptions as u, EventKeyExtractor as un, monthVisibleCount as ut, MonthEventSegment as v, clampMoveStartMinutes as vt, MonthWeekEvents as w, pageStepDays as wt, MonthGridWeek as x, monthDropBounds as xt, MonthGrid as y, eventsOverlap as yt, drawnEnd as z, CalendarSelection as zt };
|
|
@@ -83,6 +83,13 @@ interface RecurrenceRule {
|
|
|
83
83
|
* the event's time of day. Omit to repeat on the start date's own weekday.
|
|
84
84
|
*/
|
|
85
85
|
weekdays?: WeekStartsOn[];
|
|
86
|
+
/**
|
|
87
|
+
* For `weekly` rules with `weekdays`: the day a week starts on (0 = Sunday …
|
|
88
|
+
* 6 = Saturday). It decides which of the `weekdays` share a week, so it only
|
|
89
|
+
* changes the result when `interval` is greater than 1. Default 1 (Monday),
|
|
90
|
+
* as in RFC 5545. Maps to iCal `WKST`.
|
|
91
|
+
*/
|
|
92
|
+
weekStartsOn?: WeekStartsOn;
|
|
86
93
|
/**
|
|
87
94
|
* For `monthly`/`yearly`: repeat on the Nth weekday of the period instead of the
|
|
88
95
|
* start date's day-of-month — e.g. `{ week: 3, weekday: 1 }` is the 3rd Monday.
|
|
@@ -365,8 +372,12 @@ declare const buildMonthWeeks: (month: Date, weekStartsOn: WeekStartsOn, { showS
|
|
|
365
372
|
declare const filterHiddenDays: (days: Date[], hiddenDays?: number[]) => Date[];
|
|
366
373
|
/** True when `date` is a Saturday or Sunday. */
|
|
367
374
|
declare const isWeekend: (date: Date) => boolean;
|
|
368
|
-
/**
|
|
369
|
-
|
|
375
|
+
/**
|
|
376
|
+
* True when `date` falls on the current calendar day. Pass `today` to compare
|
|
377
|
+
* against that day instead of the device clock, e.g. the result of
|
|
378
|
+
* `nowInTimeZone` for a calendar displayed in another time zone.
|
|
379
|
+
*/
|
|
380
|
+
declare const getIsToday: (date: Date, today?: Date) => boolean;
|
|
370
381
|
/** True when `a` and `b` are the same calendar day (ignoring the time of day). */
|
|
371
382
|
declare const isSameCalendarDay: (a: Date, b: Date) => boolean;
|
|
372
383
|
/** Minutes elapsed since midnight (0–1439). */
|
|
@@ -375,8 +386,10 @@ declare const minutesIntoDay: (date: Date) => number;
|
|
|
375
386
|
declare const getYearMonths: (date: Date) => Date[];
|
|
376
387
|
/**
|
|
377
388
|
* True when two time ranges overlap. Edges touching (one ends exactly when the
|
|
378
|
-
* next begins) do not count as an overlap.
|
|
379
|
-
*
|
|
389
|
+
* next begins) do not count as an overlap. A zero-length range occupies its own
|
|
390
|
+
* instant: it overlaps a range that contains that instant or starts at it, and
|
|
391
|
+
* another zero-length range at the same instant. Compares absolute instants, so
|
|
392
|
+
* events at the same wall-clock time on different days do not overlap.
|
|
380
393
|
*/
|
|
381
394
|
declare function eventsOverlap(aStart: Date, aEnd: Date, bStart: Date, bEnd: Date): boolean;
|
|
382
395
|
/**
|
|
@@ -444,8 +457,8 @@ declare function resolveDraggedBounds(start: Date, end: Date, deltaStartMinutes:
|
|
|
444
457
|
} | null;
|
|
445
458
|
/**
|
|
446
459
|
* The all-day range swept out between two day cells of the month grid, ordered
|
|
447
|
-
* whichever way the sweep ran: `start` is
|
|
448
|
-
*
|
|
460
|
+
* whichever way the sweep ran: `start` is the first local day's start and `end` is
|
|
461
|
+
* the next day's start after the last, so a one-day sweep yields a usable event. Shared
|
|
449
462
|
* by both renderers so a month drag-to-create means the same thing on each.
|
|
450
463
|
*/
|
|
451
464
|
declare function monthCreateRange(anchor: Date, hover: Date): {
|
|
@@ -888,6 +901,47 @@ interface MonthWeekEvents<T = unknown> {
|
|
|
888
901
|
* matching how calendars keep long events on the upper lanes.
|
|
889
902
|
*/
|
|
890
903
|
declare function layoutMonthWeek<T>(days: Date[], events: readonly CalendarEvent<T>[]): MonthWeekEvents<T>;
|
|
904
|
+
/**
|
|
905
|
+
* The columns of a week row that show one lane more than the row. A row whose
|
|
906
|
+
* lanes overflow shows `visibleLanes` of them and folds each day's rest into a
|
|
907
|
+
* "+N more" label. A day whose only hidden event sits on lane `visibleLanes` draws
|
|
908
|
+
* that event in the label's place instead of "+1 more". Call it only when
|
|
909
|
+
* a bar on lane `visibleLanes` fits in the cell.
|
|
910
|
+
*/
|
|
911
|
+
declare function monthExtraLaneColumns<T>(layout: MonthWeekEvents<T>, visibleLanes: number, columnCount: number): boolean[];
|
|
912
|
+
/**
|
|
913
|
+
* The bars a week row draws: every segment above `visibleLanes`, plus the parts of
|
|
914
|
+
* a segment on lane `visibleLanes` that cross `extraLane` columns (see
|
|
915
|
+
* {@link monthExtraLaneColumns}), one bar per run of such columns. A bar cut short
|
|
916
|
+
* by a column that hides the event is marked as continuing past that edge.
|
|
917
|
+
*/
|
|
918
|
+
declare function monthVisibleBars<T>(layout: MonthWeekEvents<T>, visibleLanes: number, extraLane: readonly boolean[]): MonthEventSegment<T>[];
|
|
919
|
+
/**
|
|
920
|
+
* `eventsByDay` with a create draft added to every day it covers, where an event
|
|
921
|
+
* appended to the calendar's events would go: last in each day, or among the
|
|
922
|
+
* day's events in `compareDayEvents` order when `sorted`. Lay a week row out
|
|
923
|
+
* from the result to place the draft where the created event will land.
|
|
924
|
+
*/
|
|
925
|
+
declare function withDraftEventDays<T>(eventsByDay: ReadonlyMap<string, CalendarEvent<T>[]>, draft: CalendarEvent<T>, sorted?: boolean): Map<string, CalendarEvent<T>[]>;
|
|
926
|
+
/** How a renderer shows a week row's lanes, for {@link keepMonthDraftVisible}. */
|
|
927
|
+
interface MonthRowLanes {
|
|
928
|
+
/** Lanes every day of a row with `laneCount` lanes shows. */
|
|
929
|
+
visibleLanes: (laneCount: number) => number;
|
|
930
|
+
/**
|
|
931
|
+
* Whether a day may draw lane `visibleLanes` in place of its "+N more" label
|
|
932
|
+
* (see {@link monthExtraLaneColumns}). Omit when the renderer never does.
|
|
933
|
+
*/
|
|
934
|
+
extraLaneFits?: (visibleLanes: number) => boolean;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* A week row's layout with a create draft kept in view. `withDraft` lays the row
|
|
938
|
+
* out with the draft where the created event will land. When the row would hide
|
|
939
|
+
* that lane, the draft moves to lane 0 instead and the row's other bars
|
|
940
|
+
* (`withoutDraft`) move down one lane. A draft on the first hidden lane stays put
|
|
941
|
+
* when every day it covers draws that lane in place of its label. A row the draft
|
|
942
|
+
* misses comes back as `withDraft`.
|
|
943
|
+
*/
|
|
944
|
+
declare function keepMonthDraftVisible<T>(withDraft: MonthWeekEvents<T>, withoutDraft: MonthWeekEvents<T>, draft: CalendarEvent<T>, { visibleLanes, extraLaneFits }: MonthRowLanes): MonthWeekEvents<T>;
|
|
891
945
|
/** A single day in the grid, with all the state a custom cell needs to render. */
|
|
892
946
|
interface MonthGridDay {
|
|
893
947
|
/** The day this cell represents. */
|
|
@@ -963,6 +1017,11 @@ interface UseMonthGridOptions extends DateSelectionConstraints {
|
|
|
963
1017
|
selectedRange?: DateRange;
|
|
964
1018
|
/** A date-fns locale for the weekday labels. */
|
|
965
1019
|
locale?: Locale;
|
|
1020
|
+
/**
|
|
1021
|
+
* The calendar day flagged `isToday`. Defaults to the device's current day;
|
|
1022
|
+
* pass `nowInTimeZone(now, timeZone)` for a grid shown in another time zone.
|
|
1023
|
+
*/
|
|
1024
|
+
today?: Date;
|
|
966
1025
|
}
|
|
967
1026
|
/**
|
|
968
1027
|
* Pure month-grid builder: the weeks and weekday headers for `month`, each day
|
|
@@ -1021,13 +1080,30 @@ interface MultiWeekGrid {
|
|
|
1021
1080
|
* safe integer, or the last week falls outside the range `Date` can represent.
|
|
1022
1081
|
*/
|
|
1023
1082
|
declare function buildMultiWeekGrid(date: Date, options?: MultiWeekGridOptions): MultiWeekGrid;
|
|
1083
|
+
/** Options for {@link expandRecurringEvents}. */
|
|
1084
|
+
interface ExpandRecurringEventsOptions {
|
|
1085
|
+
/**
|
|
1086
|
+
* The IANA time zone whose wall clock the rules repeat on (e.g.
|
|
1087
|
+
* `"America/New_York"`). A timed event keeps its clock time in that zone across
|
|
1088
|
+
* the zone's DST changes, and its weekday, month-day and exception rules read
|
|
1089
|
+
* that zone's calendar. An exception that reads the event's own time of day
|
|
1090
|
+
* there (or equals one of the `rdates`) drops the occurrence at that instant;
|
|
1091
|
+
* any other exception at midnight, on the device or in the zone, drops its
|
|
1092
|
+
* whole day. Omit it to repeat on the device's clock. All-day events
|
|
1093
|
+
* name calendar days, so they always repeat on the device's calendar.
|
|
1094
|
+
*/
|
|
1095
|
+
timeZone?: string;
|
|
1096
|
+
}
|
|
1024
1097
|
/**
|
|
1025
1098
|
* Materialise recurring events into concrete occurrences overlapping
|
|
1026
1099
|
* `[rangeStart, rangeEnd]`. Non-recurring events pass through untouched, so the
|
|
1027
1100
|
* result is ready to hand to `<Calendar events={...} />`. Each occurrence keeps
|
|
1028
1101
|
* the original event's duration and fields (minus `recurrence`).
|
|
1102
|
+
*
|
|
1103
|
+
* Pass `timeZone` to repeat timed events on that zone's wall clock instead of
|
|
1104
|
+
* the device's. `rangeStart` and `rangeEnd` are real instants either way.
|
|
1029
1105
|
*/
|
|
1030
|
-
declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart: Date, rangeEnd: Date): CalendarEvent<T>[];
|
|
1106
|
+
declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart: Date, rangeEnd: Date, { timeZone }?: ExpandRecurringEventsOptions): CalendarEvent<T>[];
|
|
1031
1107
|
/**
|
|
1032
1108
|
* Reinterpret an instant as its wall-clock time in `timeZone`, returned as a
|
|
1033
1109
|
* device-local `Date` whose fields (hours, minutes, …) read back as that zone's
|
|
@@ -1039,18 +1115,79 @@ declare function expandRecurringEvents<T>(events: CalendarEvent<T>[], rangeStart
|
|
|
1039
1115
|
* original UTC instant, so don't round-trip it back to a real time.
|
|
1040
1116
|
*/
|
|
1041
1117
|
declare function toZonedTime(date: Date, timeZone: string): Date;
|
|
1118
|
+
/**
|
|
1119
|
+
* The current instant, or the fixed `now` when given, as the wall clock of
|
|
1120
|
+
* `timeZone` (see {@link toZonedTime}). Without a `timeZone` it is the instant
|
|
1121
|
+
* itself, read on the device clock. Compare calendar days against it to find
|
|
1122
|
+
* "today" for a calendar displayed in another time zone.
|
|
1123
|
+
*/
|
|
1124
|
+
declare function nowInTimeZone(now?: Date, timeZone?: string): Date;
|
|
1042
1125
|
/**
|
|
1043
1126
|
* The inverse of {@link toZonedTime}: given a wall-clock time in `timeZone`,
|
|
1044
1127
|
* return the absolute UTC instant. Pass the wall clock as a `Date` whose **UTC**
|
|
1045
1128
|
* fields hold the components (e.g. `new Date(Date.UTC(y, m, d, h, min))`). Used to
|
|
1046
|
-
* resolve iCal `TZID` times; DST-correct via a two-pass offset
|
|
1047
|
-
*
|
|
1129
|
+
* resolve iCal `TZID` times; DST-correct via a two-pass offset. A time in the
|
|
1130
|
+
* hour a spring-forward change skips names no instant; it resolves the same
|
|
1131
|
+
* distance after the skipped hour (02:30 becomes 03:30), as a device clock does.
|
|
1048
1132
|
*/
|
|
1049
1133
|
declare function zonedTimeToUtc(wallClock: Date, timeZone: string): Date;
|
|
1050
1134
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1135
|
+
* The inverse of {@link toZonedTime}: the real instant for a date whose
|
|
1136
|
+
* device-local fields hold a wall-clock time in `timeZone`, such as a date a
|
|
1137
|
+
* calendar displaying that zone reports. DST-correct via {@link zonedTimeToUtc}.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function fromZonedTime(date: Date, timeZone: string): Date;
|
|
1140
|
+
/**
|
|
1141
|
+
* Shift every timed event's `start`/`end` through {@link toZonedTime} so the
|
|
1142
|
+
* calendar displays them in `timeZone`. Other fields are preserved. All-day
|
|
1143
|
+
* events (see `isAllDayEvent`) name calendar days, not instants, so they are
|
|
1144
|
+
* returned as they are and stay on their days. Memoize the result (e.g. with
|
|
1145
|
+
* `useMemo`) since it allocates new dates.
|
|
1054
1146
|
*/
|
|
1055
1147
|
declare function eventsInTimeZone<T>(events: CalendarEvent<T>[], timeZone: string): CalendarEvent<T>[];
|
|
1056
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* The event a display copy made by {@link eventsInTimeZone} stands for, with its
|
|
1150
|
+
* real `start` and `end`. Any other event is returned as it is. Use it in the
|
|
1151
|
+
* callbacks of a view that displays zoned events, to get back the event you
|
|
1152
|
+
* passed in.
|
|
1153
|
+
*/
|
|
1154
|
+
declare function zonedEventSource<T>(event: CalendarEvent<T>): CalendarEvent<T>;
|
|
1155
|
+
/** Options for {@link zonedDragBounds}. */
|
|
1156
|
+
interface ZonedDragBoundsOptions {
|
|
1157
|
+
/**
|
|
1158
|
+
* Keep the event's real elapsed duration when the drag moved both edges, as a
|
|
1159
|
+
* time-grid move does: the start is read off the zone's wall clock and the end
|
|
1160
|
+
* follows it, so a move across a DST change in the zone doesn't stretch or
|
|
1161
|
+
* shrink the event. Leave it off for a month-grid drop, which keeps the clock
|
|
1162
|
+
* time of both edges.
|
|
1163
|
+
*/
|
|
1164
|
+
keepDuration?: boolean;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Convert the bounds a view reports for a dragged event back to real instants.
|
|
1168
|
+
* `event` is the displayed event the view passed to `onDragEvent`, and `start`
|
|
1169
|
+
* / `end` the bounds it reported. For a display copy made by
|
|
1170
|
+
* {@link eventsInTimeZone}, each bound is read as a wall-clock time in that
|
|
1171
|
+
* zone, following the zone's own DST changes; an edge the drag left alone keeps
|
|
1172
|
+
* the source event's exact instant. Bounds of any other event (an all-day
|
|
1173
|
+
* event, or one that was never shifted) are returned unchanged.
|
|
1174
|
+
*
|
|
1175
|
+
* Returns `null` when the reported span doesn't survive the conversion: an edge
|
|
1176
|
+
* dropped into the hour a spring-forward change skips moves to after it, which
|
|
1177
|
+
* can leave the event ending at or before its start. Reject such a drop.
|
|
1178
|
+
*/
|
|
1179
|
+
declare function zonedDragBounds<T>(event: CalendarEvent<T>, start: Date, end: Date, { keepDuration }?: ZonedDragBoundsOptions): {
|
|
1180
|
+
start: Date;
|
|
1181
|
+
end: Date;
|
|
1182
|
+
} | null;
|
|
1183
|
+
/**
|
|
1184
|
+
* Convert a wall-clock range a view reports in `timeZone` (a created event, for
|
|
1185
|
+
* example) to real instants. Returns `null` when the span doesn't survive the
|
|
1186
|
+
* conversion: a time in the hour a spring-forward change skips moves to after
|
|
1187
|
+
* it, which can leave the range ending at or before its start.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function fromZonedRange(start: Date, end: Date, timeZone: string): {
|
|
1190
|
+
start: Date;
|
|
1191
|
+
end: Date;
|
|
1192
|
+
} | null;
|
|
1193
|
+
export { EventAccessibilityLabelContext as $, rangeBandKind as $t, monthExtraLaneColumns as A, getIsToday as At, eventDayKeys as B, DateRange as Bt, MonthRowLanes as C, overlapsOtherEvents as Ct, buildMonthGrid as D, snapDeltaMinutes as Dt, WeekdayFormat as E, shiftMinutes as Et, backgroundBandsForDay as F, isWeekend as Ft, wallClockHours as G, isDateSelectable as Gt, isAllDayEvent as H, DaySelectionState as Ht, clockHoursBetween as I, minutesIntoDay as It, loadEventSource as J, nextDateRange as Jt, EventSource as K, isRangeEndpoint as Kt, closedHourBands as L, viewDayCount as Lt, weekdayFormatToken as M, getWeekDays as Mt, withDraftEventDays as N, getYearMonths as Nt, keepMonthDraftVisible as O, buildMonthWeeks as Ot, PositionedEvent as P, isSameCalendarDay as Pt, toICalendar as Q, dayBadgeKind as Qt, compareDayEvents as R, weekDaysCount as Rt, MonthGridWeekday as S, movedClockSpan as St, UseMonthGridOptions as T, resolveDraggedBounds as Tt, isBackgroundEvent as U, UseDateRangeOptions as Ut, groupEventsByDay as V, DateSelectionConstraints as Vt, layoutDayEvents as W, daySelectionState as Wt, ToICalendarOptions as X, RangeBandKind as Xt, ICalEvent as Y, DayBadgeKind as Yt, parseICalendar as Z, bandRounding as Zt, buildMultiWeekGrid as _, cellRangeFromDrag as _t, nowInTimeZone as a, BusinessHoursValue as an, eventChipLayout as at, MonthGridDay as b, monthCreateRange as bt, zonedEventSource as c, CalendarMode as cn, isTimeVisibleAtHeight as ct, expandRecurringEvents as d, ICalendarEvent as dn, titleEllipsizeMode as dt, CalendarColors as en, EventAccessibilityLabeler as et, MultiWeekGrid as f, RecurrenceFrequency as fn, titleNumberOfLines as ft, MultiWeekGridWeek as g, WeekStartsOn as gn, resolveCalendarLabels as gt, MultiWeekGridOptions as h, TimeGridMode as hn, defaultCalendarLabels as ht, fromZonedTime as i, BusinessHoursBand as in, eventAccessibilityLabel as it, monthVisibleBars as j, getViewDays as jt, layoutMonthWeek as k, filterHiddenDays as kt, zonedTimeToUtc as l, CreateGhostArgs as ln, monthEventCapacity as lt, MultiWeekGridInterval as m, ScrollToTimeOptions as mn, dayAccessibilityLabel as mt, eventsInTimeZone as n, lightColors as nn, MIN_BOX_HEIGHT_FOR_TIME as nt, toZonedTime as o, CalendarEvent as on, eventTimeLabel as ot, MultiWeekGridDay as p, RecurrenceRule as pn, CalendarLabels as pt, EventSourceOptions as q, isWithinDateRange as qt, fromZonedRange as r, BusinessHours as rn, MonthEventCapacity as rt, zonedDragBounds as s, CalendarHandle as sn, formatHour as st, ZonedDragBoundsOptions as t, darkColors as tn, EventChipLayout as tt, ExpandRecurringEventsOptions as u, EventKeyExtractor as un, monthVisibleCount as ut, MonthEventSegment as v, clampMoveStartMinutes as vt, MonthWeekEvents as w, pageStepDays as wt, MonthGridWeek as x, monthDropBounds as xt, MonthGrid as y, eventsOverlap as yt, drawnEnd as z, CalendarSelection as zt };
|
package/dist/vanilla.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedTimeToUtc };
|
|
1
|
+
import { $ as EventAccessibilityLabelContext, $t as rangeBandKind, A as monthExtraLaneColumns, At as getIsToday, B as eventDayKeys, Bt as DateRange, C as MonthRowLanes, Ct as overlapsOtherEvents, D as buildMonthGrid, Dt as snapDeltaMinutes, E as WeekdayFormat, Et as shiftMinutes, F as backgroundBandsForDay, Ft as isWeekend, G as wallClockHours, Gt as isDateSelectable, H as isAllDayEvent, Ht as DaySelectionState, I as clockHoursBetween, It as minutesIntoDay, J as loadEventSource, Jt as nextDateRange, K as EventSource, Kt as isRangeEndpoint, L as closedHourBands, Lt as viewDayCount, M as weekdayFormatToken, Mt as getWeekDays, N as withDraftEventDays, Nt as getYearMonths, O as keepMonthDraftVisible, Ot as buildMonthWeeks, P as PositionedEvent, Pt as isSameCalendarDay, Q as toICalendar, Qt as dayBadgeKind, R as compareDayEvents, Rt as weekDaysCount, S as MonthGridWeekday, St as movedClockSpan, T as UseMonthGridOptions, Tt as resolveDraggedBounds, U as isBackgroundEvent, Ut as UseDateRangeOptions, V as groupEventsByDay, Vt as DateSelectionConstraints, W as layoutDayEvents, Wt as daySelectionState, X as ToICalendarOptions, Xt as RangeBandKind, Y as ICalEvent, Yt as DayBadgeKind, Z as parseICalendar, Zt as bandRounding, _ as buildMultiWeekGrid, _t as cellRangeFromDrag, a as nowInTimeZone, an as BusinessHoursValue, at as eventChipLayout, b as MonthGridDay, bt as monthCreateRange, c as zonedEventSource, cn as CalendarMode, ct as isTimeVisibleAtHeight, d as expandRecurringEvents, dn as ICalendarEvent, dt as titleEllipsizeMode, en as CalendarColors, et as EventAccessibilityLabeler, f as MultiWeekGrid, fn as RecurrenceFrequency, ft as titleNumberOfLines, g as MultiWeekGridWeek, gn as WeekStartsOn, gt as resolveCalendarLabels, h as MultiWeekGridOptions, hn as TimeGridMode, ht as defaultCalendarLabels, i as fromZonedTime, in as BusinessHoursBand, it as eventAccessibilityLabel, j as monthVisibleBars, jt as getViewDays, k as layoutMonthWeek, kt as filterHiddenDays, l as zonedTimeToUtc, ln as CreateGhostArgs, lt as monthEventCapacity, m as MultiWeekGridInterval, mn as ScrollToTimeOptions, mt as dayAccessibilityLabel, n as eventsInTimeZone, nn as lightColors, nt as MIN_BOX_HEIGHT_FOR_TIME, o as toZonedTime, on as CalendarEvent, ot as eventTimeLabel, p as MultiWeekGridDay, pn as RecurrenceRule, pt as CalendarLabels, q as EventSourceOptions, qt as isWithinDateRange, r as fromZonedRange, rn as BusinessHours, rt as MonthEventCapacity, s as zonedDragBounds, sn as CalendarHandle, st as formatHour, t as ZonedDragBoundsOptions, tn as darkColors, tt as EventChipLayout, u as ExpandRecurringEventsOptions, un as EventKeyExtractor, ut as monthVisibleCount, v as MonthEventSegment, vt as clampMoveStartMinutes, w as MonthWeekEvents, wt as pageStepDays, x as MonthGridWeek, xt as monthDropBounds, y as MonthGrid, yt as eventsOverlap, z as drawnEnd, zt as CalendarSelection } from "./timezone-DhGhYIeB.mjs";
|
|
2
|
+
export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ExpandRecurringEventsOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthRowLanes, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, ZonedDragBoundsOptions, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, keepMonthDraftVisible, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthExtraLaneColumns, monthVisibleBars, monthVisibleCount, movedClockSpan, nextDateRange, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, withDraftEventDays, zonedDragBounds, zonedEventSource, zonedTimeToUtc };
|
package/dist/vanilla.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthVisibleCount, movedClockSpan, nextDateRange, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, zonedTimeToUtc };
|
|
1
|
+
import { $ as EventAccessibilityLabelContext, $t as rangeBandKind, A as monthExtraLaneColumns, At as getIsToday, B as eventDayKeys, Bt as DateRange, C as MonthRowLanes, Ct as overlapsOtherEvents, D as buildMonthGrid, Dt as snapDeltaMinutes, E as WeekdayFormat, Et as shiftMinutes, F as backgroundBandsForDay, Ft as isWeekend, G as wallClockHours, Gt as isDateSelectable, H as isAllDayEvent, Ht as DaySelectionState, I as clockHoursBetween, It as minutesIntoDay, J as loadEventSource, Jt as nextDateRange, K as EventSource, Kt as isRangeEndpoint, L as closedHourBands, Lt as viewDayCount, M as weekdayFormatToken, Mt as getWeekDays, N as withDraftEventDays, Nt as getYearMonths, O as keepMonthDraftVisible, Ot as buildMonthWeeks, P as PositionedEvent, Pt as isSameCalendarDay, Q as toICalendar, Qt as dayBadgeKind, R as compareDayEvents, Rt as weekDaysCount, S as MonthGridWeekday, St as movedClockSpan, T as UseMonthGridOptions, Tt as resolveDraggedBounds, U as isBackgroundEvent, Ut as UseDateRangeOptions, V as groupEventsByDay, Vt as DateSelectionConstraints, W as layoutDayEvents, Wt as daySelectionState, X as ToICalendarOptions, Xt as RangeBandKind, Y as ICalEvent, Yt as DayBadgeKind, Z as parseICalendar, Zt as bandRounding, _ as buildMultiWeekGrid, _t as cellRangeFromDrag, a as nowInTimeZone, an as BusinessHoursValue, at as eventChipLayout, b as MonthGridDay, bt as monthCreateRange, c as zonedEventSource, cn as CalendarMode, ct as isTimeVisibleAtHeight, d as expandRecurringEvents, dn as ICalendarEvent, dt as titleEllipsizeMode, en as CalendarColors, et as EventAccessibilityLabeler, f as MultiWeekGrid, fn as RecurrenceFrequency, ft as titleNumberOfLines, g as MultiWeekGridWeek, gn as WeekStartsOn, gt as resolveCalendarLabels, h as MultiWeekGridOptions, hn as TimeGridMode, ht as defaultCalendarLabels, i as fromZonedTime, in as BusinessHoursBand, it as eventAccessibilityLabel, j as monthVisibleBars, jt as getViewDays, k as layoutMonthWeek, kt as filterHiddenDays, l as zonedTimeToUtc, ln as CreateGhostArgs, lt as monthEventCapacity, m as MultiWeekGridInterval, mn as ScrollToTimeOptions, mt as dayAccessibilityLabel, n as eventsInTimeZone, nn as lightColors, nt as MIN_BOX_HEIGHT_FOR_TIME, o as toZonedTime, on as CalendarEvent, ot as eventTimeLabel, p as MultiWeekGridDay, pn as RecurrenceRule, pt as CalendarLabels, q as EventSourceOptions, qt as isWithinDateRange, r as fromZonedRange, rn as BusinessHours, rt as MonthEventCapacity, s as zonedDragBounds, sn as CalendarHandle, st as formatHour, t as ZonedDragBoundsOptions, tn as darkColors, tt as EventChipLayout, u as ExpandRecurringEventsOptions, un as EventKeyExtractor, ut as monthVisibleCount, v as MonthEventSegment, vt as clampMoveStartMinutes, w as MonthWeekEvents, wt as pageStepDays, x as MonthGridWeek, xt as monthDropBounds, y as MonthGrid, yt as eventsOverlap, z as drawnEnd, zt as CalendarSelection } from "./timezone-DhGhYIeB.js";
|
|
2
|
+
export { BusinessHours, BusinessHoursBand, BusinessHoursValue, CalendarColors, CalendarEvent, CalendarHandle, CalendarLabels, CalendarMode, CalendarSelection, CreateGhostArgs, DateRange, DateSelectionConstraints, DayBadgeKind, DaySelectionState, EventAccessibilityLabelContext, EventAccessibilityLabeler, EventChipLayout, EventKeyExtractor, EventSource, EventSourceOptions, ExpandRecurringEventsOptions, ICalEvent, ICalendarEvent, MIN_BOX_HEIGHT_FOR_TIME, MonthEventCapacity, MonthEventSegment, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, MonthRowLanes, MonthWeekEvents, MultiWeekGrid, MultiWeekGridDay, MultiWeekGridInterval, MultiWeekGridOptions, MultiWeekGridWeek, PositionedEvent, RangeBandKind, RecurrenceFrequency, RecurrenceRule, ScrollToTimeOptions, TimeGridMode, ToICalendarOptions, UseDateRangeOptions, UseMonthGridOptions, WeekStartsOn, WeekdayFormat, ZonedDragBoundsOptions, backgroundBandsForDay, bandRounding, buildMonthGrid, buildMonthWeeks, buildMultiWeekGrid, cellRangeFromDrag, clampMoveStartMinutes, clockHoursBetween, closedHourBands, compareDayEvents, darkColors, dayAccessibilityLabel, dayBadgeKind, daySelectionState, defaultCalendarLabels, drawnEnd, eventAccessibilityLabel, eventChipLayout, eventDayKeys, eventTimeLabel, eventsInTimeZone, eventsOverlap, expandRecurringEvents, filterHiddenDays, formatHour, fromZonedRange, fromZonedTime, getIsToday, getViewDays, getWeekDays, getYearMonths, groupEventsByDay, isAllDayEvent, isBackgroundEvent, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isTimeVisibleAtHeight, isWeekend, isWithinDateRange, keepMonthDraftVisible, layoutDayEvents, layoutMonthWeek, lightColors, loadEventSource, minutesIntoDay, monthCreateRange, monthDropBounds, monthEventCapacity, monthExtraLaneColumns, monthVisibleBars, monthVisibleCount, movedClockSpan, nextDateRange, nowInTimeZone, overlapsOtherEvents, pageStepDays, parseICalendar, rangeBandKind, resolveCalendarLabels, resolveDraggedBounds, shiftMinutes, snapDeltaMinutes, titleEllipsizeMode, titleNumberOfLines, toICalendar, toZonedTime, viewDayCount, wallClockHours, weekDaysCount, weekdayFormatToken, withDraftEventDays, zonedDragBounds, zonedEventSource, zonedTimeToUtc };
|
package/dist/vanilla.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_recurrence = require("./recurrence-
|
|
2
|
+
const require_recurrence = require("./recurrence-CTjr6nxJ.js");
|
|
3
3
|
exports.MIN_BOX_HEIGHT_FOR_TIME = require_recurrence.MIN_BOX_HEIGHT_FOR_TIME;
|
|
4
4
|
exports.backgroundBandsForDay = require_recurrence.backgroundBandsForDay;
|
|
5
5
|
exports.bandRounding = require_recurrence.bandRounding;
|
|
@@ -26,6 +26,8 @@ exports.eventsOverlap = require_recurrence.eventsOverlap;
|
|
|
26
26
|
exports.expandRecurringEvents = require_recurrence.expandRecurringEvents;
|
|
27
27
|
exports.filterHiddenDays = require_recurrence.filterHiddenDays;
|
|
28
28
|
exports.formatHour = require_recurrence.formatHour;
|
|
29
|
+
exports.fromZonedRange = require_recurrence.fromZonedRange;
|
|
30
|
+
exports.fromZonedTime = require_recurrence.fromZonedTime;
|
|
29
31
|
exports.getIsToday = require_recurrence.getIsToday;
|
|
30
32
|
exports.getViewDays = require_recurrence.getViewDays;
|
|
31
33
|
exports.getWeekDays = require_recurrence.getWeekDays;
|
|
@@ -39,6 +41,7 @@ exports.isSameCalendarDay = require_recurrence.isSameCalendarDay;
|
|
|
39
41
|
exports.isTimeVisibleAtHeight = require_recurrence.isTimeVisibleAtHeight;
|
|
40
42
|
exports.isWeekend = require_recurrence.isWeekend;
|
|
41
43
|
exports.isWithinDateRange = require_recurrence.isWithinDateRange;
|
|
44
|
+
exports.keepMonthDraftVisible = require_recurrence.keepMonthDraftVisible;
|
|
42
45
|
exports.layoutDayEvents = require_recurrence.layoutDayEvents;
|
|
43
46
|
exports.layoutMonthWeek = require_recurrence.layoutMonthWeek;
|
|
44
47
|
exports.lightColors = require_recurrence.lightColors;
|
|
@@ -47,9 +50,12 @@ exports.minutesIntoDay = require_recurrence.minutesIntoDay;
|
|
|
47
50
|
exports.monthCreateRange = require_recurrence.monthCreateRange;
|
|
48
51
|
exports.monthDropBounds = require_recurrence.monthDropBounds;
|
|
49
52
|
exports.monthEventCapacity = require_recurrence.monthEventCapacity;
|
|
53
|
+
exports.monthExtraLaneColumns = require_recurrence.monthExtraLaneColumns;
|
|
54
|
+
exports.monthVisibleBars = require_recurrence.monthVisibleBars;
|
|
50
55
|
exports.monthVisibleCount = require_recurrence.monthVisibleCount;
|
|
51
56
|
exports.movedClockSpan = require_recurrence.movedClockSpan;
|
|
52
57
|
exports.nextDateRange = require_recurrence.nextDateRange;
|
|
58
|
+
exports.nowInTimeZone = require_recurrence.nowInTimeZone;
|
|
53
59
|
exports.overlapsOtherEvents = require_recurrence.overlapsOtherEvents;
|
|
54
60
|
exports.pageStepDays = require_recurrence.pageStepDays;
|
|
55
61
|
exports.parseICalendar = require_recurrence.parseICalendar;
|
|
@@ -66,4 +72,7 @@ exports.viewDayCount = require_recurrence.viewDayCount;
|
|
|
66
72
|
exports.wallClockHours = require_recurrence.wallClockHours;
|
|
67
73
|
exports.weekDaysCount = require_recurrence.weekDaysCount;
|
|
68
74
|
exports.weekdayFormatToken = require_recurrence.weekdayFormatToken;
|
|
75
|
+
exports.withDraftEventDays = require_recurrence.withDraftEventDays;
|
|
76
|
+
exports.zonedDragBounds = require_recurrence.zonedDragBounds;
|
|
77
|
+
exports.zonedEventSource = require_recurrence.zonedEventSource;
|
|
69
78
|
exports.zonedTimeToUtc = require_recurrence.zonedTimeToUtc;
|
package/dist/vanilla.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { x as MIN_BOX_HEIGHT_FOR_TIME, G as backgroundBandsForDay, vt as bandRounding, r as buildMonthGrid, st as buildMonthWeeks, n as buildMultiWeekGrid, P as cellRangeFromDrag, F as clampMoveStartMinutes, K as clockHoursBetween, q as closedHourBands, J as compareDayEvents, xt as darkColors, j as dayAccessibilityLabel, yt as dayBadgeKind, nt as daySelectionState, M as defaultCalendarLabels, Y as drawnEnd, S as eventAccessibilityLabel, C as eventChipLayout, X as eventDayKeys, w as eventTimeLabel, p as eventsInTimeZone, I as eventsOverlap, t as expandRecurringEvents, ct as filterHiddenDays, T as formatHour, m as fromZonedRange, h as fromZonedTime, lt as getIsToday, ut as getViewDays, dt as getWeekDays, ft as getYearMonths, Z as groupEventsByDay, Q as isAllDayEvent, $ as isBackgroundEvent, rt as isDateSelectable, it as isRangeEndpoint, pt as isSameCalendarDay, E as isTimeVisibleAtHeight, mt as isWeekend, at as isWithinDateRange, i as keepMonthDraftVisible, et as layoutDayEvents, a as layoutMonthWeek, St as lightColors, u as loadEventSource, ht as minutesIntoDay, L as monthCreateRange, R as monthDropBounds, D as monthEventCapacity, o as monthExtraLaneColumns, s as monthVisibleBars, O as monthVisibleCount, z as movedClockSpan, ot as nextDateRange, g as nowInTimeZone, B as overlapsOtherEvents, V as pageStepDays, d as parseICalendar, bt as rangeBandKind, N as resolveCalendarLabels, H as resolveDraggedBounds, U as shiftMinutes, W as snapDeltaMinutes, k as titleEllipsizeMode, A as titleNumberOfLines, f as toICalendar, _ as toZonedTime, gt as viewDayCount, tt as wallClockHours, _t as weekDaysCount, c as weekdayFormatToken, l as withDraftEventDays, v as zonedDragBounds, y as zonedEventSource, b as zonedTimeToUtc } from "./recurrence-BqpCShcV.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "Render-agnostic core for super-calendar: date math, selection model, event layout, the month-grid builder, headless hooks, and neutral theme tokens. No renderer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calendar",
|
package/src/types.ts
CHANGED
|
@@ -94,6 +94,13 @@ export interface RecurrenceRule {
|
|
|
94
94
|
* the event's time of day. Omit to repeat on the start date's own weekday.
|
|
95
95
|
*/
|
|
96
96
|
weekdays?: WeekStartsOn[];
|
|
97
|
+
/**
|
|
98
|
+
* For `weekly` rules with `weekdays`: the day a week starts on (0 = Sunday …
|
|
99
|
+
* 6 = Saturday). It decides which of the `weekdays` share a week, so it only
|
|
100
|
+
* changes the result when `interval` is greater than 1. Default 1 (Monday),
|
|
101
|
+
* as in RFC 5545. Maps to iCal `WKST`.
|
|
102
|
+
*/
|
|
103
|
+
weekStartsOn?: WeekStartsOn;
|
|
97
104
|
/**
|
|
98
105
|
* For `monthly`/`yearly`: repeat on the Nth weekday of the period instead of the
|
|
99
106
|
* start date's day-of-month — e.g. `{ week: 3, weekday: 1 }` is the 3rd Monday.
|