calendar-tsx

Instance and API

What createCalendar returns.

createCalendar(options) returns the instance. Call ~mount and ~update from your code or adapter; see writing an adapter.

MemberDescription
storeRead-only TanStack Store of the state.
apiNavigation actions, plus actions from registered features.
optionsThe options most recently passed in.
~mountStarts the clock and returns its cleanup.
~updateReplaces the options; re-derives only when a tracked option changed.

api

ActionEffect
next(), prev()Calls onNavigate with the next or previous period.
today()Calls onNavigate with today in timeZone.
goTo(date)Calls onNavigate with the same view on date.
setView(view, date?)Calls onNavigate with view, keeping the date unless one is given.
navigate({ view, date })Calls onNavigate with either or both.

Navigation actions emit a request for the owner to apply. See navigation.

Interaction APIs

Each operation feature installs its API when registered; calendars without it have no such methods in their types.

APIMethods
selectionbegin(anchor), evaluate(anchor, target)
movebegin(eventId, sourceResourceId?), evaluate(eventId, target, sourceResourceId?)
resizebegin(eventId, edge), evaluate(eventId, edge, target)
externalDropbegin(event, metadata?), evaluate(event, target, metadata?)
transferprepare(eventId, sourceResourceId?), begin(preparedSource), evaluate(preparedSource, target)
interactionsrefresh(), locate(point), project(proposal)
pointersettings() returns the resolved pointer, touch and scroll configuration.

interactions.store exposes the readonly session, candidate, outcome and derived preview. Sessions start only through an operation API; the shared controls have no generic begin. evaluate returns a proposal or a reason without opening a session. An active begin returns a typed session with update(target), commit(), cancel(reason?), unavailable(reason) and isActive(). Commands return an object with status, and a committed result includes its typed proposal. Tokens appear only in ownership snapshots. A valid commit calls the operation's callback and, for selection, updates its state slice. See selection and editing.

Types

To annotate api explicitly, use Calendar_Api<TViews, TFeatures, TData, TResourceData>. TFeatures defaults to Calendar_Features, and the payload parameters default to unknown.