@moltenship/calendar 1.0.0-rc.2 → 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.
Files changed (70) hide show
  1. package/README.md +24 -4
  2. package/dist/index.d.mts +2 -2
  3. package/docs/accessibility.md +304 -0
  4. package/docs/agents/changes.md +449 -0
  5. package/docs/agents/coding-agents.md +117 -0
  6. package/docs/agents/connect.md +435 -0
  7. package/docs/agents/deleting.md +296 -0
  8. package/docs/agents/reference.md +512 -0
  9. package/docs/agents/server.md +317 -0
  10. package/docs/agents/webmcp.md +153 -0
  11. package/docs/agents.md +353 -0
  12. package/docs/annotations.md +196 -0
  13. package/docs/api/changes.md +248 -0
  14. package/docs/api/dnd-kit.md +267 -0
  15. package/docs/api/events.md +152 -0
  16. package/docs/api/ics.md +524 -0
  17. package/docs/api/primitives.md +168 -0
  18. package/docs/api/react.md +236 -0
  19. package/docs/api/recurrence.md +586 -0
  20. package/docs/api/solid.md +460 -0
  21. package/docs/api/store.md +92 -0
  22. package/docs/api/temporal.md +172 -0
  23. package/docs/api.md +57 -0
  24. package/docs/availability.md +573 -0
  25. package/docs/comparison.md +279 -0
  26. package/docs/concepts/anatomy.md +73 -0
  27. package/docs/concepts/events.md +164 -0
  28. package/docs/concepts/how-it-works.md +95 -0
  29. package/docs/concepts/recurrence.md +127 -0
  30. package/docs/concepts/state.md +244 -0
  31. package/docs/concepts/time.md +170 -0
  32. package/docs/guides/dnd-kit.md +333 -0
  33. package/docs/guides/google-calendar-sync.md +1246 -0
  34. package/docs/guides/google-calendar.md +367 -0
  35. package/docs/guides/ics.md +486 -0
  36. package/docs/guides/motion.md +414 -0
  37. package/docs/guides/nextjs-app-router.md +630 -0
  38. package/docs/guides/nextjs.md +149 -0
  39. package/docs/guides/performance.md +103 -0
  40. package/docs/guides/recurring-events.md +583 -0
  41. package/docs/guides/tanstack-query.md +485 -0
  42. package/docs/index.md +118 -0
  43. package/docs/installation.md +194 -0
  44. package/docs/interactions.md +408 -0
  45. package/docs/llms.txt +86 -0
  46. package/docs/migrating-to-2.md +322 -0
  47. package/docs/quick-start.md +159 -0
  48. package/docs/stylex.md +265 -0
  49. package/docs/testing.md +581 -0
  50. package/docs/theme-builder.md +81 -0
  51. package/docs/theming.md +169 -0
  52. package/docs/undo-redo.md +339 -0
  53. package/docs/views/agenda.md +221 -0
  54. package/docs/views/custom-views.md +192 -0
  55. package/docs/views/month.md +109 -0
  56. package/docs/views/resource-columns.md +261 -0
  57. package/docs/views/resource-timeline.md +225 -0
  58. package/docs/views/scrolling.md +192 -0
  59. package/docs/views/week-and-day.md +257 -0
  60. package/docs/views/year.md +138 -0
  61. package/docs/views.md +69 -0
  62. package/package.json +41 -14
  63. package/skills/moltenship-time/SKILL.md +75 -0
  64. package/skills/moltenship-time/references/agent-ready.md +272 -0
  65. package/skills/moltenship-time/references/changes.md +188 -0
  66. package/skills/moltenship-time/references/compose.md +168 -0
  67. package/skills/moltenship-time/references/mistakes.md +98 -0
  68. package/skills/moltenship-time/references/solid.md +202 -0
  69. package/skills/moltenship-time/references/state.md +129 -0
  70. package/skills/moltenship-time/references/testing.md +176 -0
