@moltenship/calendar-solid 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Timofey Maximov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,48 @@
1
- # Temporary Holding Version
1
+ # @moltenship/calendar-solid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **New in 2.0.** The Solid registry has every ready-made view:
4
+ > `npx shadcn@latest add https://time.molten.sh/r/solid/calendar-full.json` installs them all.
5
+ > For a view of your own, you define one with `defineCalendarView`, over the engine's
6
+ > projections, and bind keyboard navigation, dragging, drafts and undo to it with this package's
7
+ > hooks.
8
+
9
+ The headless [SolidJS](https://www.solidjs.com) 2 layer of Moltenship Time. It renders the
10
+ calendar primitive from `@moltenship/calendar-primitives` with
11
+ [ui-sdk](https://ui-sdk.dev)'s Solid adapter, the way `@moltenship/calendar-react` does for React,
12
+ so both frameworks share one implementation of the calendar's state, actions and event changes.
13
+ It renders plain, unstyled elements: `createCalendar` gives a `Root`, the structural parts (frame,
14
+ toolbar, title, viewport, view switcher, the previous, next and today triggers, the active view,
15
+ `Event` and `Announcer`) and hooks that return accessors where React's return values. A view binds
16
+ keyboard navigation with `useCalendarKeyboard` and `useRovingFocus`, pointer dragging, resizing
17
+ and creating with `useCalendarPointer` over `@moltenship/calendar-dnd`, and undo with
18
+ `useCalendarHistory`. Agents drive the calendar through ui-sdk's bridge, which the application
19
+ creates.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pnpm add @moltenship/calendar-solid solid-js @solidjs/web @ui-sdk/core @ui-sdk/solid
25
+ ```
26
+
27
+ - It re-exports `@moltenship/calendar-core` and `@moltenship/calendar-temporal`, as
28
+ `@moltenship/calendar` does for React, so the event adapter, the views' projections and the
29
+ Temporal helpers import from it.
30
+ - Solid 2: `solid-js` and `@solidjs/web` are peer dependencies.
31
+ - ui-sdk's `@ui-sdk/core` and `@ui-sdk/solid` 0.1 beta. They are peer dependencies, and still
32
+ pre-1.0, so this package takes the beta the calendar was tested with and the ones after it in
33
+ the same 0.1 line.
34
+ - A runtime with `Temporal` (Node.js 26 and later include it), or a polyfill that defines
35
+ `globalThis.Temporal`, loaded first.
36
+ - TypeScript 6 or later with `"lib": ["DOM", "DOM.Iterable", "ESNext"]`.
37
+
38
+ This package doesn't use React, and `@moltenship/calendar` (the React facade) doesn't re-export
39
+ it.
40
+
41
+ ## Documentation
42
+
43
+ - [Solid](https://time.molten.sh/docs/solid)
44
+ - [Repository](https://github.com/Moltenship/time)
45
+
46
+ ## License
47
+
48
+ MIT
@@ -0,0 +1,550 @@
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 { InstantInterval, PlainDateInterval } from "@moltenship/calendar-temporal";
3
+ import { Accessor, Component } from "solid-js";
4
+ import { JSX } from "@solidjs/web";
5
+ import { CalendarActions, CalendarActiveView, CalendarActiveView as CalendarActiveView$1, CalendarAgentEvent, CalendarAgentEvent as CalendarAgentEvent$1, CalendarAnnotations, CalendarBusyResources, CalendarChangeReason, CalendarChangeSource, CalendarCommandOptions, CalendarCommandOptions as CalendarCommandOptions$1, CalendarControlledState, CalendarDiagnostic, CalendarDiagnostic as CalendarDiagnostic$1, CalendarDraftBusy, CalendarHistory, CalendarHistoryAnnouncementBuilder, CalendarHistoryAnnouncementContext, CalendarHistoryCommandOptions, CalendarHistoryMessages, CalendarHistoryOptions, CalendarHistoryShortcutsTarget, CalendarKeyboardOptions, CalendarPartIds, CalendarPartIds as CalendarPartIds$1, CalendarPublicState, CalendarPublicState as CalendarPublicState$1, CalendarResourceStatus, CalendarRootStore, CalendarRootStore as CalendarRootStore$1, CalendarSemanticActions, CalendarSemanticActions as CalendarSemanticActions$1, CalendarStateChangeDetail, CalendarStateChangeHandler, CalendarStateChangeHandler as CalendarStateChangeHandler$1, CalendarStateChangeHandlers, CalendarStateSelector, CalendarStateSelector as CalendarStateSelector$1, CalendarStateSelectorOptions, CalendarStateSelectorOptions as CalendarStateSelectorOptions$1, CalendarStateSlice, CalendarStateSource, CalendarStateSource as CalendarStateSource$1, CalendarStore, CalendarStoreOptions, CalendarViewActions, CalendarViewActions as CalendarViewActions$1, CalendarViewDefinition, CalendarViewOptionsMap, CalendarViewOptionsMap as CalendarViewOptionsMap$1, CalendarVisibleRange, CalendarVisibleRange as CalendarVisibleRange$1, createCalendarStore, resolveViewOptions } from "@moltenship/calendar-primitives";
6
+ import { CalendarDragFollower, CalendarDragMonitor, CalendarDragPreview, CalendarDropOptions, CalendarDropSession, CalendarDropSource, CalendarEventDrag, CalendarPoint, CalendarPointerOptions, CalendarPointerOptions as CalendarPointerOptions$1, CalendarRect, CalendarRegion, attachCalendarPointer, eventIdAttributes, eventIdOf, monitorCalendarDrags, observeCalendarRegions, resourceIdAttributes, resourceIdOf, startCalendarDrop } from "@moltenship/calendar-dnd";
7
+ export * from "@moltenship/calendar-core";
8
+ export * from "@moltenship/calendar-temporal";
9
+ /** A value, or an accessor of one: what the hooks take wherever an argument may change. */
10
+ type MaybeAccessor<T> = T | Accessor<T>;
11
+ /** The root's annotations and their sources, as an accessor. Works inside any calendar's root. */
12
+ export declare function useCalendarAnnotations(): Accessor<CalendarAnnotations>;
13
+ /**
14
+ * The root's annotations laid out beside a time grid's columns, one list of marks per column, as
15
+ * an accessor; see `projectTimeGridAnnotations`. Marks carry the root's source objects unchanged.
16
+ */
17
+ export declare function useTimeGridAnnotations(columns: MaybeAccessor<readonly TimeGridColumn[]>, geometry?: MaybeAccessor<TimeGridAnnotationGeometry>): Accessor<readonly (readonly TimeGridAnnotationMark[])[]>;
18
+ /**
19
+ * What `ActiveView` passes the active view's renderer. They are Solid props: getters that read the
20
+ * calendar's current values, so read them where they are used, in JSX or a memo, and don't
21
+ * destructure them.
22
+ */
23
+ interface CalendarViewRendererProps<TProjection, TOptions> {
24
+ /** Stable for the lifetime of the calendar root. */
25
+ readonly actions: CalendarViewActions$1;
26
+ readonly environment: CalendarEnvironmentBase;
27
+ /** The events the projection was built from, pending changes included. */
28
+ readonly events: EventSnapshot<unknown, EventId, ResourceId>;
29
+ /** The root has no `onEventChange`, so it rejects every change. */
30
+ readonly isReadOnly?: boolean;
31
+ /** The dates the projection covers: `range`, plus what a scrolling view keeps ready. */
32
+ readonly loadRange?: PlainDateInterval;
33
+ readonly options: TOptions;
34
+ readonly projection: TProjection;
35
+ /** The visible dates. */
36
+ readonly range: PlainDateInterval;
37
+ }
38
+ /** A kernel view definition with the Solid component that renders its projection. */
39
+ interface CalendarView<TName extends string = string, TProjection = unknown, TOptions = unknown, TEvent = unknown> extends CalendarViewDefinition<TName, TProjection, TOptions, TEvent> {
40
+ readonly Renderer: Component<CalendarViewRendererProps<TProjection, TOptions>>;
41
+ }
42
+ type AnyCalendarView<TEvent = any> = CalendarView<string, any, any, TEvent>;
43
+ interface CalendarViewInputBase<TName extends string, TProjection, TOptions, TEvent> {
44
+ readonly name: TName;
45
+ readonly Renderer: Component<CalendarViewRendererProps<TProjection, TOptions>>;
46
+ readonly strategy: CalendarViewStrategy<TProjection, TOptions, TEvent>;
47
+ }
48
+ type CalendarViewInput<TName extends string, TProjection, TOptions, TEvent> = CalendarViewInputBase<TName, TProjection, TOptions, TEvent> & (undefined extends TOptions ? {
49
+ readonly defaultOptions?: TOptions;
50
+ } : {
51
+ readonly defaultOptions: TOptions;
52
+ });
53
+ /**
54
+ * Defines a view: a name, the core strategy that ranges, navigates and projects it, and the Solid
55
+ * component that renders the projection. The same shape as `@moltenship/calendar-react`'s, with a
56
+ * Solid `Renderer`.
57
+ */
58
+ export declare function defineCalendarView<const TName extends string, TProjection, TOptions = undefined, TEvent = unknown>(view: CalendarViewInput<TName, TProjection, TOptions, TEvent>): CalendarView<TName, TProjection, TOptions, TEvent>;
59
+ /** The elements of a root's structural parts, once they are rendered. */
60
+ interface CalendarPartRefs {
61
+ readonly frame: Accessor<HTMLElement | undefined>;
62
+ readonly title: Accessor<HTMLSpanElement | undefined>;
63
+ readonly toolbar: Accessor<HTMLElement | undefined>;
64
+ readonly viewport: Accessor<HTMLDivElement | undefined>;
65
+ }
66
+ interface CalendarMeta<TEvent, TResource, TViewDef extends AnyCalendarView = AnyCalendarView, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
67
+ readonly activeView: TViewDef | undefined;
68
+ readonly diagnostics: readonly CalendarDiagnostic$1<TEvent, TEventId>[];
69
+ readonly environment: CalendarEnvironment;
70
+ /** The events views show, pending changes included. */
71
+ readonly eventSnapshot: EventSnapshot<TEvent, TEventId, TResourceId>;
72
+ readonly ids: CalendarPartIds$1;
73
+ readonly instanceId: string;
74
+ /** `Root`'s `label`, the frame's name. */
75
+ readonly label: string | undefined;
76
+ readonly refs: CalendarPartRefs;
77
+ readonly resources: readonly TResource[];
78
+ readonly views: readonly TViewDef[];
79
+ }
80
+ /**
81
+ * `useCalendar()`'s value. `meta` and `state` are getters, as Solid props are: read them in a
82
+ * tracking scope (JSX, a memo, an effect's compute) and don't destructure them.
83
+ */
84
+ interface CalendarContextValue<TEvent, TResource, TViewDef extends AnyCalendarView = AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
85
+ readonly actions: CalendarSemanticActions$1<TViewDef["name"], TSelection, TFocus, TResourceId, TEvent, TEventId>;
86
+ readonly meta: CalendarMeta<TEvent, TResource, TViewDef, TEventId, TResourceId>;
87
+ readonly state: CalendarPublicState$1<TViewDef["name"], TSelection, TFocus, TResourceId>;
88
+ }
89
+ interface CalendarRootBaseProps<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId> {
90
+ /**
91
+ * Lets an AI agent delete events through the calendar's `deleteEvent` action. Off by default,
92
+ * since a delete needs a person: turn it on only with an agent bridge whose `allow` asks one
93
+ * for each `deleteEvent` step. While it's off, `deleteEvent` isn't among the agent's actions.
94
+ */
95
+ readonly allowAgentDelete?: boolean;
96
+ /** The sources views show annotations of, in order. */
97
+ readonly annotationSources?: readonly CalendarAnnotationSource[];
98
+ /** Time-based information shown beside events; invalid ones go to `onDiagnosticsChange`. */
99
+ readonly annotations?: readonly CalendarAnnotation<unknown, TResourceId>[];
100
+ /** The calendar's working hours; invalid rules go to `onDiagnosticsChange`. */
101
+ readonly availability?: CalendarAvailability;
102
+ readonly children?: JSX.Element;
103
+ readonly defaultExpandedResourceIds?: readonly TResourceId[];
104
+ readonly defaultFocus?: TFocus | null;
105
+ readonly defaultSelection?: TSelection | null;
106
+ readonly defaultView?: TViewDef["name"];
107
+ readonly direction?: CalendarEnvironment["direction"];
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$1) => string;
116
+ /**
117
+ * Your events: an array, or a `CalendarEventSource` an external store updates. A source's
118
+ * updates re-derive the calendar without the component that renders `Root`; the server and
119
+ * hydration read its `getServerSnapshot`.
120
+ */
121
+ readonly events: CalendarEventInput<TEvent>;
122
+ readonly expandedResourceIds?: readonly TResourceId[];
123
+ readonly focus?: TFocus | null;
124
+ /** The instance's id, which the parts' ids start with; one is generated without it. */
125
+ readonly id?: string;
126
+ /**
127
+ * The calendar's name, as `"Team calendar"`. The frame takes it as its `aria-label`, so screen
128
+ * readers and AI agents find the calendar by a name that stays put while navigating; without
129
+ * it, the frame is labelled by the title, which names the visible dates.
130
+ */
131
+ readonly label?: string;
132
+ readonly locale: Intl.Locale | string;
133
+ readonly onAnchorDateChange?: CalendarStateChangeHandler$1<Temporal.PlainDate, "anchorDate">;
134
+ readonly onDiagnosticsChange?: (diagnostics: readonly CalendarDiagnostic$1<TEvent, TEventId>[]) => void;
135
+ /**
136
+ * Persists an accepted event change. Apply it to `events` synchronously, or return a promise:
137
+ * the change stays visible as pending until it settles and `events` reflect it, and a rejection
138
+ * rolls it back. Without a handler the calendar is read-only. `detail.input` names what proposed
139
+ * the change: `"pointer"`, `"keyboard"`, `"api"`, or `"agent"` for an AI agent's.
140
+ */
141
+ readonly onEventChange?: CalendarEventChangeHandler<TEvent, TEventId, TResourceId>;
142
+ /** Hears how each proposal ended, once per proposal, after it settles. */
143
+ readonly onEventChangeResult?: (result: CalendarTransactionResult<TEvent, TEventId, TResourceId>, detail: CalendarProposalDetail) => void;
144
+ readonly onExpandedResourceIdsChange?: CalendarStateChangeHandler$1<readonly TResourceId[], "expandedResourceIds">;
145
+ readonly onFocusChange?: CalendarStateChangeHandler$1<TFocus | null, "focus">;
146
+ readonly onSelectionChange?: CalendarStateChangeHandler$1<TSelection | null, "selection">;
147
+ readonly onTimeZoneChange?: CalendarStateChangeHandler$1<string, "timeZone">;
148
+ readonly onViewChange?: CalendarStateChangeHandler$1<TViewDef["name"], "view">;
149
+ /**
150
+ * Called after the active view first shows its dates and whenever they, the view, or the time
151
+ * zone change, but not when only events do; once per change, and never on the server.
152
+ */
153
+ readonly onVisibleRangeChange?: (range: CalendarVisibleRange$1<TViewDef["name"]>) => void;
154
+ /** Run in order on every proposed change, after the built-in read-only check. */
155
+ readonly policies?: readonly CalendarPolicy<TEvent, TEventId, TResourceId>[];
156
+ readonly resources?: readonly TResource[];
157
+ /** Other time zones time grids label their hours in, beside the display time zone. */
158
+ readonly secondaryTimeZones?: readonly (CalendarSecondaryTimeZone | string)[];
159
+ readonly selection?: TSelection | null;
160
+ readonly store?: CalendarRootStore$1<TViewDef["name"], TSelection, TFocus, TResourceId>;
161
+ readonly view?: TViewDef["name"];
162
+ /** Per-view overrides of each registered view's `defaultOptions`. */
163
+ readonly viewOptions?: CalendarViewOptionsMap$1<TViewDef>;
164
+ readonly weekRules: CalendarWeekRules;
165
+ }
166
+ type CalendarRootAnchorProps = {
167
+ readonly anchorDate: Temporal.PlainDate;
168
+ readonly defaultAnchorDate?: Temporal.PlainDate;
169
+ } | {
170
+ readonly anchorDate?: undefined;
171
+ readonly defaultAnchorDate: Temporal.PlainDate;
172
+ };
173
+ type CalendarRootTimeZoneProps = {
174
+ readonly defaultTimeZone?: string;
175
+ readonly timeZone: string;
176
+ } | {
177
+ readonly defaultTimeZone: string;
178
+ readonly timeZone?: undefined;
179
+ };
180
+ /**
181
+ * `Root`'s props. Each of the six slices is controlled by its prop (`view`, `anchorDate`, …) or
182
+ * left to the calendar with its `default…` prop, and reports changes through `on…Change`. Pass
183
+ * them as JSX attributes or getters: Solid reads them where they are used, so a signal passed as
184
+ * `view={view()}` stays live.
185
+ */
186
+ type CalendarRootProps<TEvent, TResource, TViewDef extends AnyCalendarView = AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> = CalendarRootBaseProps<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId> & CalendarRootAnchorProps & CalendarRootTimeZoneProps & CalendarNowSource;
187
+ type ElementProps<Tag extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[Tag];
188
+ type CalendarFrameProps = Omit<ElementProps<"section">, "id">;
189
+ type CalendarToolbarProps = ElementProps<"header">;
190
+ type CalendarViewportProps = Omit<ElementProps<"div">, "id">;
191
+ type CalendarTitleProps = Omit<ElementProps<"span">, "id">;
192
+ type CalendarAccessibleName = {
193
+ readonly "aria-label": string;
194
+ readonly children?: JSX.Element;
195
+ } | {
196
+ readonly "aria-label"?: string;
197
+ readonly children: JSX.Element;
198
+ };
199
+ type CalendarTriggerProps = Omit<ElementProps<"button">, "children"> & CalendarAccessibleName;
200
+ type CalendarViewSwitcherProps<TView extends string = string> = Omit<ElementProps<"select">, "children" | "value"> & {
201
+ readonly getViewLabel: (view: TView) => string;
202
+ };
203
+ type CalendarAnnouncerProps = Omit<ElementProps<"div">, "children"> & {
204
+ /** What each phase says, in the calendar's language; read each time something is said. */
205
+ readonly messages: CalendarAnnouncementMessages;
206
+ };
207
+ interface CalendarEventRenderValue<TEvent, TEventId extends EventId, TResourceId extends ResourceId> {
208
+ readonly event: TEvent;
209
+ readonly normalized: NormalizedCalendarEvent<TEvent, TEventId, TResourceId>;
210
+ }
211
+ interface CalendarEventProps<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
212
+ /**
213
+ * Renders the event as the calendar shows it, pending changes included. It gets an accessor and
214
+ * stays rendered while the event changes, as `Show` does; read it where it is used.
215
+ */
216
+ readonly children: (value: Accessor<CalendarEventRenderValue<TEvent, TEventId, TResourceId>>) => JSX.Element;
217
+ readonly eventId: TEventId;
218
+ /** What shows while the calendar has no such event. */
219
+ readonly fallback?: JSX.Element;
220
+ }
221
+ interface CalendarActiveViewProps {
222
+ /** What shows while the active view is unregistered. */
223
+ readonly fallback?: JSX.Element;
224
+ }
225
+ interface CreateCalendarOptions<TEvent, TViewDef extends AnyCalendarView, TEventId extends EventId, TResourceId extends ResourceId> {
226
+ readonly eventAdapter: EventAdapter<TEvent, TEventId, TResourceId>;
227
+ readonly invalidEventPolicy?: InvalidCalendarEventPolicy;
228
+ readonly views?: readonly TViewDef[];
229
+ }
230
+ /**
231
+ * A typed calendar's parts and hooks. The hooks return accessors, as Solid's own primitives do:
232
+ * call them in a tracking scope to follow the calendar, or once to read it now.
233
+ */
234
+ interface CalendarFactory<TEvent, TResource, TViewDef extends AnyCalendarView = AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
235
+ /** Renders the active view's `Renderer` with its projection. */
236
+ readonly ActiveView: Component<CalendarActiveViewProps>;
237
+ /**
238
+ * A polite live region that speaks keyboard and pointer moves, resizes, and creates through
239
+ * `messages`. Render one inside `Root`.
240
+ */
241
+ readonly Announcer: Component<CalendarAnnouncerProps>;
242
+ /** Renders one event by its ID as the calendar shows it, or `fallback` without it. */
243
+ readonly Event: Component<CalendarEventProps<TEvent, TEventId, TResourceId>>;
244
+ /** A `section`: the calendar's frame, named by `label` or the title, which agents find. */
245
+ readonly Frame: Component<CalendarFrameProps>;
246
+ readonly NextTrigger: Component<CalendarTriggerProps>;
247
+ readonly PreviousTrigger: Component<CalendarTriggerProps>;
248
+ readonly Root: Component<CalendarRootProps<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>>;
249
+ /** A `span` with the active view's title, unless it has children of its own. */
250
+ readonly Title: Component<CalendarTitleProps>;
251
+ readonly TodayTrigger: Component<CalendarTriggerProps>;
252
+ readonly Toolbar: Component<CalendarToolbarProps>;
253
+ readonly Viewport: Component<CalendarViewportProps>;
254
+ /** A `select` of the registered views. */
255
+ readonly ViewSwitcher: Component<CalendarViewSwitcherProps<TViewDef["name"]>>;
256
+ readonly views: readonly TViewDef[];
257
+ useCalendar(): CalendarContextValue<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>;
258
+ /** The calendar's commands; the same object for the root's lifetime. */
259
+ useCalendarActions(): CalendarSemanticActions$1<TViewDef["name"], TSelection, TFocus, TResourceId, TEvent, TEventId>;
260
+ useCalendarMeta(): Accessor<CalendarMeta<TEvent, TResource, TViewDef, TEventId, TResourceId>>;
261
+ /**
262
+ * Proposals still validating or saving, and saved changes `events` don't show yet, by change ID
263
+ * in the order they were proposed. With a selector, whatever reads it re-runs only when its
264
+ * result changes, by `isEqual` (`Object.is` by default).
265
+ */
266
+ useCalendarPendingChanges(): Accessor<CalendarPendingChanges<TEvent, TEventId, TResourceId>>;
267
+ useCalendarPendingChanges<TSelected>(selector: CalendarStateSelector$1<CalendarPendingChanges<TEvent, TEventId, TResourceId>, TSelected>, options?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
268
+ /** A selection of the state; whatever reads it re-runs only when the selection changes. */
269
+ useCalendarSelector<TSelected>(selector: CalendarStateSelector$1<CalendarPublicState$1<TViewDef["name"], TSelection, TFocus, TResourceId>, TSelected>, options?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
270
+ useCalendarState(): Accessor<CalendarPublicState$1<TViewDef["name"], TSelection, TFocus, TResourceId>>;
271
+ /** The active view's projection, discriminated by `view`; `null` when it is unregistered. */
272
+ useViewProjection(): Accessor<CalendarActiveView$1<TViewDef> | null>;
273
+ /** The active view's visible dates; `null` when it is unregistered. */
274
+ useVisibleRange(): Accessor<PlainDateInterval | null>;
275
+ }
276
+ /**
277
+ * A polite live region that speaks keyboard and pointer moves, resizes, and creates in the
278
+ * calendar's locale through `messages`. Render one inside `Root`. `messages` is read when
279
+ * something is said, so a new set takes effect at once.
280
+ */
281
+ export declare function Announcer(props: CalendarAnnouncerProps): JSX.Element;
282
+ /**
283
+ * The announcer views pass to the pointer layer (`useCalendarPointer({ announcer })`), so pointer
284
+ * gestures are spoken by the same messages and its preview labels ranges the same way. The same
285
+ * object for the root's lifetime.
286
+ */
287
+ export declare function useCalendarAnnouncer(): CalendarAnnouncer;
288
+ /** The root's working hours, as an accessor: the calendar's, and each resource's on its zone. */
289
+ export declare function useCalendarAvailability(): Accessor<AvailabilitySnapshot>;
290
+ /**
291
+ * The closed time of each time-grid column, as bands on its 24-hour axis with their reasons: the
292
+ * calendar's, or with `resourceId` that resource's, on its own time zone. See
293
+ * `projectTimeGridAvailability`.
294
+ */
295
+ export declare function useTimeGridAvailability(columns: MaybeAccessor<readonly TimeGridColumn[]>, resourceId?: MaybeAccessor<ResourceId | null | undefined>): Accessor<readonly (readonly AvailabilityBand[])[]>;
296
+ /**
297
+ * The closed time along a timeline of `columns`: the calendar's, or with `resourceId` that
298
+ * resource's. See `projectTimelineAvailability`.
299
+ */
300
+ export declare function useTimelineAvailability(columns: MaybeAccessor<readonly TimeGridColumn[]>, resourceId?: MaybeAccessor<ResourceId | null | undefined>): Accessor<readonly AvailabilityExtent[]>;
301
+ /**
302
+ * The dates of `range` with no open time on their day in the display time zone: the calendar's,
303
+ * or with `resourceId` that resource's. See `closedDates`.
304
+ */
305
+ export declare function useClosedDates(range: MaybeAccessor<PlainDateInterval>, resourceId?: MaybeAccessor<ResourceId | null | undefined>): Accessor<ReadonlyMap<string, ClosedDate>>;
306
+ /**
307
+ * Creates a typed calendar, as `@moltenship/calendar-react`'s factory does. The first call fixes
308
+ * the application's record types; the second infers the view-name union and identifier types from
309
+ * `views` and `eventAdapter`. Its root, parts and hooks share a context no other factory reads, so
310
+ * a calendar inside another reads its own.
311
+ *
312
+ * ```ts
313
+ * const Calendar = createCalendar<Meeting>()({ eventAdapter, views: [monthView, listView] });
314
+ * ```
315
+ */
316
+ 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>;
317
+ type AnyDraft = CalendarDraft<EventId, ResourceId>;
318
+ interface CalendarBusyResourcesOptions {
319
+ /** An event to leave out, such as the one being moved. */
320
+ readonly exclude?: EventId | null;
321
+ /** Only these resources; every resource by default. */
322
+ readonly resourceIds?: readonly ResourceId[];
323
+ }
324
+ /**
325
+ * The resources busy during `range`, such as a meeting being placed, with their events, as an
326
+ * accessor; free ones are absent. It queries the root's events, pending changes included, once
327
+ * per change of events, range or options. `null` asks nothing.
328
+ */
329
+ export declare function useBusyResources(range: MaybeAccessor<InstantInterval | CalendarEventInterval | null>, options?: MaybeAccessor<CalendarBusyResourcesOptions>): Accessor<CalendarBusyResources>;
330
+ /** Reports the pointer's draft to the root, for `onPreview` of `useCalendarPointer`. */
331
+ export declare function useCalendarDraftReporter(): (draft: AnyDraft | null) => void;
332
+ /**
333
+ * The change being drafted, by pointer or keyboard, as an accessor: the event it changes (`null`
334
+ * when creating) and where it would land; `null` without one, and on the server and while
335
+ * hydrating. It changes once a slot step, so pass its `proposed` to `useBusyResources` for any
336
+ * "who's busy" UI of your own.
337
+ */
338
+ export declare function useCalendarDraft(): Accessor<AnyDraft | null>;
339
+ /**
340
+ * A resource during the draft's time while one is being made, by pointer or keyboard: the busy
341
+ * events that overlap it (the draft's own event aside; see `isBusy` on the event adapter), and
342
+ * whether the time falls outside its hours. `null` without a draft, or for a `null` resource.
343
+ * Whatever reads it updates only when its own resource's answer changes.
344
+ */
345
+ export declare function useDraftBusy(resourceId: MaybeAccessor<ResourceId | null>): Accessor<CalendarDraftBusy | null>;
346
+ /**
347
+ * Binds an event history to the nearest `Root`, as an accessor: undo and redo propose the inverse
348
+ * through the root's `proposeEventChange`, against the events the user sees, and with `messages`
349
+ * their outcomes are spoken through the root's `Announcer`. The history records through `Root`'s
350
+ * `onEventChangeResult`:
351
+ *
352
+ * ```tsx
353
+ * const history = createEventHistory<Meeting, string, string>();
354
+ * <Calendar.Root onEventChangeResult={history.record} …>
355
+ * <UndoButtons history={history} />
356
+ * </Calendar.Root>
357
+ * // Inside: const bound = useCalendarHistory(history, { messages });
358
+ * // <button disabled={!bound().canUndo} onClick={() => bound().undo()}>Undo</button>
359
+ * ```
360
+ *
361
+ * `messages` is read when a step runs. The server and hydration read an empty history.
362
+ */
363
+ export declare function useCalendarHistory<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(history: EventHistory<TEvent, TEventId, TResourceId>, options?: MaybeAccessor<CalendarHistoryOptions<NoInfer<TEvent>, NoInfer<TEventId>, NoInfer<TResourceId>>>): Accessor<CalendarHistory<TEvent, TEventId, TResourceId>>;
364
+ interface CalendarHistoryShortcutsOptions {
365
+ /** Listens for nothing while `true`. */
366
+ readonly disabled?: boolean;
367
+ /**
368
+ * Keys that redo, such as `"Shift+Mod+Z"`: modifiers joined by `+`, then the key. `Mod` is ⌘
369
+ * on Apple platforms and Ctrl elsewhere. `["Shift+Mod+Z", "Ctrl+Y"]` by default; `[]` turns
370
+ * them off.
371
+ */
372
+ readonly redo?: readonly string[];
373
+ /**
374
+ * The element whose keys undo and redo, usually the root's frame: `meta().refs.frame`, read
375
+ * inside the options' accessor. Keys elsewhere on the page are left alone.
376
+ */
377
+ readonly scope: MaybeAccessor<HTMLElement | null | undefined>;
378
+ /** Keys that undo; `["Mod+Z"]` by default, and `[]` turns them off. */
379
+ readonly undo?: readonly string[];
380
+ }
381
+ /**
382
+ * Undo and redo keys for a calendar: Mod+Z undoes, and Shift+Mod+Z or Ctrl+Y redoes, where Mod is
383
+ * ⌘ on Apple platforms and Ctrl elsewhere. While the hook's owner lives and it is enabled, one
384
+ * `keydown` listener on the document acts on keys whose target is inside `scope`, after the page's
385
+ * own handlers. Keys never undo in a text field, where the browser undoes the text, or in a
386
+ * dialog, menu or list inside the scope, nor during a keyboard or pointer gesture, nor once
387
+ * something else handled them. Commands pass `{ input: "keyboard" }`.
388
+ *
389
+ * `history` is `useCalendarHistory`'s accessor, or any object with `undo` and `redo`; it, the
390
+ * scope and the keys are read when a key arrives.
391
+ *
392
+ * ```ts
393
+ * const history = useCalendarHistory(eventHistory);
394
+ * const meta = Calendar.useCalendarMeta();
395
+ * useCalendarHistoryShortcuts(history, () => ({ scope: meta().refs.frame }));
396
+ * ```
397
+ */
398
+ export declare function useCalendarHistoryShortcuts(history: MaybeAccessor<CalendarHistoryShortcutsTarget>, options: MaybeAccessor<CalendarHistoryShortcutsOptions>): void;
399
+ /**
400
+ * Keyboard navigation and keyboard move, resize, and create for a view. Returns a ref for the
401
+ * element around its focusable cells and events (see `useRovingFocus`): `<div ref={keyboard}>`,
402
+ * or `ref={[keyboard, pointer]}` beside `useCalendarPointer`.
403
+ *
404
+ * - Arrow keys, Home, End, Page Up, and Page Down move focus through the view's
405
+ * `getSpatialNavigation`, navigating the view when focus leaves it. Enter moves into a cell's
406
+ * events and Escape back out.
407
+ * - Space grabs the focused event to move it, or the focused cell to create an event there;
408
+ * Shift+Space grabs an event's end to resize it, and again switches to its start. Navigation
409
+ * keys then step the gesture, Enter or Space commits it through `proposeEventChange`, and
410
+ * Escape, Tab, or leaving the view cancels it. On a root without `onEventChange`, Space grabs
411
+ * nothing.
412
+ *
413
+ * The ref listens for `keydown` and `focusout` on the element itself, not through Solid's
414
+ * delegation to the document, so Escape's stopped propagation keeps it from the handlers around
415
+ * the view. A delegated `onKeyDown` inside the view therefore runs after the calendar has taken
416
+ * its key; an element that takes a key for itself listens natively, from a ref, and calls
417
+ * `preventDefault()`, which the calendar respects. `options` is read whenever a key arrives.
418
+ * Every phase is announced through the root's `Announcer`, and a view that unmounts mid-gesture
419
+ * leaves nothing grabbed.
420
+ */
421
+ export declare function useCalendarKeyboard(options?: MaybeAccessor<CalendarKeyboardOptions>): (element: HTMLElement) => void;
422
+ /**
423
+ * The keyboard gesture in progress, or `null` while idle, as an accessor. Pass a selector to
424
+ * update only when its result changes, such as whether a cell is inside a create's range. The
425
+ * selector also gets what the root's policies say about committing the gesture now, to show an
426
+ * invalid preview.
427
+ */
428
+ export declare function useCalendarInteraction(): Accessor<CalendarKeyboardSession | null>;
429
+ export declare function useCalendarInteraction<TSelected>(selector: (session: CalendarKeyboardSession | null, check: CalendarInteractionCheck) => TSelected, options?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
430
+ /**
431
+ * Pointer move, resize, and create for a view region; see `attachCalendarPointer` for the data
432
+ * attributes the view renders. Returns a ref for the region element: `<div ref={pointer}>`, or
433
+ * `ref={[keyboard, pointer]}` beside `useCalendarKeyboard`. `options`, an object or an accessor
434
+ * of one, is read when a gesture starts, and `columns` again as it moves, so changing them never
435
+ * re-attaches listeners, and dragging never updates Solid. `disabled` is the exception: a
436
+ * disabled region doesn't listen for touch moves, so a read-only calendar's swipes never wait for
437
+ * its listener, and changing it attaches the listeners again. Everything is detached with the
438
+ * owner, a drag in progress included.
439
+ */
440
+ export declare function useCalendarPointer<TEvent, TEventId extends EventId, TResourceId extends ResourceId>(options: MaybeAccessor<CalendarPointerOptions$1<TEvent, TEventId, TResourceId>>): (element: HTMLElement) => void;
441
+ /**
442
+ * Calls `listener` whenever something asks the calendar for an anchor date: Previous, Next,
443
+ * Today, keys paging past the view, or `setAnchorDate`, even a date that is already the anchor.
444
+ * `range` is what the view on screen shows for that date, so a view can tell a request for the
445
+ * range it has, as Today in this week, from one that moves it. A view whose scroll position can
446
+ * run ahead of the anchor, as a scrolling view's does while a controlled anchor catches up, uses
447
+ * it to show its range again when asked. It listens for as long as its owner lives, never on the
448
+ * server.
449
+ */
450
+ export declare function useAnchorDateRequests(listener: (date: Temporal.PlainDate, range: PlainDateInterval | null) => void): void;
451
+ /**
452
+ * What an expansion command passes on to `onExpandedResourceIdsChange`: the DOM event behind it
453
+ * (so `onClick={toggle}` works) or a command's options. Its reason is `"resource-toggle"` unless
454
+ * the options give another.
455
+ */
456
+ type CalendarResourceExpansionCause = CalendarCommandOptions$1 | Event;
457
+ /**
458
+ * An expansion command. It reads a `CalendarResourceExpansionCause` from its argument and ignores
459
+ * any other value, so it fits a callback that passes something else, as a switch's change
460
+ * handler passes a boolean.
461
+ */
462
+ type CalendarResourceExpansionCommand = (cause?: unknown) => void;
463
+ interface CalendarResourceExpansion {
464
+ /** Whether the resource's children show; whatever reads it updates when that changes. */
465
+ readonly expanded: Accessor<boolean>;
466
+ readonly collapse: CalendarResourceExpansionCommand;
467
+ readonly expand: CalendarResourceExpansionCommand;
468
+ readonly toggle: CalendarResourceExpansionCommand;
469
+ }
470
+ /**
471
+ * The root's resources as a view shows them, as an accessor: depth first, with collapsed
472
+ * resources' descendants left out (see `visibleResources`). It changes when the resources or
473
+ * their expansion do.
474
+ */
475
+ export declare function useVisibleResources(options?: MaybeAccessor<ResourceVisibilityOptions>): Accessor<readonly VisibleResource[]>;
476
+ /**
477
+ * One resource's expansion and the commands that change it, through `expandedResourceIds`.
478
+ * `expanded` updates only when this resource expands or collapses, so a resource header can own
479
+ * its toggle. `resourceId` may be an accessor; each command acts on the resource it names then.
480
+ */
481
+ export declare function useResourceExpansion(resourceId: MaybeAccessor<ResourceId>): CalendarResourceExpansion;
482
+ interface CalendarRovingFocusOptions {
483
+ /** Dates an event element shows from `target.date`, such as a month segment's span. */
484
+ readonly days?: number;
485
+ }
486
+ /** Spread on the element, or pass each: `<button {...roving}>`. `tabindex` is a getter. */
487
+ interface CalendarRovingFocusProps {
488
+ readonly onFocus: (event: FocusEvent) => void;
489
+ readonly ref: (element: HTMLElement) => void;
490
+ readonly tabindex: 0 | -1;
491
+ }
492
+ /**
493
+ * Props for one focusable element of a view: a day cell, a slot, or an event. The view's one tab
494
+ * stop gets `tabindex={0}`; focusing an element makes it the calendar's focus, and keyboard
495
+ * navigation moves DOM focus to the new target, even when it renders in a new place. Only the
496
+ * elements whose tab stop changes update. `target` and `options` may be accessors, as a keyed
497
+ * `For` item's are; the element registers again when its target changes.
498
+ *
499
+ * The element stays registered until the hook's owner is disposed, as Solid never calls a ref
500
+ * with `null`: render it for as long as the component lives, and put `Show` around the component
501
+ * rather than around the element.
502
+ */
503
+ export declare function useRovingFocus(target: MaybeAccessor<CalendarFocus>, options?: MaybeAccessor<CalendarRovingFocusOptions>): CalendarRovingFocusProps;
504
+ /**
505
+ * Selects from the calendar's focus for a view's item, such as whether a slot cursor sits on this
506
+ * column, as an accessor; whatever reads it updates only when its result changes. Works inside
507
+ * any calendar's root.
508
+ */
509
+ export declare function useCalendarFocus<TSelected>(selector: (focus: CalendarFocus | null) => TSelected, options?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
510
+ /**
511
+ * Selects from the calendar's selection, as `useCalendarFocus` does from its focus:
512
+ * `useCalendarSelection((selection) => selection?.kind === "event" && selection.eventId === id)`.
513
+ */
514
+ export declare function useCalendarSelection<TSelected>(selector: (selection: CalendarSelection | null) => TSelected, options?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
515
+ /**
516
+ * Reads a selection from an external store as an accessor. Whatever reads it re-runs only when the
517
+ * selection changes by `isEqual`, and a selector that reads props or signals re-selects when they
518
+ * change too. Subscribes for as long as the current owner lives; on the server it reads the
519
+ * snapshot once and never subscribes, and while hydrating it reads the server snapshot until the
520
+ * tree settles, so the first client render matches the server's HTML.
521
+ *
522
+ * `source` may be an accessor of a source, for a store whose identity follows props, as a root's
523
+ * connection does: a new source is subscribed to before it is read, and the old one let go.
524
+ *
525
+ * The accessor follows Solid's scheduling: after the store changes, it reads the new selection once
526
+ * Solid flushes (a microtask, or `flush()`). Code that must see a change at once, like an event
527
+ * handler right after a command, reads `source.getSnapshot()` instead.
528
+ */
529
+ export declare function createStateSelector<TState, TSelected>(source: CalendarStateSource$1<TState> | Accessor<CalendarStateSource$1<TState>>, selector: CalendarStateSelector$1<TState, TSelected>, { isEqual }?: CalendarStateSelectorOptions$1<TSelected>): Accessor<TSelected>;
530
+ /**
531
+ * Whether a resource is within its working hours and whether its events occupy it, `at` an
532
+ * instant or now on the calendar's clock, as an accessor; see `resourceStatusAt`. Without
533
+ * `resourceId` it is the calendar's hours and every event. All-day and floating events count on
534
+ * the display time zone, as the views show them. On the clock it updates only when the status
535
+ * changes, and is `null` while server rendering and hydrating unless the calendar fixes `now`. A
536
+ * `null` resource turns it off, such as for the Unassigned column, with nothing computed or
537
+ * scheduled.
538
+ */
539
+ export declare function useResourceStatus(resourceId?: MaybeAccessor<ResourceId | null | undefined>, at?: MaybeAccessor<Temporal.Instant | undefined>): Accessor<CalendarResourceStatus | null>;
540
+ interface UseNowOptions {
541
+ /** How often the clock is sampled. Defaults to one minute. */
542
+ readonly intervalMs?: number;
543
+ }
544
+ /**
545
+ * The current instant from the nearest calendar's `now` or `clock`, as an accessor; outside a
546
+ * calendar, the system clock's. It is `null` during server rendering and hydration unless the
547
+ * calendar fixes `now`.
548
+ */
549
+ export declare function useNow(options?: MaybeAccessor<UseNowOptions>): Accessor<Temporal.Instant | null>;
550
+ export { type AnyCalendarView, type CalendarActions, type CalendarActiveView, type CalendarActiveViewProps, type CalendarAgentEvent, type CalendarAnnotations, type CalendarAnnouncerProps, type CalendarBusyResources, type CalendarBusyResourcesOptions, type CalendarChangeReason, type CalendarChangeSource, type CalendarCommandOptions, type CalendarContextValue, type CalendarControlledState, type CalendarDiagnostic, type CalendarDraftBusy, type CalendarDragFollower, type CalendarDragMonitor, type CalendarDragPreview, type CalendarDropOptions, type CalendarDropSession, type CalendarDropSource, type CalendarEventDrag, 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 CalendarKeyboardOptions, type CalendarMeta, type CalendarPartIds, type CalendarPartRefs, type CalendarPoint, type CalendarPointerOptions, type CalendarPublicState, type CalendarRect, type CalendarRegion, 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 CalendarStateSource, 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 MaybeAccessor, type UseNowOptions, attachCalendarPointer, createCalendarStore, eventIdAttributes, eventIdOf, monitorCalendarDrags, observeCalendarRegions, resolveViewOptions, resourceIdAttributes, resourceIdOf, startCalendarDrop };