Package-level declarations

Types

Link copied to clipboard

Policy for which day gets selected when auto-advance paging changes month.

Link copied to clipboard
data class CalendarDay(val date: LocalDate, val position: DayPosition)
Link copied to clipboard
data class CalendarEvent<out T>(val id: String, val title: String, val span: EventSpan, val subtitle: String? = null, val colorArgb: Long? = null, val payload: T? = null)

Minimal, optional calendar event model shared across DayDecorators, Agenda, and the time-grid schedule views (#21).

Link copied to clipboard
data class CalendarMonth(val yearMonth: YearMonth, val weeks: List<CalendarWeek>)
Link copied to clipboard

Maps pager indices to months/weeks within a calendar range.

Link copied to clipboard
data class CalendarWeek(val days: List<CalendarDay>)
Link copied to clipboard
data class DayInfo(val label: String?, val isHoliday: Boolean = false, val tags: List<String> = emptyList(), val priority: Int = DayInfoPriority.DEFAULT, val colorArgb: Long? = null, val payload: Any? = null)

Secondary information for one day, returned by DayInfoProvider.info.

Link copied to clipboard

Standard priority tiers for DayInfo.priority when composing providers.

Link copied to clipboard
interface DayInfoProvider

Secondary per-day information (lunar date, festival, holiday flag…). calendar-lunar ships an implementation; consumers can provide their own.

Link copied to clipboard

Where a day cell falls relative to the month being rendered.

Link copied to clipboard
data class DayScheduleLayout<out T>(val date: LocalDate, val allDayEvents: List<CalendarEvent<T>>, val timedEvents: List<PositionedEvent<T>>)

Partitioned events for a single date column: all-day banner items plus non-overlapping 2D-packed timed placements.

Link copied to clipboard

Immutable set of unavailable dates: explicit dates, inclusive ranges, days of week, exclusive before/after bounds, and predicate escape hatches for dynamic availability. Entries combine as a union. Build with the DisabledDates factory function.

Link copied to clipboard
Link copied to clipboard
sealed interface EventSpan

Temporal extent of a CalendarEvent.

Link copied to clipboard
data class HeatmapSummary(val activeDays: Int, val currentStreak: Int, val longestStreak: Int)

Aggregates for a heatmap range: how many days were active, the streak ending at the range end, and the longest streak anywhere in the range.

Link copied to clipboard

Replaces the original library's month_view_show_mode. EndOfRow = mode_all, None = mode_only_current (grid identical to EndOfRow; renderers leave in/out cells empty), EndOfGrid = mode_fix (6 rows).

Link copied to clipboard
data class PositionedEvent<out T>(val event: CalendarEvent<T>, val date: LocalDate, val startMinute: Int, val endMinute: Int, val displayEndMinute: Int, val columnIndex: Int, val columnCount: Int, val leftFraction: Float, val widthFraction: Float)

Computed 2D layout box for a single CalendarEvent on a specific date's 24-hour timeline (0..1440 minutes from midnight).

Link copied to clipboard
data class Selection(val single: LocalDate? = null, val rangeStart: LocalDate? = null, val rangeEnd: LocalDate? = null, val multi: Set<LocalDate> = emptySet())
Link copied to clipboard
class SelectionEngine(mode: SelectionMode, bounds: ClosedRange<LocalDate>? = null, disabled: DisabledDates = DisabledDates.None)

Pure selection state machine. click never mutates; it returns the new Selection plus any violation events. Bounds and disabled dates are checked before mode-specific handling, matching the original library's out-of-range and OnCalendarInterceptListener behavior.

Link copied to clipboard
sealed interface SelectionEvent
Link copied to clipboard
sealed interface SelectionMode
Link copied to clipboard

Pure factories for common range selections. Apply via CalendarSelectionState.set.

Link copied to clipboard
data class SelectionResult(val selection: Selection, val events: List<SelectionEvent>)

Functions

Link copied to clipboard
fun autoSelectDate(month: YearMonth, previous: LocalDate?, policy: AutoSelectDay, today: LocalDate): LocalDate

Picks the day to auto-select when auto-advance paging lands on month (parity with the original month_view_auto_select_day).

Link copied to clipboard
fun daysOfWeek(firstDayOfWeek: DayOfWeek = DayOfWeek.MONDAY): List<DayOfWeek>

The 7 days of the week starting at firstDayOfWeek.

Link copied to clipboard
Link copied to clipboard
fun <T> Iterable<CalendarEvent<T>>.eventsByDate(range: ClosedRange<LocalDate>): Map<LocalDate, List<CalendarEvent<T>>>

Groups events by each LocalDate they cover within range, sorted in canonical display order per day:

Link copied to clipboard
fun heatmapSummary(range: ClosedRange<LocalDate>, isActive: (LocalDate) -> Boolean): HeatmapSummary

Single-pass scan of range. HeatmapSummary.currentStreak counts consecutive active days ending exactly at range.endInclusive (zero when that day is inactive). An empty range (start after end) yields all zeros.

Link copied to clipboard
fun LocalDate.isoWeekNumber(): Int

ISO-8601 week of year: weeks start Monday, week 1 contains January 4th.

Link copied to clipboard
fun <T> layoutDaySchedule(date: LocalDate, events: Iterable<CalendarEvent<T>>, minDurationMinutes: Int = 15): DayScheduleLayout<T>

Computes DayScheduleLayout for events occurring on date.

Link copied to clipboard
fun monthGrid(yearMonth: YearMonth, firstDayOfWeek: DayOfWeek = DayOfWeek.MONDAY, outDateStyle: OutDateStyle = OutDateStyle.EndOfRow): CalendarMonth

Builds the day grid for yearMonth. Leading cells are previous-month DayPosition.InDates, trailing cells next-month DayPosition.OutDates. Row count follows the original CalendarView line-count semantics.

Link copied to clipboard
inline fun <T> DayInfo.payloadAs(): T?

Type-safe extraction of DayInfo.payload, returning null if absent or of a different type.

Link copied to clipboard
fun weekGrid(anchor: LocalDate, firstDayOfWeek: DayOfWeek = DayOfWeek.MONDAY): CalendarWeek

The week containing anchor; days are always DayPosition.MonthDate.