package/docs/llms.txt ADDED
@@ -0,0 +1,86 @@
1
+ # Moltenship Time
2
+
3
+ > A headless calendar for React, with a Solid preview: week, day, month, year, agenda and resource views, drag and keyboard editing, time zones and recurrence, built on ui-sdk so an AI agent can read the calendar and act on it.
4
+
5
+ These are the docs for @moltenship/calendar 2.0.0-beta.1, as Markdown. Each link below is a file beside this one. They're generated from the same source as https://time.molten.sh/docs, where the live examples run.
6
+
7
+ Read this index first, then only the pages your task needs. To let an AI agent operate a calendar, start at [Agents](./agents.md). The exact API is in the package's `.d.mts` types.
8
+
9
+ ## Docs
10
+
11
+ - [Introduction](./index.md): A headless calendar for React 19, built on the Temporal API, with views you copy and own and actions an AI agent can call.
12
+ - [Installation](./installation.md): Requirements, packages, the ui-sdk peer dependencies, and Temporal setup.
13
+ - [Quick start](./quick-start.md): Build a week, day, month, and agenda calendar with the built-in views.
14
+ - [Interactions](./interactions.md): Save moved, resized, created, and deleted events, show them while they save, and decide which changes to allow.
15
+ - [Undo and redo](./undo-redo.md): Record the changes people make, and take them back through the same pipeline that saved them.
16
+ - [Annotations](./annotations.md): Time-based information beside events, such as listening history, sleep, workouts and focus sessions.
17
+ - [Availability](./availability.md): Working hours, closed days and holidays, people and rooms in their own time zones, shading you can restyle, a busy or free status, and policies that keep bookings inside working hours and rooms from being double-booked.
18
+ - [Accessibility](./accessibility.md): The keyboard map, screen reader announcements, the ARIA patterns each view uses, reduced motion, and right-to-left layout.
19
+ - [Theming](./theming.md): Calendar color tokens, dark mode, and the event color palette.
20
+ - [StyleX](./stylex.md): The calendar's views styled with StyleX and Astryx, for apps without Tailwind.
21
+ - [Testing](./testing.md): Test the calendar you built with a fixed clock, typed builders, a render harness, and keyboard and pointer drivers.
22
+
23
+ ## Concepts
24
+
25
+ - [Anatomy](./concepts/anatomy.md): The parts a calendar is built from, and their names in code.
26
+ - [Events and adapters](./concepts/events.md): How Time reads your event records, and what happens when one is invalid.
27
+ - [Time and time zones](./concepts/time.md): Timed, all-day, and floating events, exclusive end times, and daylight saving time.
28
+ - [State](./concepts/state.md): Let the calendar own its state, or control it from your app, one value at a time.
29
+ - [Recurring events](./concepts/recurrence.md): Series, exceptions and overrides, how each series keeps its own time, occurrence IDs, and what "this", "following" and "all" change.
30
+ - [How it works](./concepts/how-it-works.md): The packages, and how your events become a rendered view.
31
+
32
+ ## Views
33
+
34
+ - [Overview](./views.md): How views work, how to switch between them, and which ones exist today.
35
+ - [Week and day](./views/week-and-day.md): Time-grid views with an all-day row, a current-time line, and DST-aware hours.
36
+ - [Month](./views/month.md): A month grid with multi-day bars and a "+N more" popover.
37
+ - [Year](./views/year.md): Twelve months at a glance, with a dot for each event color on a day and a popover of its events.
38
+ - [Scrolling views](./views/scrolling.md): Week, day and month views that scroll without end, swiping a page at a time.
39
+ - [Agenda](./views/agenda.md): A chronological list of upcoming events, grouped by day, and a version that scrolls through months or years.
40
+ - [Resource columns](./views/resource-columns.md): A day or a few days of rooms or people side by side, grouped by team, with hundreds of columns.
41
+ - [Resource timeline](./views/resource-timeline.md): Rooms or people as rows and time as columns, for a day, a week or a month, with hundreds of rows.
42
+ - [Custom views](./views/custom-views.md): Define a view with a pure strategy and a Renderer component.
43
+
44
+ ## Agents
45
+
46
+ - [Agents](./agents.md): What an AI agent sees of your calendar, what it can do to it, and where your app stays in charge.
47
+ - [Connect an agent](./agents/connect.md): Create the agent bridge, name your calendar, and decide which actions an agent may run.
48
+ - [Who made a change](./agents/changes.md): Tell an agent's change from a person's, refuse it with a policy, and undo it without touching what the person did.
49
+ - [Deleting](./agents/deleting.md): Let an agent delete an event only after the person on the page says yes.
50
+ - [WebMCP](./agents/webmcp.md): Hand the calendar's tools to the agent built into a browser, with rules of their own for an agent you didn't write.
51
+ - [A model on your server](./agents/server.md): Give a model the bridge's tool definitions from your server, and run its tool calls on the calendar in the browser.
52
+ - [Agent reference](./agents/reference.md): Every action an agent can call on a calendar, with its arguments, results and errors, and every field of the calendar's snapshot entry.
53
+ - [Build with a coding agent](./agents/coding-agents.md): Give Claude Code, Cursor or another coding agent these docs as Markdown, and a skill that teaches it the library.
54
+
55
+ ## Guides
56
+
57
+ - [Next.js and server rendering](./guides/nextjs.md): Fetch events in a Server Component and render the same calendar on the server and in the browser.
58
+ - [Next.js App Router example](./guides/nextjs-app-router.md): A calendar whose view and date live in the URL, loaded by a Server Component and saved through Server Actions.
59
+ - [Show an ICS feed](./guides/ics.md): Parse a Google, Outlook or iCloud feed on the server and show its events in the calendar.
60
+ - [Show and edit recurring events](./guides/recurring-events.md): Expand series for the dates on screen, and ask which events a change applies to.
61
+ - [Google Calendar events](./guides/google-calendar.md): Read recurring events from the Google Calendar API, with their RRULE, EXDATE and RDATE lines, and show and edit them.
62
+ - [Sync with Google Calendar](./guides/google-calendar-sync.md): Load a Google calendar from the dates on screen, keep it current with sync tokens, and write changes back with etags.
63
+ - [Load events with TanStack Query](./guides/tanstack-query.md): Fetch the dates the calendar shows with useQuery, and save its changes with useMutation and optimistic updates.
64
+ - [Drag tasks in with dnd-kit](./guides/dnd-kit.md): Drag a backlog of your own into the calendar, and meetings back out, with dnd-kit and @moltenship/calendar-dnd-kit.
65
+ - [Animate with Motion](./guides/motion.md): Grow a clicked meeting into its card and let a card follow each drag, with Motion and the calendar's own hooks.
66
+ - [Performance](./guides/performance.md): Where Time does its work, and how to keep that work small.
67
+
68
+ ## API reference
69
+
70
+ - [Overview](./api.md): What each package exports, and where to import it from.
71
+ - [React components and hooks](./api/react.md): createCalendar, Root and its props, the components, hooks, meta, and diagnostics.
72
+ - [Events and snapshots](./api/events.md): Adapters, event ranges, validation, snapshots, and queries.
73
+ - [Event changes](./api/changes.md): Proposals, changes, results, policies, placement helpers, and the pointer layer.
74
+ - [State store](./api/store.md): Create calendar state outside Root, and change it from anywhere in your app.
75
+ - [Temporal helpers](./api/temporal.md): Ranges, date and time grids, rounding, day boundaries, and DST from @moltenship/calendar-temporal.
76
+ - [iCalendar (ICS)](./api/ics.md): Parse ICS feeds and files into typed Temporal values with @moltenship/ics.
77
+ - [Recurrence](./api/recurrence.md): Expand recurring series for the dates on screen, and edit one occurrence, the following ones or all of them, with @moltenship/calendar-recurrence.
78
+ - [dnd-kit adapter](./api/dnd-kit.md): Drag your own dnd-kit items into the calendar, and calendar events out to your droppables, with @moltenship/calendar-dnd-kit.
79
+ - [Primitives](./api/primitives.md): The framework-free layer under the React and Solid integrations, the calendar as a ui-sdk primitive, and the types of its agent actions.
80
+ - [Solid](./api/solid.md): The SolidJS 2 integration, a preview. What it has, how it differs from React, and what isn't in it yet.
81
+
82
+ ## Optional
83
+
84
+ - [Comparison](./comparison.md): How Time compares with FullCalendar and react-big-calendar, as of October 2026.
85
+ - [Migrating to 2.0](./migrating-to-2.md): What changes between Time 1.x and 2.0, and what to do about each change.
86
+ - [Theme builder](./theme-builder.md): Change the calendar's tokens in light and dark, see them live, and copy the CSS or a StyleX theme.
@@ -0,0 +1,322 @@
1
+ # Migrating to 2.0
2
+
3
+ What changes between Time 1.x and 2.0, and what to do about each change.
4
+
5
+ Source: https://time.molten.sh/docs/migrating-to-2
6
+
7
+ 2.0 rebuilds the calendar's parts on [ui-sdk](https://ui-sdk.dev). That gives the calendar an
8
+ [agent surface](./agents.md) and a second framework, [Solid](./api/solid.md). The engine didn't
9
+ move: dates, time zones, recurrence, layouts, transactions and policies work as they did.
10
+
11
+ For most apps the upgrade is two more packages to install. The rest of this page is for code that
12
+ names the types 2.0 widened.
13
+
14
+ > **2.0 is a pre-release**
15
+ >
16
+ > Its API can still change before 2.0.0, and ui-sdk is in beta. Stay on 1.x if you need a stable API
17
+ > today: it keeps the shape it has.
18
+
19
+ ## In short
20
+
21
+ | Change | Do this | Who it affects |
22
+ | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
23
+ | `@ui-sdk/core` and `@ui-sdk/react` are peer dependencies | [Install them](#install-the-new-peer-dependencies) | Everyone |
24
+ | `CalendarInputMethod` has a fourth value, `"agent"` | [Handle it](#handle-the-agent-input) | Code that switches on `detail.input` |
25
+ | `onEventChange` and policies get the proposal's detail, with `fields` | [Check handlers with a second parameter](#handlers-and-policies-hear-who-proposed) | Handlers with an optional second parameter, and code that calls a typed handler |
26
+ | The toolbar parts and the frame render a `data-slot` attribute | [Check selectors on `data-slot="calendar"`](#the-parts-have-data-slot) | Apps with shadcn's date picker, or such CSS |
27
+ | State handlers hear `reason`, `source`, `event` and can `cancel()` | Nothing. [Use it](#state-handlers-hear-why-and-who) | Code that builds a `detail` by hand, in tests |
28
+ | Actions take options last | [Wrap an action used as an event handler](#actions-take-options) | Code such as `onClick={actions.navigateNext}` |
29
+ | `Root` has `label`, `allowAgentDelete` and `formatAgentEventLabel` | [Name your calendar](#name-the-calendar) | Apps that want agents, or a fixed name |
30
+ | The store and state types moved to `@moltenship/calendar-primitives` | Nothing: [the old imports still work](#new-packages) | Nobody |
31
+
32
+ What didn't change: the engine, the registry's views, the `data-calendar-part` attributes and the
33
+ other attributes your CSS and tests target, the keyboard model, and every hook's name and return
34
+ value. The parts gained one attribute, [`data-slot`](#the-parts-have-data-slot).
35
+
36
+ ## Install the new peer dependencies
37
+
38
+ **pnpm**
39
+
40
+ ```bash
41
+ pnpm add @moltenship/calendar @ui-sdk/core @ui-sdk/react
42
+ ```
43
+
44
+ **npm**
45
+
46
+ ```bash
47
+ npm install @moltenship/calendar @ui-sdk/core @ui-sdk/react
48
+ ```
49
+
50
+ **yarn**
51
+
52
+ ```bash
53
+ yarn add @moltenship/calendar @ui-sdk/core @ui-sdk/react
54
+ ```
55
+
56
+ **bun**
57
+
58
+ ```bash
59
+ bun add @moltenship/calendar @ui-sdk/core @ui-sdk/react
60
+ ```
61
+
62
+ - **`react-dom` is needed too.** `@ui-sdk/react` has it as a peer dependency. A React app on the web
63
+ already has it.
64
+ - **Install the 2.0 version of every `@moltenship/*` package you use.** They share one version,
65
+ and a 1.x package beside a 2.0 one brings a second copy of the engine.
66
+ - **`@moltenship/calendar-testing` has the same two peers.** A project that tests with it needs
67
+ nothing more once the app has them.
68
+ - **`shadcn add` doesn't install them.** The registry's items list `@moltenship/calendar` and not
69
+ the ui-sdk packages, so an app set up from the registry alone adds them by hand.
70
+ - **Keep one copy of `@ui-sdk/core`.** The calendar and an [agent bridge](./agents/connect.md)
71
+ find each other through it. Your package manager keeps one as long as every `@ui-sdk/*` package
72
+ is on the same version; `pnpm why @ui-sdk/core` shows whether it did.
73
+
74
+ The calendar takes `@ui-sdk/core` and `@ui-sdk/react` from `0.1.0-beta.16` on, within the 0.1
75
+ line.
76
+
77
+ ## Handle the agent input
78
+
79
+ `CalendarInputMethod` was `"pointer" | "keyboard" | "api"`. It's now
80
+ `"pointer" | "keyboard" | "api" | "agent"`. The value is the `input` of the detail that
81
+ `onEventChangeResult` gets, and of a history step.
82
+
83
+ Code that only compares, such as `detail.input === "keyboard"`, keeps working. A `switch` that
84
+ TypeScript checks for every case stops compiling until it has the fourth:
85
+
86
+ ```ts title="input-label.ts"
87
+ import type { CalendarInputMethod } from "@moltenship/calendar";
88
+
89
+ export function inputLabel(input: CalendarInputMethod): string {
90
+ switch (input) {
91
+ case "pointer":
92
+ return "Dragged";
93
+ case "keyboard":
94
+ return "Moved with the keyboard";
95
+ case "api":
96
+ return "Changed from a form";
97
+ // New in 2.0: an AI agent proposed the change.
98
+ case "agent":
99
+ return "Changed by the assistant";
100
+ }
101
+ }
102
+ ```
103
+
104
+ No agent proposes anything until your app creates a bridge, so `"agent"` never arrives in an app
105
+ that doesn't opt in. In one that does, `"agent"` is the input of everything an agent's step
106
+ causes. That includes a `proposeEventChange` your own button's handler makes when an agent
107
+ presses the button, which a person's click still reports as `"api"`.
108
+
109
+ An [event history](./undo-redo.md) records every input by default, and now that includes an
110
+ agent's. To leave an agent's changes out of undo, list the inputs you want:
111
+
112
+ ```ts title="history.ts"
113
+ import { createEventHistory } from "@moltenship/calendar";
114
+
115
+ import type { Meeting } from "./calendar";
116
+
117
+ // Undo and redo take back what people did, and leave an agent's changes alone.
118
+ export const history = createEventHistory<Meeting, string, never>({
119
+ inputs: ["pointer", "keyboard", "api"],
120
+ });
121
+ ```
122
+
123
+ ## Handlers and policies hear who proposed
124
+
125
+ In 1.x only `onEventChangeResult` got the proposal's detail. In 2.0 `onEventChange` gets it as a
126
+ second argument, and a policy as `detail` in its second argument. Handlers that take one argument
127
+ are unchanged.
128
+
129
+ ```tsx title="saving.tsx"
130
+ "use client";
131
+
132
+ import type { CalendarPolicy } from "@moltenship/calendar";
133
+ import { useState } from "react";
134
+
135
+ import { applyChange } from "./agent-save";
136
+ import { Calendar, meetings as initialMeetings, weekRules, type Meeting } from "./calendar";
137
+
138
+ // `detail` is absent when your own code calls a policy outside a proposal.
139
+ const noAgentDeletes: CalendarPolicy<Meeting, string, never> = (change, { detail }) =>
140
+ change.cause === "delete" && detail?.input === "agent"
141
+ ? { type: "reject", reason: "a-person-deletes-meetings" }
142
+ : { type: "accept" };
143
+
144
+ export function SavingCalendar() {
145
+ const [meetings, setMeetings] = useState(initialMeetings);
146
+
147
+ return (
148
+ <Calendar.Root
149
+ events={meetings}
150
+ onEventChange={(change, detail) => {
151
+ if (detail.input === "agent") console.info(`The assistant proposed a ${change.cause}.`);
152
+ setMeetings((current) => applyChange(current, change, detail));
153
+ }}
154
+ policies={[noAgentDeletes]}
155
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
156
+ defaultTimeZone="Europe/Berlin"
157
+ locale="en-US"
158
+ weekRules={weekRules}
159
+ >
160
+ <Calendar.ActiveView />
161
+ </Calendar.Root>
162
+ );
163
+ }
164
+ ```
165
+
166
+ Two kinds of code do change:
167
+
168
+ - **A handler with a second parameter of its own.** 1.x called `onEventChange` with the change
169
+ alone. A function passed directly, as `onEventChange={save}` where `save` is
170
+ `(change, options?) => …`, now receives the detail as `options`. TypeScript reports it when the
171
+ two types differ, and stays silent when `options` is loose enough to take a detail. Wrap the
172
+ call: `onEventChange={(change) => save(change)}`.
173
+ - **Code that calls a typed handler.** `CalendarEventChangeHandler` now has two parameters, and
174
+ `detail` is required. A test or a wrapper that calls such a handler with one argument stops
175
+ compiling. Pass a detail: `handler(change, { input: "api" })`.
176
+
177
+ `applyChange` and `calendar.tsx` are the ones from [Connect an agent](./agents/connect.md#name-the-calendar)
178
+ and the [Quick start](./quick-start.md).
179
+
180
+ The detail has a new optional member, `fields`: what a change says beside where the event goes.
181
+ An agent's `createEvent` and `updateEvent` put the title there, and whatever else the agent sent.
182
+ A person's gestures send none, so a handler that ignores `detail` saves a person's changes as it
183
+ did. It saves an agent's too, but without the title, which is why `applyChange` above takes the
184
+ detail. See [Save what the agent sent](./agents/connect.md#save-what-the-agent-sent).
185
+
186
+ `actions.checkEventChange(proposal, detail?)` takes the detail as well, so a preview can ask the
187
+ policies the question the real proposal will.
188
+
189
+ A policy you call yourself, in a unit test for example, has a context type with one more optional
190
+ field. Code that builds the context as `{ events, timeZone }` still compiles.
191
+
192
+ ## State handlers hear why and who
193
+
194
+ The second argument of `onViewChange`, `onAnchorDateChange` and the other four state handlers had
195
+ `previous`, `controlled` and `slice`. It now also has:
196
+
197
+ | Field | Contents |
198
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
199
+ | `reason` | `"next-press"`, `"previous-press"`, `"today-press"`, `"input-change"`, `"keyboard-navigation"`, `"focus-change"`, `"resource-toggle"` or `"imperative"` |
200
+ | `source` | `"mouse"`, `"touch"`, `"pen"`, `"keyboard"`, `"virtual"`, `"programmatic"` or `"agent"` |
201
+ | `event` | The DOM event, when one of the calendar's own controls caused the change |
202
+ | `cancel()` | Keeps the value as it was |
203
+ | `canceled` | Whether a handler cancelled |
204
+
205
+ `"keyboard"` is a person's keys, on a toolbar button and in a view: arrow-key navigation, moving
206
+ focus and expanding a resource report it. `"programmatic"` is a call from your own code, and
207
+ `"agent"` anything an [agent's step](./agents/changes.md#two-kinds-of-change) causes.
208
+
209
+ Handlers still run when they did: before a controlled value changes, since your handler is what
210
+ changes it, and after an uncontrolled one. `cancel()` puts an uncontrolled value back.
211
+ [State](./concepts/state.md#what-a-handler-hears) has an example.
212
+
213
+ This breaks one thing: a test or a wrapper that builds a `CalendarStateChangeDetail` object by
214
+ hand. Add the new fields, or let the calendar make the detail by calling an action.
215
+
216
+ ## Actions take options
217
+
218
+ `setView`, `setAnchorDate`, `setTimeZone`, `setSelection`, `setFocus`, `setExpandedResourceIds`,
219
+ `navigateNext`, `navigatePrevious` and `navigateToday` take an options object last:
220
+ `{ event?, reason?, source? }`. It says why the app made the call, and a state handler reads it
221
+ back.
222
+
223
+ Calls without it are unchanged. One pattern stops compiling: a navigation action passed directly
224
+ as an event handler. TypeScript reports that the click event "has no properties in common with
225
+ type `CalendarCommandOptions`". Wrap the call, and pass the event if a handler should hear it:
226
+
227
+ ```tsx title="next-button.tsx"
228
+ "use client";
229
+
230
+ import { Calendar } from "./calendar";
231
+
232
+ export function NextButton() {
233
+ const actions = Calendar.useCalendarActions();
234
+
235
+ return (
236
+ // Before: onClick={actions.navigateNext}. The click isn't the options object.
237
+ <button type="button" onClick={(event) => actions.navigateNext({ event: event.nativeEvent })}>
238
+ Next
239
+ </button>
240
+ );
241
+ }
242
+ ```
243
+
244
+ `Calendar.NextTrigger`, `Calendar.PreviousTrigger` and `Calendar.TodayTrigger` already do this.
245
+
246
+ ## The parts have `data-slot`
247
+
248
+ `Calendar.Frame` and the toolbar parts are ui-sdk slots now, and each renders a `data-slot`
249
+ attribute beside its `data-calendar-part`:
250
+
251
+ | Part | `data-slot` |
252
+ | ----------------- | --------------------------- |
253
+ | `Frame` | `calendar` |
254
+ | `Toolbar` | `calendar-toolbar` |
255
+ | `Title` | `calendar-title` |
256
+ | `Viewport` | `calendar-viewport` |
257
+ | `PreviousTrigger` | `calendar-previous-trigger` |
258
+ | `TodayTrigger` | `calendar-today-trigger` |
259
+ | `NextTrigger` | `calendar-next-trigger` |
260
+ | `ViewSwitcher` | `calendar-view-switcher` |
261
+
262
+ They matter when your app already targets one of those names, and `calendar` is the likely one:
263
+ shadcn's date picker renders `data-slot="calendar"` on its root. A rule such as `[data-slot="calendar"] { … }`, or a test's
264
+ `querySelector('[data-slot="calendar"]')`, written for the date picker now matches the scheduler's
265
+ frame too. Scope such a selector to the date picker, or select the scheduler by
266
+ `data-calendar-part="frame"`.
267
+
268
+ ## Name the calendar
269
+
270
+ `Root` takes three new props:
271
+
272
+ | Prop | Effect |
273
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
274
+ | `label` | Names the calendar. `Calendar.Frame` takes it as its `aria-label`, and an agent finds the calendar by it |
275
+ | `allowAgentDelete` | Gives an agent the `deleteEvent` action. Off by default: the calendar has no such action then, and refuses any delete an agent causes |
276
+ | `formatAgentEventLabel` | Names each visible event in the list an agent reads. By default the title and ISO times |
277
+
278
+ Without `label`, the frame is labelled by the title, as in 1.x, so nothing changes for a screen
279
+ reader until you set it. With `label`, the frame's name is the label and the title is no longer
280
+ part of it. `useCalendarMeta()` has the label as `meta.label`.
281
+
282
+ ## Make it agent-ready
283
+
284
+ Upgrading exposes nothing. An agent reaches a calendar only after your app creates a bridge.
285
+ When you want that:
286
+
287
+ 1. Give `Root` a `label`.
288
+ 2. Render `Calendar.Frame` inside `Root`. A calendar without a frame works for people and isn't
289
+ listed for agents.
290
+ 3. Read `detail.fields` in `onEventChange`, so a title an agent sends is saved. See
291
+ [Save what the agent sent](./agents/connect.md#save-what-the-agent-sent).
292
+ 4. Create the bridge with an `allow`, as [Connect an agent](./agents/connect.md) shows.
293
+
294
+ A calendar without `onEventChange` gives an agent the reading and navigation actions and no
295
+ event action, as it gives a person no editing.
296
+
297
+ ## New packages
298
+
299
+ | Package | What it is | Install it when |
300
+ | --------------------------------- | ------------------------------------------------------ | --------------------------------- |
301
+ | `@moltenship/calendar-primitives` | The framework-free runtime, store and ui-sdk primitive | You write a framework integration |
302
+ | `@moltenship/calendar-solid` | The Solid integration, a preview | Your app is on SolidJS 2 |
303
+
304
+ `createCalendarStore`, `resolveViewOptions` and the state types moved from
305
+ `@moltenship/calendar-react` into the primitives. Both `@moltenship/calendar` and
306
+ `@moltenship/calendar-react` re-export them, so imports from either still work and a store you
307
+ created keeps its contract. See [Primitives](./api/primitives.md).
308
+
309
+ ## Tests
310
+
311
+ - **Scripted clicks.** A click a test dispatches reads `source: "programmatic"` in a state
312
+ handler. Only a real pointer reads `"mouse"`.
313
+ - **The frame's name.** A test that finds the frame by its accessible name finds the `label` once
314
+ you set one.
315
+ - **Agent changes.** [Testing](./testing.md#changes-an-agent-makes) shows how to run an agent's
316
+ step in a test.
317
+
318
+ ## For coding agents
319
+
320
+ If a coding agent does the upgrade, give it the docs for the version you install. They ship in the
321
+ package, at `node_modules/@moltenship/calendar/docs`, with a skill beside them. See
322
+ [Build with a coding agent](./agents/coding-agents.md).
@@ -0,0 +1,159 @@
1
+ # Quick start
2
+
3
+ Build a week, day, month, and agenda calendar with the built-in views.
4
+
5
+ Source: https://time.molten.sh/docs/quick-start
6
+
7
+ You'll build this calendar: a toolbar, a view switcher, and the built-in week, day, month, and
8
+ agenda views, showing your own meetings.
9
+
10
+ > Live example: see it at https://time.molten.sh/docs/quick-start
11
+
12
+ To see these views running with more data before you start, open the [live demo](https://moltenship-time-demo.vercel.app).
13
+
14
+ **Step 1**
15
+
16
+ ### Install
17
+
18
+ Install `@moltenship/calendar` as described in [Installation](./installation.md), including
19
+ `Temporal` if your browsers need it.
20
+
21
+ **Step 2**
22
+
23
+ ### Add the UI source
24
+
25
+ The views are source files that you add to your app with the shadcn CLI. They're built on
26
+ shadcn/ui and its default Base UI primitives, so your app needs a Base UI style (see
27
+ [UI source](./installation.md#ui-source-optional)). Add the week and day, month, and agenda views:
28
+
29
+ ```bash
30
+ npx shadcn@latest add \
31
+ https://time.molten.sh/r/time-grid-view.json \
32
+ https://time.molten.sh/r/month-view.json \
33
+ https://time.molten.sh/r/list-view.json
34
+ ```
35
+
36
+ They bring the theme, the toolbar, view switcher and event chip from the shared `calendar` item,
37
+ and the shadcn components they use. The files land in `components/calendar/`.
38
+
39
+ **Step 3**
40
+
41
+ ### Create the calendar
42
+
43
+ Describe your records with an adapter, then create a calendar with the views you want. The first
44
+ view in the list is shown first.
45
+
46
+ ```tsx title="calendar.tsx"
47
+ "use client";
48
+
49
+ import { createCalendar, defineEventAdapter } from "@moltenship/calendar";
50
+
51
+ import { CalendarToolbar } from "@/components/calendar/calendar-toolbar";
52
+ import type { CalendarEventColor } from "@/components/calendar/event-colors";
53
+ import { createAgendaView } from "@/components/calendar/list-view/agenda-view";
54
+ import { createMonthView } from "@/components/calendar/month-view/month-view";
55
+ import { createDayView, createWeekView } from "@/components/calendar/time-grid-view/time-grid-view";
56
+ import { ViewSwitcher } from "@/components/calendar/view-switcher";
57
+
58
+ export interface Meeting {
59
+ readonly id: string;
60
+ readonly title: string;
61
+ readonly start: Temporal.Instant;
62
+ readonly end: Temporal.Instant;
63
+ readonly color: CalendarEventColor;
64
+ }
65
+
66
+ export const eventAdapter = defineEventAdapter<Meeting>()({
67
+ getId: (meeting) => meeting.id,
68
+ getTitle: (meeting) => meeting.title,
69
+ getInterval: (meeting) => ({ kind: "timed", start: meeting.start, end: meeting.end }),
70
+ getResourceIds: () => [],
71
+ });
72
+
73
+ const getEventColor = (meeting: Meeting) => meeting.color;
74
+
75
+ export const Calendar = createCalendar<Meeting>()({
76
+ eventAdapter,
77
+ views: [
78
+ createWeekView<Meeting>({ dayView: "day", getEventColor }),
79
+ createDayView<Meeting>({ getEventColor }),
80
+ createMonthView<Meeting>({ getEventColor }),
81
+ createAgendaView<Meeting>({ getEventColor }),
82
+ ],
83
+ });
84
+ ```
85
+
86
+ `getEventColor` picks each event's color from the [palette](./theming.md#event-colors).
87
+ `dayView: "day"` makes the dates in the week header open the day view.
88
+
89
+ **Step 4**
90
+
91
+ ### Render it
92
+
93
+ `Root` holds the calendar state. It needs your events, a starting date, a time zone, a locale, and
94
+ week rules (the first day of the week, where 1 is Monday, and the weekend days).
95
+ `CalendarToolbar` adds the Today, previous, and next buttons and the title, and the registry's
96
+ `ViewSwitcher` switches between your views.
97
+
98
+ ```tsx title="calendar.tsx"
99
+ const viewLabels = { week: "Week", day: "Day", month: "Month", agenda: "Agenda" };
100
+ const viewSwitcherOptions = Calendar.views.map(({ name }) => ({
101
+ value: name,
102
+ label: viewLabels[name],
103
+ }));
104
+
105
+ function CalendarViewSwitcher() {
106
+ const view = Calendar.useCalendarSelector((state) => state.view);
107
+ const { setView } = Calendar.useCalendarActions();
108
+ return <ViewSwitcher value={view} onValueChange={setView} options={viewSwitcherOptions} />;
109
+ }
110
+
111
+ export const weekRules = { firstDay: 1, minimalDays: 4, weekend: [6, 7] } as const;
112
+
113
+ export function TeamCalendar({ meetings }: { readonly meetings: readonly Meeting[] }) {
114
+ return (
115
+ <Calendar.Root
116
+ events={meetings}
117
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
118
+ defaultTimeZone="Europe/Berlin"
119
+ locale="en-US"
120
+ weekRules={weekRules}
121
+ >
122
+ <Calendar.Frame className="flex h-[640px] flex-col rounded-xl border">
123
+ <CalendarToolbar calendar={Calendar}>
124
+ <CalendarViewSwitcher />
125
+ </CalendarToolbar>
126
+ <Calendar.Viewport className="min-h-0 flex-1">
127
+ <Calendar.ActiveView />
128
+ </Calendar.Viewport>
129
+ </Calendar.Frame>
130
+ </Calendar.Root>
131
+ );
132
+ }
133
+ ```
134
+
135
+ Give the frame a height: the views fill it and scroll inside it. The calendar is read-only until
136
+ you add an `onEventChange` handler; [Interactions](./interactions.md) shows how to save dragged and
137
+ resized events.
138
+
139
+ The toolbar's buttons use shadcn's `Tooltip`, which shadcn sets up with a `TooltipProvider` around
140
+ your app. If your app doesn't have one yet, add it once:
141
+
142
+ ```tsx title="app.tsx"
143
+ import { TooltipProvider } from "@/components/ui/tooltip";
144
+
145
+ <TooltipProvider>
146
+ <TeamCalendar meetings={meetings} />
147
+ </TooltipProvider>;
148
+ ```
149
+
150
+ > **Using Next.js?**
151
+ >
152
+ > Calendar modules are Client Components, which is why the file starts with `"use client"`. See
153
+ > [Next.js and server rendering](./guides/nextjs.md) for passing data from a Server Component.
154
+
155
+ ## Next steps
156
+
157
+ - [Interactions](./interactions.md): Let people move, resize, create, and delete events.
158
+ - [Views](./views.md): Options for each built-in view.
159
+ - [Theming](./theming.md): Colors, dark mode, and event colors.