@moltenship/calendar-react 1.0.0-rc.1 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -21,6 +27,7 @@ pnpm add @moltenship/calendar-react react
21
27
  ## Documentation
22
28
 
23
29
  - [React components and hooks](https://time.molten.sh/docs/api/react)
30
+ - [Agents](https://time.molten.sh/docs/agents)
24
31
  - [Repository](https://github.com/Moltenship/time)
25
32
 
26
33
  ## License
package/dist/index.d.mts CHANGED
@@ -1,85 +1,14 @@
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";
1
+ import { AvailabilityBand, AvailabilityExtent, AvailabilitySnapshot, CalendarAnnotation, CalendarAnnotationSource, CalendarAnnouncementContext, CalendarAnnouncementMessages, CalendarAnnouncer, CalendarAvailability, CalendarDraft, CalendarEnvironment, CalendarEnvironmentBase, CalendarEventChangeHandler, CalendarEventInput, CalendarEventInterval, CalendarFocus, CalendarInputMethod, CalendarInteractionCheck, CalendarKeyboardSession, CalendarNowSource, CalendarPendingChanges, CalendarPolicy, CalendarProposalDetail, CalendarSecondaryTimeZone, CalendarSelection, CalendarTransactionResult, CalendarViewStrategy, CalendarWeekRules, ClosedDate, EventAdapter, EventHistory, EventHistoryOutcome, EventHistorySnapshot, EventId, EventSnapshot, InvalidCalendarEventPolicy, NormalizedCalendarEvent, ResourceId, ResourceStatus, 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, CalendarChangeReason, CalendarChangeSource, CalendarCommandOptions, CalendarControlledState, CalendarDiagnostic, CalendarPartIds, CalendarPublicState, 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";
3
5
  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
- }
10
6
  export declare function useCalendarAnnotations(): CalendarAnnotations;
11
7
  /**
12
8
  * The root's annotations laid out beside a time grid's columns, one list of marks per column; see
13
9
  * `projectTimeGridAnnotations`. Marks carry the root's source objects unchanged.
14
10
  */
15
11
  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
12
  interface CalendarViewRendererProps<TProjection, TOptions> {
84
13
  /** Stable for the lifetime of the calendar root. */
85
14
  readonly actions: CalendarViewActions;
@@ -103,11 +32,9 @@ interface CalendarViewRendererProps<TProjection, TOptions> {
103
32
  /** The visible dates. */
104
33
  readonly range: PlainDateInterval;
105
34
  }
106
- interface CalendarView<TName extends string = string, TProjection = unknown, TOptions = unknown, TEvent = unknown> {
107
- readonly defaultOptions: TOptions;
108
- readonly name: TName;
35
+ /** A kernel view definition with the React component that renders its projection. */
36
+ interface CalendarView<TName extends string = string, TProjection = unknown, TOptions = unknown, TEvent = unknown> extends CalendarViewDefinition<TName, TProjection, TOptions, TEvent> {
109
37
  readonly Renderer: ComponentType<CalendarViewRendererProps<TProjection, TOptions>>;
110
- readonly strategy: CalendarViewStrategy<TProjection, TOptions, TEvent>;
111
38
  }
112
39
  type AnyCalendarView<TEvent = any> = CalendarView<string, any, any, TEvent>;
113
40
  interface CalendarViewInputBase<TName extends string, TProjection, TOptions, TEvent> {
@@ -121,73 +48,10 @@ type CalendarViewInput<TName extends string, TProjection, TOptions, TEvent> = Ca
121
48
  readonly defaultOptions: TOptions;
122
49
  });
123
50
  /** 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"]>; };
51
+ type CalendarViewOptionsMap<TViewDef extends AnyCalendarView> = CalendarViewOptionsMap$1<TViewDef>;
127
52
  /** 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;
53
+ type CalendarActiveView<TViewDef extends AnyCalendarView> = CalendarActiveView$1<TViewDef>;
143
54
  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
55
  interface CalendarPartRefs {
192
56
  readonly frame: RefObject<HTMLElement | null>;
193
57
  readonly title: RefObject<HTMLSpanElement | null>;
@@ -201,6 +65,8 @@ interface CalendarMeta<TEvent, TResource, TViewDef extends AnyCalendarView = Any
201
65
  readonly eventSnapshot: EventSnapshot<TEvent, TEventId, TResourceId>;
202
66
  readonly ids: CalendarPartIds;
203
67
  readonly instanceId: string;
68
+ /** `Root`'s `label`, the frame's name. */
69
+ readonly label: string | undefined;
204
70
  readonly refs: CalendarPartRefs;
205
71
  readonly resources: readonly TResource[];
206
72
  readonly views: readonly TViewDef[];
@@ -210,28 +76,19 @@ interface CalendarContextValue<TEvent, TResource, TViewDef extends AnyCalendarVi
210
76
  readonly meta: CalendarMeta<TEvent, TResource, TViewDef, TEventId, TResourceId>;
211
77
  readonly state: CalendarPublicState<TViewDef["name"], TSelection, TFocus, TResourceId>;
212
78
  }
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;
79
+ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId> {
219
80
  /**
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.
81
+ * Lets an AI agent delete events through the calendar's `deleteEvent` action. Off by default,
82
+ * since a delete needs a person: turn it on only with an agent bridge whose `allow` asks one
83
+ * for each `deleteEvent` step. While it's off, `deleteEvent` isn't among the agent's actions.
222
84
  */
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> {
85
+ readonly allowAgentDelete?: boolean;
229
86
  /** The sources views show annotations of, in order. Leave one out to hide its annotations. */
230
87
  readonly annotationSources?: readonly CalendarAnnotationSource[];
231
88
  /**
232
89
  * 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`.
90
+ * are read-only and never change how events share lanes. Invalid ones are skipped and reported
91
+ * through `onDiagnosticsChange`.
235
92
  */
236
93
  readonly annotations?: readonly CalendarAnnotation<unknown, TResourceId>[];
237
94
  /**
@@ -248,6 +105,13 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
248
105
  readonly defaultView?: TViewDef["name"];
249
106
  readonly direction?: CalendarEnvironment["direction"];
250
107
  readonly disambiguation?: CalendarEnvironment["disambiguation"];
108
+ /**
109
+ * Names each visible event for an AI agent, in the calendar's agent items. By default its title
110
+ * and when it happens in ISO 8601 in the calendar's time zone, as
111
+ * `Design review · 2026-03-14T09:00 to 2026-03-14T10:00 (Europe/Berlin)`, which an agent reads
112
+ * back exactly; a localized date it can't.
113
+ */
114
+ readonly formatAgentEventLabel?: (event: CalendarAgentEvent) => string;
251
115
  /**
252
116
  * Your events: an array, or a `CalendarEventSource` an external store updates. A new array
253
117
  * holding the same records counts as unchanged. A source's updates render the calendar without
@@ -257,17 +121,24 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
257
121
  readonly expandedResourceIds?: readonly TResourceId[];
258
122
  readonly focus?: TFocus | null;
259
123
  readonly id?: string;
124
+ /**
125
+ * The calendar's name, as `"Team calendar"`. The frame takes it as its `aria-label`, so screen
126
+ * readers and AI agents find the calendar by a name that stays put while navigating; without
127
+ * it, the frame is labelled by the title, which names the visible dates.
128
+ */
129
+ readonly label?: string;
260
130
  readonly locale: Intl.Locale | string;
261
131
  readonly onAnchorDateChange?: CalendarStateChangeHandler<Temporal.PlainDate, "anchorDate">;
262
132
  readonly onDiagnosticsChange?: (diagnostics: readonly CalendarDiagnostic<TEvent, TEventId>[]) => void;
263
133
  /**
264
134
  * Persists an accepted event change. Apply it to `events` synchronously, or return a promise:
265
135
  * 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.
136
+ * rolls it back. Without a handler the calendar is read-only. `detail.input` names what proposed
137
+ * the change: `"pointer"`, `"keyboard"`, `"api"`, or `"agent"` for an AI agent's.
267
138
  */
268
139
  readonly onEventChange?: CalendarEventChangeHandler<TEvent, TEventId, TResourceId>;
269
140
  /**
270
- * Hears how each proposal ended, from a pointer, the keyboard or `proposeEventChange`: once per
141
+ * Hears how each proposal ended, from a pointer, the keyboard, an agent or `proposeEventChange`: once per
271
142
  * proposal, after it settles, with the result its promise resolves with and the input that made
272
143
  * it. Read from the latest render. A committed change may still wait for `events`; see
273
144
  * `useCalendarPendingChanges`.
@@ -297,7 +168,7 @@ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarV
297
168
  */
298
169
  readonly secondaryTimeZones?: readonly (CalendarSecondaryTimeZone | string)[];
299
170
  readonly selection?: TSelection | null;
300
- readonly store?: CalendarStore<TViewDef["name"], TSelection, TFocus, TResourceId>;
171
+ readonly store?: CalendarRootStore<TViewDef["name"], TSelection, TFocus, TResourceId>;
301
172
  readonly view?: TViewDef["name"];
302
173
  /** Per-view overrides of each registered view's `defaultOptions`. */
303
174
  readonly viewOptions?: CalendarViewOptionsMap<TViewDef>;
@@ -385,15 +256,11 @@ interface CalendarFactory<TEvent, TResource, TViewDef extends AnyCalendarView =
385
256
  /** The active view's visible dates; `null` when it is unregistered. */
386
257
  useVisibleRange(): PlainDateInterval | null;
387
258
  }
388
- //#endregion
389
- //#region src/announcer.d.ts
390
259
  /**
391
260
  * The announcer views pass to the pointer layer (`useCalendarPointer({ announcer })`), so pointer
392
261
  * gestures are spoken by the same messages and its preview labels ranges the same way.
393
262
  */
394
263
  export declare function useCalendarAnnouncer(): CalendarAnnouncer;
395
- //#endregion
396
- //#region src/availability.d.ts
397
264
  /** The root's working hours: the calendar's, and each resource's on its time zone. */
398
265
  export declare function useCalendarAvailability(): AvailabilitySnapshot;
399
266
  /**
@@ -412,8 +279,6 @@ export declare function useTimelineAvailability(columns: readonly TimeGridColumn
412
279
  * or with `resourceId` that resource's. See `closedDates`.
413
280
  */
414
281
  export declare function useClosedDates(range: PlainDateInterval, resourceId?: ResourceId | null): ReadonlyMap<string, ClosedDate>;
415
- //#endregion
416
- //#region src/calendar.d.ts
417
282
  /**
418
283
  * Creates a typed calendar. The first call fixes the application's record types; the second infers
419
284
  * the view-name union and identifier types from `views` and `eventAdapter`.
@@ -423,8 +288,6 @@ export declare function useClosedDates(range: PlainDateInterval, resourceId?: Re
423
288
  * ```
424
289
  */
425
290
  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
291
  type AnyDraft = CalendarDraft<EventId, ResourceId>;
429
292
  /** The busy resources of a range, with the events that make them busy; see `busyResources`. */
430
293
  type CalendarBusyResources = ReadonlyMap<ResourceId, readonly NormalizedCalendarEvent<unknown, EventId, ResourceId>[]>;
@@ -461,8 +324,6 @@ export declare function useCalendarDraft(): AnyDraft | null;
461
324
  * component re-renders only when its own resource's answer changes.
462
325
  */
463
326
  export declare function useDraftBusy(resourceId: ResourceId | null): CalendarDraftBusy | null;
464
- //#endregion
465
- //#region src/history.d.ts
466
327
  interface CalendarHistoryAnnouncementContext<TEvent = unknown, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends CalendarAnnouncementContext {
467
328
  /**
468
329
  * The step's event as the calendar shows it, for its title: from the latest events the calendar
@@ -520,8 +381,6 @@ interface CalendarHistory<TEvent, TEventId extends EventId = EventId, TResourceI
520
381
  * The server and hydration read an empty history.
521
382
  */
522
383
  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
384
  interface CalendarHistoryShortcutsOptions {
526
385
  /** Listens for nothing while `true`. */
527
386
  readonly disabled?: boolean;
@@ -558,16 +417,9 @@ interface CalendarHistoryShortcutsTarget {
558
417
  * ```
559
418
  */
560
419
  export declare function useCalendarHistoryShortcuts(history: CalendarHistoryShortcutsTarget, options: CalendarHistoryShortcutsOptions): void;
561
- //#endregion
562
- //#region src/status.d.ts
563
420
  /** A resource's status, with the events in progress as the root's snapshot has them. */
564
421
  type CalendarResourceStatus = ResourceStatus<NormalizedCalendarEvent<unknown, EventId, ResourceId>>;
565
422
  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
423
  interface CalendarKeyboardOptions {
572
424
  /**
573
425
  * Which way time runs through the view's slots: down the block axis, as in a time grid (the
@@ -610,8 +462,6 @@ export declare function useCalendarKeyboard(options?: CalendarKeyboardOptions):
610
462
  */
611
463
  export declare function useCalendarInteraction(): CalendarKeyboardSession | null;
612
464
  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
615
465
  interface CalendarRovingFocusOptions {
616
466
  /** Dates an event element shows from `target.date`, such as a month segment's span. */
617
467
  readonly days?: number;
@@ -628,14 +478,24 @@ interface CalendarRovingFocusProps {
628
478
  * elements whose tab stop changes re-render.
629
479
  */
630
480
  export declare function useRovingFocus(target: CalendarFocus, { days }?: CalendarRovingFocusOptions): CalendarRovingFocusProps;
631
- //#endregion
632
- //#region src/resources.d.ts
481
+ /**
482
+ * What an expansion command passes on to `onExpandedResourceIdsChange`: the event behind it, as
483
+ * a React event (so `onClick={toggle}` works) or a command's options. Its reason is
484
+ * `"resource-toggle"` unless the options give another.
485
+ */
486
+ type CalendarResourceExpansionCause = CalendarCommandOptions | SyntheticEvent;
487
+ /**
488
+ * An expansion command. It reads a `CalendarResourceExpansionCause` from its argument and ignores
489
+ * any other value, so it fits a callback that passes something else, as a switch's
490
+ * `onCheckedChange` passes a boolean.
491
+ */
492
+ type CalendarResourceExpansionCommand = (cause?: unknown) => void;
633
493
  interface CalendarResourceExpansion {
634
494
  /** Whether the resource's children show. */
635
495
  readonly expanded: boolean;
636
- readonly collapse: () => void;
637
- readonly expand: () => void;
638
- readonly toggle: () => void;
496
+ readonly collapse: CalendarResourceExpansionCommand;
497
+ readonly expand: CalendarResourceExpansionCommand;
498
+ readonly toggle: CalendarResourceExpansionCommand;
639
499
  }
640
500
  /**
641
501
  * The root's resources as a view shows them: depth first, with collapsed resources' descendants
@@ -648,8 +508,6 @@ export declare function useVisibleResources(options?: ResourceVisibilityOptions)
648
508
  * own its toggle.
649
509
  */
650
510
  export declare function useResourceExpansion(resourceId: ResourceId): CalendarResourceExpansion;
651
- //#endregion
652
- //#region src/selectors.d.ts
653
511
  /**
654
512
  * Selects from the calendar's focus for a view's item, such as whether a slot cursor sits on this
655
513
  * column. A component re-renders only when its result changes.
@@ -660,8 +518,6 @@ export declare function useCalendarFocus<TSelected>(selector: (focus: CalendarFo
660
518
  * `useCalendarSelection((selection) => selection?.kind === "event" && selection.eventId === id)`.
661
519
  */
662
520
  export declare function useCalendarSelection<TSelected>(selector: (selection: CalendarSelection | null) => TSelected, options?: CalendarStateSelectorOptions<TSelected>): TSelected;
663
- //#endregion
664
- //#region src/use-now.d.ts
665
521
  interface UseNowOptions {
666
522
  /** How often the clock is sampled. Defaults to one minute. */
667
523
  readonly intervalMs?: number;
@@ -671,8 +527,6 @@ interface UseNowOptions {
671
527
  * clock. It is `null` during server rendering and hydration unless the calendar fixes `now`.
672
528
  */
673
529
  export declare function useNow({ intervalMs }?: UseNowOptions): Temporal.Instant | null;
674
- //#endregion
675
- //#region src/requests.d.ts
676
530
  /**
677
531
  * Calls `listener` whenever something asks the calendar for an anchor date: Previous, Next,
678
532
  * Today, keys paging past the view, or `setAnchorDate`, even a date that is already the anchor.
@@ -682,5 +536,4 @@ export declare function useNow({ intervalMs }?: UseNowOptions): Temporal.Instant
682
536
  * it to show its range again when asked.
683
537
  */
684
538
  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 };
539
+ 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 };