@moltenship/calendar-react 1.0.0-rc.2 → 2.0.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 CHANGED
@@ -1,7 +1,11 @@
1
1
  # @moltenship/calendar-react
2
2
 
3
3
  The headless React layer of Moltenship Time: `createCalendar` and its `Root` and components, the
4
- state store, the hooks, and the contract for custom views. It renders plain, unstyled elements.
4
+ hooks, and the contract for custom views. It renders plain, unstyled elements.
5
+
6
+ Since 2.0 it renders the calendar's ui-sdk primitive from `@moltenship/calendar-primitives`
7
+ through [`@ui-sdk/react`](https://ui-sdk.dev), which is how an AI agent reaches a calendar. The
8
+ state store lives in the primitives now, and this package still exports it.
5
9
 
6
10
  It's a layer of `@moltenship/calendar`, which re-exports everything in it. Install
7
11
  `@moltenship/calendar` instead: you rarely need this package on its own.
@@ -9,10 +13,12 @@ It's a layer of `@moltenship/calendar`, which re-exports everything in it. Insta
9
13
  ## Install
10
14
 
11
15
  ```bash
12
- pnpm add @moltenship/calendar-react react
16
+ pnpm add @moltenship/calendar-react @ui-sdk/core @ui-sdk/react react react-dom
13
17
  ```
14
18
 
15
19
  - React 19. React is a peer dependency.
20
+ - `@ui-sdk/core` and `@ui-sdk/react` 0.1 beta, peer dependencies since 2.0. `@ui-sdk/react` needs
21
+ React DOM.
16
22
  - A runtime with `Temporal` (Node.js 26 and later include it), or a polyfill that defines
17
23
  `globalThis.Temporal`, loaded first.
18
24
  - TypeScript 6 or later with `"lib": ["DOM", "DOM.Iterable", "ESNext"]`. `ESNext` has the
@@ -20,7 +26,8 @@ pnpm add @moltenship/calendar-react react
20
26
 
21
27
  ## Documentation
22
28
 
23
- - [React components and hooks](https://time.molten.sh/docs/api/react)
29
+ - [React components and hooks](https://time.molten.sh/docs/react/api/components)
30
+ - [Agents](https://time.molten.sh/docs/react/agents)
24
31
  - [Repository](https://github.com/Moltenship/time)
25
32
 
26
33
  ## License
package/dist/index.d.mts CHANGED
@@ -1,85 +1,15 @@
1
- import { AnnotationSnapshot, AnnotationSnapshotIssue, AvailabilityBand, AvailabilityExtent, AvailabilityIssue, AvailabilitySnapshot, CalendarAnnotation, CalendarAnnotationSource, CalendarAnnouncementContext, CalendarAnnouncementMessages, CalendarAnnouncer, CalendarAvailability, CalendarDraft, CalendarEnvironment, CalendarEnvironmentBase, CalendarEventChangeHandler, CalendarEventInput, CalendarEventInterval, CalendarEventProposal, CalendarFocus, CalendarInputMethod, CalendarInteractionCheck, CalendarKeyboardSession, CalendarNowSource, CalendarPendingChanges, CalendarPolicy, CalendarPolicyResult, CalendarProposalDetail, CalendarSecondaryTimeZone, CalendarSelection, CalendarTransactionResult, CalendarViewStrategy, CalendarWeekRules, ClosedDate, EventAdapter, EventHistory, EventHistoryOutcome, EventHistorySnapshot, EventId, EventSnapshot, EventSnapshotIssue, InvalidCalendarEventPolicy, NormalizedCalendarEvent, ResourceId, ResourceStatus, ResourceVisibilityOptions, SecondaryTimeZoneIssue, TimeGridAnnotationGeometry, TimeGridAnnotationMark, TimeGridColumn, VisibleResource } from "@moltenship/calendar-core";
2
- import { ComponentPropsWithRef, ComponentType, FocusEvent, KeyboardEvent, ReactNode, RefCallback, RefObject } from "react";
3
- import { InstantInterval, PlainDateInterval, WallTimeSnapOptions } from "@moltenship/calendar-temporal";
4
- //#region src/annotations.d.ts
5
- /** The root's annotations and the sources it shows. */
6
- interface CalendarAnnotations {
7
- readonly snapshot: AnnotationSnapshot;
8
- readonly sources: readonly CalendarAnnotationSource[];
9
- }
1
+ import { AvailabilityBand, AvailabilityExtent, AvailabilitySnapshot, CalendarAnnotation, CalendarAnnotationSource, CalendarAnnouncementMessages, CalendarAnnouncer, CalendarAvailability, CalendarDraft, CalendarEnvironment, CalendarEnvironmentBase, CalendarEventChangeHandler, CalendarEventInput, CalendarEventInterval, CalendarFocus, CalendarInteractionCheck, CalendarKeyboardSession, CalendarNowSource, CalendarPendingChanges, CalendarPolicy, CalendarProposalDetail, CalendarSecondaryTimeZone, CalendarSelection, CalendarTransactionResult, CalendarViewStrategy, CalendarWeekRules, ClosedDate, EventAdapter, EventHistory, EventId, EventSnapshot, InvalidCalendarEventPolicy, NormalizedCalendarEvent, ResourceId, ResourceVisibilityOptions, TimeGridAnnotationGeometry, TimeGridAnnotationMark, TimeGridColumn, VisibleResource } from "@moltenship/calendar-core";
2
+ import { ComponentPropsWithRef, ComponentType, FocusEvent, KeyboardEvent, ReactNode, RefCallback, RefObject, SyntheticEvent } from "react";
3
+ import { CalendarActions, CalendarActiveView as CalendarActiveView$1, CalendarAgentEvent, CalendarAnnotations, CalendarBusyResources, CalendarChangeReason, CalendarChangeSource, CalendarCommandOptions, CalendarControlledState, CalendarDiagnostic, CalendarDraftBusy, CalendarHistory, CalendarHistoryAnnouncementBuilder, CalendarHistoryAnnouncementContext, CalendarHistoryCommandOptions, CalendarHistoryMessages, CalendarHistoryOptions, CalendarHistoryShortcutsTarget, CalendarKeyboardOptions, CalendarPartIds, CalendarPublicState, CalendarResourceStatus, CalendarRootStore, CalendarSemanticActions, CalendarStateChangeDetail, CalendarStateChangeHandler, CalendarStateChangeHandlers, CalendarStateSelector, CalendarStateSelectorOptions, CalendarStateSlice, CalendarStore, CalendarStoreOptions, CalendarViewActions, CalendarViewDefinition, CalendarViewOptionsMap as CalendarViewOptionsMap$1, CalendarVisibleRange, createCalendarStore } from "@moltenship/calendar-primitives";
4
+ import "@ui-sdk/react/primitive";
5
+ import { CalendarPointerOptions } from "@moltenship/calendar-dnd";
6
+ import { InstantInterval, PlainDateInterval } from "@moltenship/calendar-temporal";
10
7
  export declare function useCalendarAnnotations(): CalendarAnnotations;
11
8
  /**
12
9
  * The root's annotations laid out beside a time grid's columns, one list of marks per column; see
13
10
  * `projectTimeGridAnnotations`. Marks carry the root's source objects unchanged.
14
11
  */
15
12
  export declare function useTimeGridAnnotations(columns: readonly TimeGridColumn[], { layout, maxLanes, minGap, minHeight }?: TimeGridAnnotationGeometry): readonly (readonly TimeGridAnnotationMark[])[];
16
- //#endregion
17
- //#region src/types.d.ts
18
- interface CalendarPublicState<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> {
19
- readonly anchorDate: Temporal.PlainDate;
20
- readonly expandedResourceIds: readonly TResourceId[];
21
- readonly focus: TFocus | null;
22
- readonly selection: TSelection | null;
23
- readonly timeZone: string;
24
- readonly view: TView;
25
- }
26
- type CalendarStateSlice = keyof CalendarPublicState;
27
- interface CalendarStoreOptions<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> {
28
- readonly defaultAnchorDate: Temporal.PlainDate;
29
- readonly defaultExpandedResourceIds?: readonly TResourceId[];
30
- readonly defaultFocus?: TFocus | null;
31
- readonly defaultSelection?: TSelection | null;
32
- readonly defaultTimeZone: string;
33
- readonly defaultView: TView;
34
- }
35
- /** Slices whose value is owned by props. `undefined` leaves a slice uncontrolled. */
36
- type CalendarControlledState<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> = Partial<CalendarPublicState<TView, TSelection, TFocus, TResourceId>>;
37
- interface CalendarStateChangeDetail<TValue, TSlice extends CalendarStateSlice = CalendarStateSlice> {
38
- readonly controlled: boolean;
39
- readonly previous: TValue;
40
- readonly slice: TSlice;
41
- }
42
- type CalendarStateChangeHandler<TValue, TSlice extends CalendarStateSlice> = (next: TValue, detail: CalendarStateChangeDetail<TValue, TSlice>) => void;
43
- type CalendarStateChangeHandlers<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> = { readonly [TSlice in CalendarStateSlice as `on${Capitalize<TSlice>}Change`]?: CalendarStateChangeHandler<CalendarPublicState<TView, TSelection, TFocus, TResourceId>[TSlice], TSlice>; };
44
- type CalendarActions<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> = { readonly [TSlice in CalendarStateSlice as `set${Capitalize<TSlice>}`]: (next: CalendarPublicState<TView, TSelection, TFocus, TResourceId>[TSlice]) => void; };
45
- /**
46
- * Uncontrolled calendar state. While a `Root` is mounted with this store, `actions` honor that
47
- * root's controlled slices and change handlers.
48
- */
49
- interface CalendarStore<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId> {
50
- readonly actions: CalendarActions<TView, TSelection, TFocus, TResourceId>;
51
- readonly getSnapshot: () => CalendarPublicState<TView, TSelection, TFocus, TResourceId>;
52
- readonly subscribe: (listener: () => void) => () => void;
53
- }
54
- type CalendarStateSelector<TState, TSelected> = (state: TState) => TSelected;
55
- interface CalendarStateSelectorOptions<TSelected> {
56
- readonly isEqual?: (previous: TSelected, next: TSelected) => boolean;
57
- }
58
- //#endregion
59
- //#region src/views.d.ts
60
- /** The semantic commands a view renderer may issue without knowing its calendar's types. */
61
- interface CalendarViewActions {
62
- /**
63
- * Asks the policies about a proposal without saving it, as a gesture's preview does; pass it to
64
- * the pointer layer's `check`. A plain function, so it can be passed on as a callback.
65
- */
66
- readonly checkEventChange: (proposal: CalendarEventProposal<EventId, ResourceId, unknown>) => CalendarPolicyResult<unknown, EventId, ResourceId> | null;
67
- navigateNext(): void;
68
- navigatePrevious(): void;
69
- navigateToday(): void;
70
- /**
71
- * Proposes a move, resize, create, or delete, such as the result of a pointer drag; the pointer
72
- * layer passes `{ input: "pointer" }` as `detail`. A create may carry the application's record
73
- * as `event`, as an item dropped in from outside the calendar does. A plain function, so it can
74
- * be passed on as a callback.
75
- */
76
- readonly proposeEventChange: (proposal: CalendarEventProposal<EventId, ResourceId, unknown>, detail?: CalendarProposalDetail) => Promise<CalendarTransactionResult<unknown, EventId, ResourceId>>;
77
- setAnchorDate(anchorDate: Temporal.PlainDate): void;
78
- /** Moves the calendar's focus; `useRovingFocus` and `useCalendarKeyboard` call it for you. */
79
- setFocus(focus: CalendarFocus | null): void;
80
- setSelection(selection: CalendarSelection | null): void;
81
- setView(view: string): void;
82
- }
83
13
  interface CalendarViewRendererProps<TProjection, TOptions> {
84
14
  /** Stable for the lifetime of the calendar root. */
85
15
  readonly actions: CalendarViewActions;
@@ -103,11 +33,9 @@ interface CalendarViewRendererProps<TProjection, TOptions> {
103
33
  /** The visible dates. */
104
34
  readonly range: PlainDateInterval;
105
35
  }
106
- interface CalendarView<TName extends string = string, TProjection = unknown, TOptions = unknown, TEvent = unknown> {
107
- readonly defaultOptions: TOptions;
108
- readonly name: TName;
36
+ /** A kernel view definition with the React component that renders its projection. */
37
+ interface CalendarView<TName extends string = string, TProjection = unknown, TOptions = unknown, TEvent = unknown> extends CalendarViewDefinition<TName, TProjection, TOptions, TEvent> {
109
38
  readonly Renderer: ComponentType<CalendarViewRendererProps<TProjection, TOptions>>;
110
- readonly strategy: CalendarViewStrategy<TProjection, TOptions, TEvent>;
111
39
  }
112
40
  type AnyCalendarView<TEvent = any> = CalendarView<string, any, any, TEvent>;
113
41
  interface CalendarViewInputBase<TName extends string, TProjection, TOptions, TEvent> {
@@ -121,73 +49,10 @@ type CalendarViewInput<TName extends string, TProjection, TOptions, TEvent> = Ca
121
49
  readonly defaultOptions: TOptions;
122
50
  });
123
51
  /** Options a root passes to its registered views, keyed by view name. */
124
- type CalendarViewOptionsMap<TViewDef extends AnyCalendarView> = { readonly [TName in TViewDef["name"]]?: Partial<Extract<TViewDef, {
125
- readonly name: TName;
126
- }>["defaultOptions"]>; };
52
+ type CalendarViewOptionsMap<TViewDef extends AnyCalendarView> = CalendarViewOptionsMap$1<TViewDef>;
127
53
  /** The active view of a calendar with its visible range and memoized projection. */
128
- type CalendarActiveView<TViewDef extends AnyCalendarView> = TViewDef extends unknown ? {
129
- readonly definition: TViewDef;
130
- readonly environment: CalendarEnvironmentBase;
131
- /** The events the projection was built from, pending changes included. */
132
- readonly events: EventSnapshot<unknown, EventId, ResourceId>;
133
- readonly instantRange: InstantInterval;
134
- /** `loadRange` resolved to instants in the display time zone. */
135
- readonly loadInstantRange: InstantInterval;
136
- /** The dates the projection covers: `range`, or more for a scrolling view. */
137
- readonly loadRange: PlainDateInterval;
138
- readonly options: TViewDef["defaultOptions"];
139
- readonly projection: ReturnType<TViewDef["strategy"]["project"]>;
140
- readonly range: PlainDateInterval;
141
- readonly view: TViewDef["name"];
142
- } : never;
54
+ type CalendarActiveView<TViewDef extends AnyCalendarView> = CalendarActiveView$1<TViewDef>;
143
55
  export declare function defineCalendarView<const TName extends string, TProjection, TOptions = undefined, TEvent = unknown>(view: CalendarViewInput<TName, TProjection, TOptions, TEvent>): CalendarView<TName, TProjection, TOptions, TEvent>;
144
- //#endregion
145
- //#region src/calendar-types.d.ts
146
- type CalendarSemanticActions<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId, TEvent = unknown, TEventId extends EventId = EventId> = CalendarActions<TView, TSelection, TFocus, TResourceId> & {
147
- navigateNext(): void;
148
- navigatePrevious(): void;
149
- navigateToday(): void;
150
- /**
151
- * Runs a change through the root's policies without showing or saving it, as a gesture's
152
- * preview does: `rejected` with the reason `proposeEventChange` would give, or `accepted`, with
153
- * any `change.warnings`. `null` for an unknown event, or when a policy answers asynchronously.
154
- */
155
- readonly checkEventChange: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>) => CalendarPolicyResult<TEvent, TEventId, TResourceId> | null;
156
- /**
157
- * Validates a change against the root's policies, shows it while `onEventChange` persists it,
158
- * and resolves with the outcome, which `onEventChangeResult` hears first, with `detail` as
159
- * given. Read-only events and roots without `onEventChange` reject. `detail.input` names the
160
- * input that made the proposal, `"api"` by default. A plain function, so it can be passed on as
161
- * a callback.
162
- */
163
- readonly proposeEventChange: (proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>, detail?: CalendarProposalDetail) => Promise<CalendarTransactionResult<TEvent, TEventId, TResourceId>>;
164
- };
165
- type CalendarDiagnostic<TEvent, TEventId extends EventId> = {
166
- readonly code: "unregistered-active-view";
167
- readonly severity: "error";
168
- readonly viewName: string;
169
- } | {
170
- readonly code: "invalid-event";
171
- readonly issue: EventSnapshotIssue<TEvent, TEventId>;
172
- readonly severity: "error";
173
- } | {
174
- readonly code: "invalid-annotation";
175
- readonly issue: AnnotationSnapshotIssue;
176
- readonly severity: "error";
177
- } | {
178
- readonly code: "invalid-availability";
179
- readonly issue: AvailabilityIssue;
180
- readonly severity: "error";
181
- } | {
182
- readonly code: "invalid-secondary-time-zone";
183
- readonly issue: SecondaryTimeZoneIssue;
184
- readonly severity: "error";
185
- };
186
- interface CalendarPartIds {
187
- readonly frame: string;
188
- readonly title: string;
189
- readonly viewport: string;
190
- }
191
56
  interface CalendarPartRefs {
192
57
  readonly frame: RefObject<HTMLElement | null>;
193
58
  readonly title: RefObject<HTMLSpanElement | null>;
@@ -201,6 +66,8 @@ interface CalendarMeta<TEvent, TResource, TViewDef extends AnyCalendarView = Any
201
66
  readonly eventSnapshot: EventSnapshot<TEvent, TEventId, TResourceId>;
202
67
  readonly ids: CalendarPartIds;
203
68
  readonly instanceId: string;
69
+ /** `Root`'s `label`, the frame's name. */
70
+ readonly label: string | undefined;
204
71
  readonly refs: CalendarPartRefs;
205
72
  readonly resources: readonly TResource[];
206
73
  readonly views: readonly TViewDef[];
@@ -210,28 +77,19 @@ interface CalendarContextValue<TEvent, TResource, TViewDef extends AnyCalendarVi
210
77
  readonly meta: CalendarMeta<TEvent, TResource, TViewDef, TEventId, TResourceId>;
211
78
  readonly state: CalendarPublicState<TViewDef["name"], TSelection, TFocus, TResourceId>;
212
79
  }
213
- /** What the active view shows and which events it needs, as `onVisibleRangeChange` reports it. */
214
- interface CalendarVisibleRange<TView extends string = string> {
215
- /** `range` resolved to instants in the display time zone. */
216
- readonly instantRange: InstantInterval;
217
- /** `loadRange` resolved to instants in the display time zone. */
218
- readonly loadInstantRange: InstantInterval;
80
+ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId> {
219
81
  /**
220
- * The dates to have events for: `range`, plus the pages a scrolling view keeps ready on each
221
- * side, so a swipe shows their events at once.
82
+ * Lets an AI agent delete events through the calendar's `deleteEvent` action. Off by default,
83
+ * since a delete needs a person: turn it on only with an agent bridge whose `allow` asks one
84
+ * for each `deleteEvent` step. While it's off, `deleteEvent` isn't among the agent's actions.
222
85
  */
223
- readonly loadRange: PlainDateInterval;
224
- /** The visible dates. */
225
- readonly range: PlainDateInterval;
226
- readonly view: TView;
227
- }
228
- interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId> {
86
+ readonly allowAgentDelete?: boolean;
229
87
  /** The sources views show annotations of, in order. Leave one out to hide its annotations. */
230
88
  readonly annotationSources?: readonly CalendarAnnotationSource[];
231
89
  /**
232
90
  * Time-based information shown beside events, such as listening sessions or sleep. Annotations
233
- * are read-only and never change event layout. Invalid ones are skipped and reported through
234
- * `onDiagnosticsChange`.
91
+ * are read-only and never change how events share lanes. Invalid ones are skipped and reported
92
+ * through `onDiagnosticsChange`.
235
93
  */
236
94
  readonly annotations?: readonly CalendarAnnotation<unknown, TResourceId>[];
237
95
  /**
@@ -248,6 +106,13 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
248
106
  readonly defaultView?: TViewDef["name"];
249
107
  readonly direction?: CalendarEnvironment["direction"];
250
108
  readonly disambiguation?: CalendarEnvironment["disambiguation"];
109
+ /**
110
+ * Names each visible event for an AI agent, in the calendar's agent items. By default its title
111
+ * and when it happens in ISO 8601 in the calendar's time zone, as
112
+ * `Design review · 2026-03-14T09:00 to 2026-03-14T10:00 (Europe/Berlin)`, which an agent reads
113
+ * back exactly; a localized date it can't.
114
+ */
115
+ readonly formatAgentEventLabel?: (event: CalendarAgentEvent) => string;
251
116
  /**
252
117
  * Your events: an array, or a `CalendarEventSource` an external store updates. A new array
253
118
  * holding the same records counts as unchanged. A source's updates render the calendar without
@@ -257,17 +122,24 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
257
122
  readonly expandedResourceIds?: readonly TResourceId[];
258
123
  readonly focus?: TFocus | null;
259
124
  readonly id?: string;
125
+ /**
126
+ * The calendar's name, as `"Team calendar"`. The frame takes it as its `aria-label`, so screen
127
+ * readers and AI agents find the calendar by a name that stays put while navigating; without
128
+ * it, the frame is labelled by the title, which names the visible dates.
129
+ */
130
+ readonly label?: string;
260
131
  readonly locale: Intl.Locale | string;
261
132
  readonly onAnchorDateChange?: CalendarStateChangeHandler<Temporal.PlainDate, "anchorDate">;
262
133
  readonly onDiagnosticsChange?: (diagnostics: readonly CalendarDiagnostic<TEvent, TEventId>[]) => void;
263
134
  /**
264
135
  * Persists an accepted event change. Apply it to `events` synchronously, or return a promise:
265
136
  * the change stays visible as pending until it settles and `events` reflect it, and a rejection
266
- * rolls it back. Without a handler the calendar is read-only.
137
+ * rolls it back. Without a handler the calendar is read-only. `detail.input` names what proposed
138
+ * the change: `"pointer"`, `"keyboard"`, `"api"`, or `"agent"` for an AI agent's.
267
139
  */
268
140
  readonly onEventChange?: CalendarEventChangeHandler<TEvent, TEventId, TResourceId>;
269
141
  /**
270
- * Hears how each proposal ended, from a pointer, the keyboard or `proposeEventChange`: once per
142
+ * Hears how each proposal ended, from a pointer, the keyboard, an agent or `proposeEventChange`: once per
271
143
  * proposal, after it settles, with the result its promise resolves with and the input that made
272
144
  * it. Read from the latest render. A committed change may still wait for `events`; see
273
145
  * `useCalendarPendingChanges`.
@@ -297,7 +169,7 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
297
169
  */
298
170
  readonly secondaryTimeZones?: readonly (CalendarSecondaryTimeZone | string)[];
299
171
  readonly selection?: TSelection | null;
300
- readonly store?: CalendarStore<TViewDef["name"], TSelection, TFocus, TResourceId>;
172
+ readonly store?: CalendarRootStore<TViewDef["name"], TSelection, TFocus, TResourceId>;
301
173
  readonly view?: TViewDef["name"];
302
174
  /** Per-view overrides of each registered view's `defaultOptions`. */
303
175
  readonly viewOptions?: CalendarViewOptionsMap<TViewDef>;
@@ -385,15 +257,11 @@ interface CalendarFactory<TEvent, TResource, TViewDef extends AnyCalendarView =
385
257
  /** The active view's visible dates; `null` when it is unregistered. */
386
258
  useVisibleRange(): PlainDateInterval | null;
387
259
  }
388
- //#endregion
389
- //#region src/announcer.d.ts
390
260
  /**
391
261
  * The announcer views pass to the pointer layer (`useCalendarPointer({ announcer })`), so pointer
392
262
  * gestures are spoken by the same messages and its preview labels ranges the same way.
393
263
  */
394
264
  export declare function useCalendarAnnouncer(): CalendarAnnouncer;
395
- //#endregion
396
- //#region src/availability.d.ts
397
265
  /** The root's working hours: the calendar's, and each resource's on its time zone. */
398
266
  export declare function useCalendarAvailability(): AvailabilitySnapshot;
399
267
  /**
@@ -412,8 +280,6 @@ export declare function useTimelineAvailability(columns: readonly TimeGridColumn
412
280
  * or with `resourceId` that resource's. See `closedDates`.
413
281
  */
414
282
  export declare function useClosedDates(range: PlainDateInterval, resourceId?: ResourceId | null): ReadonlyMap<string, ClosedDate>;
415
- //#endregion
416
- //#region src/calendar.d.ts
417
283
  /**
418
284
  * Creates a typed calendar. The first call fixes the application's record types; the second infers
419
285
  * the view-name union and identifier types from `views` and `eventAdapter`.
@@ -423,18 +289,7 @@ export declare function useClosedDates(range: PlainDateInterval, resourceId?: Re
423
289
  * ```
424
290
  */
425
291
  export declare function createCalendar<TEvent, TResource = unknown, TSelection = CalendarSelection, TFocus = CalendarFocus>(): <TViewDef extends AnyCalendarView<TEvent> = never, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId>(options: CreateCalendarOptions<TEvent, TViewDef, TEventId, TResourceId>) => CalendarFactory<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>;
426
- //#endregion
427
- //#region src/draft.d.ts
428
292
  type AnyDraft = CalendarDraft<EventId, ResourceId>;
429
- /** The busy resources of a range, with the events that make them busy; see `busyResources`. */
430
- type CalendarBusyResources = ReadonlyMap<ResourceId, readonly NormalizedCalendarEvent<unknown, EventId, ResourceId>[]>;
431
- /** A resource during the draft's time; see `useDraftBusy`. */
432
- interface CalendarDraftBusy {
433
- /** The busy events that overlap the draft, by start; empty when the resource is free. */
434
- readonly events: readonly NormalizedCalendarEvent<unknown, EventId, ResourceId>[];
435
- /** Whether the draft falls outside the resource's hours. */
436
- readonly outsideHours: boolean;
437
- }
438
293
  /**
439
294
  * The resources busy during `range`, such as a meeting being placed, with their events; free
440
295
  * ones are absent. It queries the root's events, pending changes included, once per change of
@@ -461,48 +316,6 @@ export declare function useCalendarDraft(): AnyDraft | null;
461
316
  * component re-renders only when its own resource's answer changes.
462
317
  */
463
318
  export declare function useDraftBusy(resourceId: ResourceId | null): CalendarDraftBusy | null;
464
- //#endregion
465
- //#region src/history.d.ts
466
- interface CalendarHistoryAnnouncementContext<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends CalendarAnnouncementContext {
467
- /**
468
- * The step's event as the calendar shows it, for its title: from the latest events the calendar
469
- * rendered, which may still be those from before the undo or redo, or from the events the step
470
- * was checked against. `undefined` when neither has it, as a restored event the events don't
471
- * include yet.
472
- */
473
- readonly event: NormalizedCalendarEvent<TEvent, TEventId, TResourceId> | undefined;
474
- }
475
- /** Builds what a screen reader hears after an undo or a redo; `null` says nothing. */
476
- type CalendarHistoryAnnouncementBuilder<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> = (outcome: EventHistoryOutcome<TEvent, TEventId, TResourceId>, context: CalendarHistoryAnnouncementContext<TEvent, TEventId, TResourceId>) => string | null;
477
- /**
478
- * Localized announcements for undo and redo. The calendar packages ship no text: the registry's
479
- * calendar source has an English set to copy and translate.
480
- */
481
- interface CalendarHistoryMessages<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
482
- readonly redo: CalendarHistoryAnnouncementBuilder<TEvent, TEventId, TResourceId>;
483
- readonly undo: CalendarHistoryAnnouncementBuilder<TEvent, TEventId, TResourceId>;
484
- }
485
- interface CalendarHistoryOptions<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
486
- /**
487
- * Speaks each undo and redo outcome through the root's `Announcer`. Read from the latest
488
- * render; without it, nothing is said.
489
- */
490
- readonly messages?: CalendarHistoryMessages<TEvent, TEventId, TResourceId>;
491
- }
492
- /** What an undo or redo button passes on in the proposal's detail. */
493
- interface CalendarHistoryCommandOptions {
494
- /** The input the command came from; `"api"` by default. */
495
- readonly input?: CalendarInputMethod;
496
- }
497
- /** A history bound to a root: its stacks, and undo and redo through the root's pipeline. */
498
- interface CalendarHistory<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends EventHistorySnapshot<TEvent, TEventId, TResourceId> {
499
- readonly canRedo: boolean;
500
- readonly canUndo: boolean;
501
- /** Takes the last undone step forward again; resolves with the outcome. */
502
- readonly redo: (options?: CalendarHistoryCommandOptions) => Promise<EventHistoryOutcome<TEvent, TEventId, TResourceId>>;
503
- /** Takes the last step back by proposing its inverse; resolves with the outcome. */
504
- readonly undo: (options?: CalendarHistoryCommandOptions) => Promise<EventHistoryOutcome<TEvent, TEventId, TResourceId>>;
505
- }
506
319
  /**
507
320
  * Binds an event history to the nearest `Root`: undo and redo propose the inverse through the
508
321
  * root's `proposeEventChange`, against the events the user sees, and with `messages` their
@@ -520,8 +333,6 @@ interface CalendarHistory<TEvent, TEventId extends EventId = EventId, TResourceI
520
333
  * The server and hydration read an empty history.
521
334
  */
522
335
  export declare function useCalendarHistory<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(history: EventHistory<TEvent, TEventId, TResourceId>, options?: CalendarHistoryOptions<NoInfer<TEvent>, NoInfer<TEventId>, NoInfer<TResourceId>>): CalendarHistory<TEvent, TEventId, TResourceId>;
523
- //#endregion
524
- //#region src/history-shortcuts.d.ts
525
336
  interface CalendarHistoryShortcutsOptions {
526
337
  /** Listens for nothing while `true`. */
527
338
  readonly disabled?: boolean;
@@ -539,11 +350,6 @@ interface CalendarHistoryShortcutsOptions {
539
350
  /** Keys that undo; `["Mod+Z"]` by default, and `[]` turns them off. */
540
351
  readonly undo?: readonly string[];
541
352
  }
542
- /** What undo and redo the shortcuts call: a bound history, from `useCalendarHistory`. */
543
- interface CalendarHistoryShortcutsTarget {
544
- readonly redo: (options?: CalendarHistoryCommandOptions) => unknown;
545
- readonly undo: (options?: CalendarHistoryCommandOptions) => unknown;
546
- }
547
353
  /**
548
354
  * Undo and redo keys for a calendar: Mod+Z undoes, and Shift+Mod+Z or Ctrl+Y redoes, where Mod is
549
355
  * ⌘ on Apple platforms and Ctrl elsewhere. While the hook is mounted and enabled, one `keydown`
@@ -558,30 +364,15 @@ interface CalendarHistoryShortcutsTarget {
558
364
  * ```
559
365
  */
560
366
  export declare function useCalendarHistoryShortcuts(history: CalendarHistoryShortcutsTarget, options: CalendarHistoryShortcutsOptions): void;
561
- //#endregion
562
- //#region src/status.d.ts
563
- /** A resource's status, with the events in progress as the root's snapshot has them. */
564
- type CalendarResourceStatus = ResourceStatus<NormalizedCalendarEvent<unknown, EventId, ResourceId>>;
367
+ /**
368
+ * Whether a resource is within its working hours and whether its events occupy it, `at` an
369
+ * instant or now on the calendar's clock; see `resourceStatusAt`. Without `resourceId` it is the
370
+ * calendar's hours and every event. All-day and floating events count on the display time zone,
371
+ * as the views show them. On the clock it re-renders only when the status changes, and is `null`
372
+ * while server rendering unless the calendar fixes `now`. A `null` resource turns it off, such as
373
+ * for the Unassigned column, with nothing computed or scheduled.
374
+ */
565
375
  export declare function useResourceStatus(resourceId?: ResourceId | null, at?: Temporal.Instant): CalendarResourceStatus | null;
566
- //#endregion
567
- //#region src/store.d.ts
568
- export declare function createCalendarStore<TView extends string = string, TSelection = CalendarSelection, TFocus = CalendarFocus, TResourceId extends ResourceId = ResourceId>(options: CalendarStoreOptions<TView, TSelection, TFocus, TResourceId>): CalendarStore<TView, TSelection, TFocus, TResourceId>;
569
- //#endregion
570
- //#region src/keyboard.d.ts
571
- interface CalendarKeyboardOptions {
572
- /**
573
- * Which way time runs through the view's slots: down the block axis, as in a time grid (the
574
- * default), or along the inline axis, as in a timeline. A slot create grows that way.
575
- */
576
- readonly axis?: "block" | "inline";
577
- /**
578
- * How long an event created on a slot starts out, in whole slots; arrow keys then change it
579
- * as a pointer drag would. One hour by default. A create on a day starts as that day.
580
- */
581
- readonly createDuration?: Temporal.DurationLike;
582
- /** Length and alignment of time-grid slots; pass the pointer layer's `snap`. 15 minutes by default. */
583
- readonly snap?: WallTimeSnapOptions;
584
- }
585
376
  /** Handlers for the element that holds a view's focusable cells and events. */
586
377
  interface CalendarKeyboardHandlers {
587
378
  readonly onBlur: (event: FocusEvent<HTMLElement>) => void;
@@ -610,8 +401,15 @@ export declare function useCalendarKeyboard(options?: CalendarKeyboardOptions):
610
401
  */
611
402
  export declare function useCalendarInteraction(): CalendarKeyboardSession | null;
612
403
  export declare function useCalendarInteraction<TSelected>(selector: (session: CalendarKeyboardSession | null, check: CalendarInteractionCheck) => TSelected, options?: CalendarStateSelectorOptions<TSelected>): TSelected;
613
- //#endregion
614
- //#region src/roving-focus.d.ts
404
+ /**
405
+ * Pointer move, resize, and create for a view region; see `attachCalendarPointer` for the data
406
+ * attributes the view renders. Returns a ref for the region element. Options are read when a
407
+ * gesture starts, and `columns` again as it moves, so changing them never re-attaches listeners,
408
+ * and dragging never re-renders. `disabled` is the exception: a disabled region doesn't listen for
409
+ * touch moves, so a read-only calendar's swipes never wait for its listener, and changing it
410
+ * attaches the listeners again.
411
+ */
412
+ export declare function useCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(options: CalendarPointerOptions<TEvent, TEventId, TResourceId>): RefCallback<HTMLElement>;
615
413
  interface CalendarRovingFocusOptions {
616
414
  /** Dates an event element shows from `target.date`, such as a month segment's span. */
617
415
  readonly days?: number;
@@ -628,14 +426,24 @@ interface CalendarRovingFocusProps {
628
426
  * elements whose tab stop changes re-render.
629
427
  */
630
428
  export declare function useRovingFocus(target: CalendarFocus, { days }?: CalendarRovingFocusOptions): CalendarRovingFocusProps;
631
- //#endregion
632
- //#region src/resources.d.ts
429
+ /**
430
+ * What an expansion command passes on to `onExpandedResourceIdsChange`: the event behind it, as
431
+ * a React event (so `onClick={toggle}` works) or a command's options. Its reason is
432
+ * `"resource-toggle"` unless the options give another.
433
+ */
434
+ type CalendarResourceExpansionCause = CalendarCommandOptions | SyntheticEvent;
435
+ /**
436
+ * An expansion command. It reads a `CalendarResourceExpansionCause` from its argument and ignores
437
+ * any other value, so it fits a callback that passes something else, as a switch's
438
+ * `onCheckedChange` passes a boolean.
439
+ */
440
+ type CalendarResourceExpansionCommand = (cause?: unknown) => void;
633
441
  interface CalendarResourceExpansion {
634
442
  /** Whether the resource's children show. */
635
443
  readonly expanded: boolean;
636
- readonly collapse: () => void;
637
- readonly expand: () => void;
638
- readonly toggle: () => void;
444
+ readonly collapse: CalendarResourceExpansionCommand;
445
+ readonly expand: CalendarResourceExpansionCommand;
446
+ readonly toggle: CalendarResourceExpansionCommand;
639
447
  }
640
448
  /**
641
449
  * The root's resources as a view shows them: depth first, with collapsed resources' descendants
@@ -648,8 +456,6 @@ export declare function useVisibleResources(options?: ResourceVisibilityOptions)
648
456
  * own its toggle.
649
457
  */
650
458
  export declare function useResourceExpansion(resourceId: ResourceId): CalendarResourceExpansion;
651
- //#endregion
652
- //#region src/selectors.d.ts
653
459
  /**
654
460
  * Selects from the calendar's focus for a view's item, such as whether a slot cursor sits on this
655
461
  * column. A component re-renders only when its result changes.
@@ -660,8 +466,6 @@ export declare function useCalendarFocus<TSelected>(selector: (focus: CalendarFo
660
466
  * `useCalendarSelection((selection) => selection?.kind === "event" && selection.eventId === id)`.
661
467
  */
662
468
  export declare function useCalendarSelection<TSelected>(selector: (selection: CalendarSelection | null) => TSelected, options?: CalendarStateSelectorOptions<TSelected>): TSelected;
663
- //#endregion
664
- //#region src/use-now.d.ts
665
469
  interface UseNowOptions {
666
470
  /** How often the clock is sampled. Defaults to one minute. */
667
471
  readonly intervalMs?: number;
@@ -671,8 +475,6 @@ interface UseNowOptions {
671
475
  * clock. It is `null` during server rendering and hydration unless the calendar fixes `now`.
672
476
  */
673
477
  export declare function useNow({ intervalMs }?: UseNowOptions): Temporal.Instant | null;
674
- //#endregion
675
- //#region src/requests.d.ts
676
478
  /**
677
479
  * Calls `listener` whenever something asks the calendar for an anchor date: Previous, Next,
678
480
  * Today, keys paging past the view, or `setAnchorDate`, even a date that is already the anchor.
@@ -682,5 +484,4 @@ export declare function useNow({ intervalMs }?: UseNowOptions): Temporal.Instant
682
484
  * it to show its range again when asked.
683
485
  */
684
486
  export declare function useAnchorDateRequests(listener: (date: Temporal.PlainDate, range: PlainDateInterval | null) => void): void;
685
- //#endregion
686
- export type { AnyCalendarView, CalendarActions, CalendarActiveView, CalendarActiveViewProps, CalendarAnnotations, CalendarAnnouncerProps, CalendarBusyResources, CalendarContextValue, CalendarControlledState, CalendarDiagnostic, CalendarDraftBusy, CalendarEventProps, CalendarEventRenderValue, CalendarFactory, CalendarFrameProps, CalendarHistory, CalendarHistoryAnnouncementBuilder, CalendarHistoryAnnouncementContext, CalendarHistoryCommandOptions, CalendarHistoryMessages, CalendarHistoryOptions, CalendarHistoryShortcutsOptions, CalendarHistoryShortcutsTarget, CalendarKeyboardHandlers, CalendarKeyboardOptions, CalendarMeta, CalendarPartIds, CalendarPartRefs, CalendarPublicState, CalendarResourceExpansion, CalendarResourceStatus, CalendarRootProps, CalendarRovingFocusOptions, CalendarRovingFocusProps, CalendarSemanticActions, CalendarStateChangeDetail, CalendarStateChangeHandler, CalendarStateChangeHandlers, CalendarStateSelector, CalendarStateSelectorOptions, CalendarStateSlice, CalendarStore, CalendarStoreOptions, CalendarTitleProps, CalendarToolbarProps, CalendarTriggerProps, CalendarView, CalendarViewActions, CalendarViewInput, CalendarViewOptionsMap, CalendarViewRendererProps, CalendarViewSwitcherProps, CalendarViewportProps, CalendarVisibleRange, CreateCalendarOptions, UseNowOptions };
487
+ export { type AnyCalendarView, type CalendarActions, type CalendarActiveView, type CalendarActiveViewProps, type CalendarAgentEvent, type CalendarAnnotations, type CalendarAnnouncerProps, type CalendarBusyResources, type CalendarChangeReason, type CalendarChangeSource, type CalendarCommandOptions, type CalendarContextValue, type CalendarControlledState, type CalendarDiagnostic, type CalendarDraftBusy, type CalendarEventProps, type CalendarEventRenderValue, type CalendarFactory, type CalendarFrameProps, type CalendarHistory, type CalendarHistoryAnnouncementBuilder, type CalendarHistoryAnnouncementContext, type CalendarHistoryCommandOptions, type CalendarHistoryMessages, type CalendarHistoryOptions, type CalendarHistoryShortcutsOptions, type CalendarHistoryShortcutsTarget, type CalendarKeyboardHandlers, type CalendarKeyboardOptions, type CalendarMeta, type CalendarPartIds, type CalendarPartRefs, type CalendarPublicState, type CalendarResourceExpansion, type CalendarResourceExpansionCause, type CalendarResourceExpansionCommand, type CalendarResourceStatus, type CalendarRootProps, type CalendarRootStore, type CalendarRovingFocusOptions, type CalendarRovingFocusProps, type CalendarSemanticActions, type CalendarStateChangeDetail, type CalendarStateChangeHandler, type CalendarStateChangeHandlers, type CalendarStateSelector, type CalendarStateSelectorOptions, type CalendarStateSlice, type CalendarStore, type CalendarStoreOptions, type CalendarTitleProps, type CalendarToolbarProps, type CalendarTriggerProps, type CalendarView, type CalendarViewActions, type CalendarViewInput, type CalendarViewOptionsMap, type CalendarViewRendererProps, type CalendarViewSwitcherProps, type CalendarViewportProps, type CalendarVisibleRange, type CreateCalendarOptions, type UseNowOptions, createCalendarStore };