@moltenship/calendar 1.0.0-rc.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +27 -6
  2. package/dist/index.d.mts +3 -3
  3. package/dist/index.mjs +2 -2
  4. package/docs/accessibility.md +305 -0
  5. package/docs/agents/changes.md +449 -0
  6. package/docs/agents/coding-agents.md +116 -0
  7. package/docs/agents/connect.md +444 -0
  8. package/docs/agents/deleting.md +296 -0
  9. package/docs/agents/reference.md +511 -0
  10. package/docs/agents/server.md +317 -0
  11. package/docs/agents/webmcp.md +153 -0
  12. package/docs/agents.md +355 -0
  13. package/docs/annotations.md +198 -0
  14. package/docs/api/changes.md +264 -0
  15. package/docs/api/components.md +245 -0
  16. package/docs/api/dnd-kit.md +265 -0
  17. package/docs/api/events.md +153 -0
  18. package/docs/api/primitives.md +218 -0
  19. package/docs/api/store.md +92 -0
  20. package/docs/api.md +57 -0
  21. package/docs/availability.md +576 -0
  22. package/docs/comparison.md +278 -0
  23. package/docs/concepts/anatomy.md +73 -0
  24. package/docs/concepts/events.md +163 -0
  25. package/docs/concepts/how-it-works.md +112 -0
  26. package/docs/concepts/state.md +244 -0
  27. package/docs/concepts/time.md +168 -0
  28. package/docs/customization.md +271 -0
  29. package/docs/frameworks.md +116 -0
  30. package/docs/guides/dnd-kit.md +333 -0
  31. package/docs/guides/google-calendar-sync.md +1246 -0
  32. package/docs/guides/google-calendar.md +367 -0
  33. package/docs/guides/motion.md +414 -0
  34. package/docs/guides/nextjs-app-router.md +630 -0
  35. package/docs/guides/nextjs.md +149 -0
  36. package/docs/guides/performance.md +103 -0
  37. package/docs/guides/tanstack-query.md +485 -0
  38. package/docs/ics/feed.md +484 -0
  39. package/docs/ics/import.md +183 -0
  40. package/docs/ics/reference.md +482 -0
  41. package/docs/ics.md +142 -0
  42. package/docs/index.md +149 -0
  43. package/docs/installation.md +209 -0
  44. package/docs/interactions.md +441 -0
  45. package/docs/llms.txt +99 -0
  46. package/docs/migrating-to-2.md +497 -0
  47. package/docs/quick-start.md +163 -0
  48. package/docs/recurrence/calendar.md +598 -0
  49. package/docs/recurrence/model.md +128 -0
  50. package/docs/recurrence/reference.md +547 -0
  51. package/docs/recurrence.md +122 -0
  52. package/docs/stylex.md +290 -0
  53. package/docs/temporal/daylight-saving-time.md +172 -0
  54. package/docs/temporal/month-grid.md +119 -0
  55. package/docs/temporal/reference.md +167 -0
  56. package/docs/temporal.md +105 -0
  57. package/docs/testing.md +600 -0
  58. package/docs/theme-builder.md +82 -0
  59. package/docs/theming.md +275 -0
  60. package/docs/undo-redo.md +347 -0
  61. package/docs/views/agenda.md +222 -0
  62. package/docs/views/custom-views.md +195 -0
  63. package/docs/views/month.md +110 -0
  64. package/docs/views/resource-columns.md +265 -0
  65. package/docs/views/resource-timeline.md +226 -0
  66. package/docs/views/scrolling.md +193 -0
  67. package/docs/views/week-and-day.md +258 -0
  68. package/docs/views/year.md +138 -0
  69. package/docs/views.md +69 -0
  70. package/package.json +42 -14
  71. package/skills/moltenship-time/SKILL.md +77 -0
  72. package/skills/moltenship-time/references/agent-ready.md +272 -0
  73. package/skills/moltenship-time/references/changes.md +188 -0
  74. package/skills/moltenship-time/references/compose.md +175 -0
  75. package/skills/moltenship-time/references/mistakes.md +100 -0
  76. package/skills/moltenship-time/references/solid.md +213 -0
  77. package/skills/moltenship-time/references/state.md +129 -0
  78. package/skills/moltenship-time/references/testing.md +176 -0
package/docs/index.md ADDED
@@ -0,0 +1,149 @@
1
+ # Introduction
2
+
3
+ A calendar engine on the Temporal API, rendered in React and in SolidJS 2, with actions an AI agent can call.
4
+
5
+ Source: https://time.molten.sh/docs/react
6
+
7
+ Moltenship Time is a calendar for scheduling screens such as bookings, rooms, shifts and team
8
+ calendars. Its engine handles dates, time zones, recurrence, calendar state, event lookups and
9
+ saving changes, and it imports no UI framework. Your events stay in the shape your app already
10
+ uses, and Time reads them through an adapter. An AI agent can read the same calendar and act on it
11
+ through named actions, under rules your app sets.
12
+
13
+ These are the React docs. `@moltenship/calendar` renders the engine in React 19, and the week, day,
14
+ month, year, agenda and resource views are React source files you copy into your app. The select
15
+ at the top of the sidebar switches to the Solid docs.
16
+
17
+ > Live example: see it at https://time.molten.sh/docs/react
18
+
19
+ To see every view with more data, try the [live demo](https://moltenship-time-demo.vercel.app), a
20
+ Google Calendar-style app built from the same views.
21
+
22
+ ## Where to start
23
+
24
+ - [Build a calendar](./quick-start.md): Install the package, add the views with the shadcn CLI, and render a week, day, month and agenda calendar.
25
+ - [Let an AI agent use a calendar](./agents.md): What an agent reads, the actions it can call, and the rules your app sets.
26
+ - [Build with a coding agent](./agents/coding-agents.md): These docs as Markdown, llms.txt, and a skill that ships in @moltenship/calendar.
27
+ - [Parse an ICS feed](./ics.md): @moltenship/ics reads iCalendar text into Temporal values, with or without the calendar.
28
+
29
+ ## What it looks like
30
+
31
+ This is the render part of the [Quick start](./quick-start.md). `Calendar` comes from
32
+ `createCalendar`, and `meetings` is a plain array of your own records.
33
+
34
+ ```tsx title="calendar.tsx"
35
+ const viewLabels = { week: "Week", day: "Day", month: "Month", agenda: "Agenda" };
36
+ const viewSwitcherOptions = Calendar.views.map(({ name }) => ({
37
+ value: name,
38
+ label: viewLabels[name],
39
+ }));
40
+
41
+ function CalendarViewSwitcher() {
42
+ const view = Calendar.useCalendarSelector((state) => state.view);
43
+ const { setView } = Calendar.useCalendarActions();
44
+ return <ViewSwitcher value={view} onValueChange={setView} options={viewSwitcherOptions} />;
45
+ }
46
+
47
+ export const weekRules = { firstDay: 1, minimalDays: 4, weekend: [6, 7] } as const;
48
+
49
+ export function TeamCalendar({ meetings }: { readonly meetings: readonly Meeting[] }) {
50
+ return (
51
+ <Calendar.Root
52
+ events={meetings}
53
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
54
+ defaultTimeZone="Europe/Berlin"
55
+ locale="en-US"
56
+ weekRules={weekRules}
57
+ >
58
+ <Calendar.Frame className="flex h-[640px] flex-col rounded-xl border">
59
+ <CalendarToolbar calendar={Calendar}>
60
+ <CalendarViewSwitcher />
61
+ </CalendarToolbar>
62
+ <Calendar.Viewport className="min-h-0 flex-1">
63
+ <Calendar.ActiveView />
64
+ </Calendar.Viewport>
65
+ </Calendar.Frame>
66
+ </Calendar.Root>
67
+ );
68
+ }
69
+ ```
70
+
71
+ ## Who it's for
72
+
73
+ Time is for developers who build scheduling screens and want to:
74
+
75
+ - keep their existing event data and API,
76
+ - style the calendar with their own design system, or start from shadcn/ui,
77
+ - get time zones and daylight saving time right without writing that math themselves,
78
+ - let an AI agent work with the calendar without handing it the page's markup.
79
+
80
+ [Comparison](./comparison.md) sets Time beside FullCalendar and react-big-calendar, including
81
+ where they're ahead.
82
+
83
+ ## What you get
84
+
85
+ The engine, the calendar's state, the keyboard, the gestures and the hooks are the same in React
86
+ and Solid. Solid's registry has every view, in Tailwind CSS, and `calendar-full` installs them
87
+ all. The StyleX views, the testing package and the dnd-kit adapter exist in React only.
88
+ [React and Solid](./frameworks.md) has the full table.
89
+
90
+ - **Your data, read through an adapter.** You describe how to read an ID, a title and a time range
91
+ from your records. TypeScript keeps your record and ID types in every hook and callback.
92
+ - **Three kinds of time.** Timed events use `Temporal.Instant`, all-day events use
93
+ `Temporal.PlainDate`, and floating events use `Temporal.PlainDateTime`. No `Date` objects.
94
+ - **Time zones and daylight saving time.** The engine lays out days that are 23 or 25 hours long,
95
+ and hours that a clock change skips or repeats. See
96
+ [Time and time zones](./concepts/time.md).
97
+ - **Recurrence and iCalendar.** [`@moltenship/calendar-recurrence`](./recurrence.md) expands
98
+ RRULE series inside the dates on screen, and [`@moltenship/ics`](./ics.md) parses ICS feeds.
99
+ Neither imports a framework.
100
+ - **Changes you save.** A move, a resize, a create or a delete arrives as a change in
101
+ `onEventChange`. It shows as pending while it saves, rolls back if saving fails, and passes
102
+ through policies you choose. See [Interactions](./interactions.md).
103
+ - **Controlled or uncontrolled state.** The calendar or your app can own the visible date, the
104
+ view, the time zone, the selection and the focus, one value at a time.
105
+ - **Headless parts.** `Root`, the previous, next and today buttons, `Title` and `ActiveView` render
106
+ plain elements. A view is a strategy and a component.
107
+ [Custom views](./views/custom-views.md) shows how to write one. The registry's views are one UI
108
+ built on these parts, and [Customization](./customization.md) shows how to restyle it, edit it
109
+ or build your own.
110
+
111
+ - **Actions for agents.** A calendar gives an AI agent fourteen actions, and a fifteenth, deleting,
112
+ when you allow it. They describe the calendar, list its events, navigate, switch view, and
113
+ create, rename, move and resize events. An agent sees nothing until your app creates ui-sdk's
114
+ agent bridge. An agent's change goes through your policies and your `onEventChange`, marked as an
115
+ agent's, and the agent gets back how it ended. A browser's built-in agent reaches them through
116
+ WebMCP, an experimental browser API, and a model you run reaches them through `agentTools`.
117
+ See [Agents in your app](./agents.md).
118
+ - **Editing by pointer and keyboard.** `useCalendarPointer` turns drags into moves, resizes and
119
+ creates, with a mouse, a pen or touch, and `useCalendarKeyboard` moves focus through a view and
120
+ moves and resizes events from the keyboard. The `Announcer` says each step to a screen reader.
121
+ See [Changing events](./accessibility.md#changing-events).
122
+ - **Undo and redo.** `createEventHistory` records changes, and `useCalendarHistory` and its
123
+ keyboard shortcuts take them back. See [Undo and redo](./undo-redo.md).
124
+ - **Server rendering.** During server rendering, Time doesn't read the clock, the host time zone or
125
+ `window`, so the server and the browser render the same markup from the same props.
126
+ - **Docs your coding agent can read.** Every page has a Markdown version, at its own address with
127
+ `.md` added, and [`/llms.txt`](https://time.molten.sh/llms.txt) lists them.
128
+ The docs ship inside `@moltenship/calendar`, and a skill teaches a coding agent the library.
129
+ See [Build with a coding
130
+ agent](./agents/coding-agents.md).
131
+
132
+ ### Only in React today
133
+
134
+ - **Built-in views.** [Week, day](./views/week-and-day.md), [month](./views/month.md),
135
+ [year](./views/year.md), [agenda](./views/agenda.md),
136
+ [resource columns](./views/resource-columns.md) and
137
+ [resource timeline](./views/resource-timeline.md), plus week, day, month and agenda views that
138
+ [scroll without end](./views/scrolling.md). They are source files built on shadcn/ui and
139
+ Tailwind CSS, or on [StyleX](./stylex.md), with a [theme](./theming.md) of calendar tokens and
140
+ an event color palette.
141
+ - **Editing in the built-in views.** The views bind the pointer and the keyboard, and the
142
+ registry's undo toast offers to take each change back.
143
+ - **A testing package.** [`@moltenship/calendar-testing`](./testing.md) has a fixed clock, typed
144
+ builders, a render harness, and keyboard and pointer drivers.
145
+
146
+ - [Installation](./installation.md): Requirements and setup.
147
+ - [Quick start](./quick-start.md): A week, day, month and agenda calendar.
148
+ - [React and Solid](./frameworks.md): What the two integrations share, and what each has today.
149
+ - [Concepts](./concepts/how-it-works.md): The packages, events, time and state.
@@ -0,0 +1,209 @@
1
+ # Installation
2
+
3
+ Requirements, the packages to install, the ui-sdk peer dependencies, and Temporal setup.
4
+
5
+ Source: https://time.molten.sh/docs/react/installation
6
+
7
+ ## Requirements
8
+
9
+ - **React 19.** React and React DOM are peer dependencies.
10
+ - **ui-sdk.** `@ui-sdk/core` and `@ui-sdk/react` are peer dependencies since 2.0. The calendar's
11
+ parts are [ui-sdk](https://ui-sdk.dev) components, which is how an [agent](./agents.md) reaches
12
+ them. ui-sdk is in beta, and the calendar takes `0.1.0-beta.16` and the betas after it.
13
+
14
+ - **A JavaScript runtime with `Temporal`.** Node.js 26 and later include it. Browser support is
15
+ still rolling out, so check the
16
+ [MDN compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#browser_compatibility)
17
+ for the browsers you support and add a polyfill if needed (see below).
18
+ - **TypeScript 6 or later** with `"lib": ["DOM", "DOM.Iterable", "ESNext"]`. `ESNext` has the
19
+ `Temporal` types.
20
+
21
+ ## Install
22
+
23
+ **pnpm**
24
+
25
+ ```bash
26
+ pnpm add @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
27
+ ```
28
+
29
+ **npm**
30
+
31
+ ```bash
32
+ npm install @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
33
+ ```
34
+
35
+ **yarn**
36
+
37
+ ```bash
38
+ yarn add @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
39
+ ```
40
+
41
+ **bun**
42
+
43
+ ```bash
44
+ bun add @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
45
+ ```
46
+
47
+ `@moltenship/calendar` is the only calendar package most React apps import. It includes the React
48
+ components, the event engine, the Temporal helpers, and the pointer interactions. Recurring events
49
+ add [`@moltenship/calendar-recurrence`](./recurrence.md), reading ICS feeds
50
+ [`@moltenship/ics`](./ics.md), and dragging your own dnd-kit items into the calendar
51
+ `@moltenship/calendar-dnd-kit`. See [How it works](./concepts/how-it-works.md) for what's inside.
52
+
53
+ You import ui-sdk yourself in one case: to create the [agent bridge](./agents/connect.md), from
54
+ `@ui-sdk/react/agent`. Keep one copy of `@ui-sdk/core` in your app. The calendar and the bridge
55
+ find each other through it, and with two copies an agent sees no calendar. Your package manager
56
+ keeps one as long as every `@ui-sdk/*` package is on the same version.
57
+
58
+ ## Temporal
59
+
60
+ Time uses the global `Temporal` object and never bundles a polyfill. In a runtime without
61
+ `Temporal`, load one before any code that imports the calendar. This entry file loads
62
+ [`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill) only where it's missing,
63
+ then loads the app:
64
+
65
+ ```tsx title="main.tsx"
66
+ if (!("Temporal" in globalThis)) await import("temporal-polyfill/global");
67
+
68
+ // Import the app afterwards, so no module runs before Temporal exists.
69
+ const { App } = await import("./app");
70
+ ```
71
+
72
+ Any polyfill that defines `globalThis.Temporal` works.
73
+
74
+ ## TypeScript
75
+
76
+ Make sure your `tsconfig.json` includes the `ESNext` library so `Temporal` is typed:
77
+
78
+ ```json title="tsconfig.json"
79
+ {
80
+ "compilerOptions": {
81
+ "lib": ["DOM", "DOM.Iterable", "ESNext"]
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## UI source (optional)
87
+
88
+ The packages render plain, unstyled elements. The styled views, toolbar and theme are React source
89
+ files that you add to your app and then own, the way shadcn/ui works. They install with the shadcn
90
+ CLI from this site's registry. There's no other installer. An app that brings its own UI skips
91
+ this section, as [Build your own UI](./customization.md#level-4-build-your-own-ui) describes.
92
+
93
+ **Step 1**
94
+
95
+ Set up [shadcn/ui](https://ui.shadcn.com/docs/installation) with Tailwind CSS 4 if your app
96
+ doesn't use it yet. `shadcn add` needs its `components.json`, and the calendar's files use its
97
+ tokens, such as `--background` and `--primary`:
98
+
99
+ ```bash
100
+ npx shadcn@latest init
101
+ ```
102
+
103
+ Any style works: the calendar brings its own controls and uses none of your app's components. An
104
+ app with a `components.json` but without shadcn's tokens gets shadcn's neutral ones from
105
+ `base-tokens`:
106
+
107
+ ```bash
108
+ npx shadcn@latest add https://time.molten.sh/r/base-tokens.json
109
+ ```
110
+
111
+ **Step 2**
112
+
113
+ Add the calendar. `calendar-full` installs every view, the theme and the parts they share:
114
+
115
+ ```bash
116
+ npx shadcn@latest add https://time.molten.sh/r/calendar-full.json
117
+ ```
118
+
119
+ Or add only the views you use. Each one brings what it builds on: the theme, the shared
120
+ `calendar` parts, the calendar's controls, and npm packages such as `@moltenship/calendar`.
121
+
122
+ | Item | What it adds |
123
+ | -------------------------- | ---------------------------------------------------------------------------- |
124
+ | `calendar-full` | Every item below but `base-tokens` |
125
+ | `calendar-theme` | The calendar's tokens and event colors, added to your global CSS |
126
+ | `calendar-ui` | The calendar's controls and popups, built on ui-sdk |
127
+ | `calendar` | `CalendarToolbar`, `ViewSwitcher`, `EventChip`, `MiniMonth` and shared parts |
128
+ | `time-grid-view` | The [week and day](./views/week-and-day.md) views |
129
+ | `month-view` | The [month](./views/month.md) view |
130
+ | `list-view` | The [agenda](./views/agenda.md) view |
131
+ | `year-view` | The [year](./views/year.md) view |
132
+ | `scrolling-time-grid-view` | The [scrolling](./views/scrolling.md) week and day views |
133
+ | `scrolling-month-view` | The scrolling month view |
134
+ | `scrolling-list-view` | The scrolling agenda |
135
+ | `resource-columns-view` | The [resource columns](./views/resource-columns.md) view |
136
+ | `resource-timeline-view` | The [resource timeline](./views/resource-timeline.md) views |
137
+ | `recurrence-scope-dialog` | The [recurrence scope dialog](./recurrence/calendar.md) |
138
+ | `calendar-history-toast` | The [undo toast](./undo-redo.md#undo-toast) |
139
+ | `base-tokens` | shadcn/ui's neutral tokens, for an app without them |
140
+
141
+ Each item's address is `https://time.molten.sh/r/<item>.json`:
142
+
143
+ ```bash
144
+ npx shadcn@latest add https://time.molten.sh/r/month-view.json
145
+ ```
146
+
147
+ The files land in `calendar/` under the `components` alias in your `components.json`, such as
148
+ `components/calendar/month-view/month-view.tsx`, and their imports follow your aliases. Each item
149
+ asks for the `@moltenship/calendar` versions it was built for, and `shadcn add` installs a
150
+ matching one. `calendar-ui` lists `@ui-sdk/core` and `@ui-sdk/react`, so `shadcn add` adds them if
151
+ your app doesn't have them yet. Keep them on the version the calendar uses, as above.
152
+
153
+ To add items by name, add the registry to `components.json` once:
154
+
155
+ ```json title="components.json"
156
+ {
157
+ "registries": {
158
+ "@moltenship": "https://time.molten.sh/r/{name}.json"
159
+ }
160
+ }
161
+ ```
162
+
163
+ Then `npx shadcn@latest add @moltenship/month-view` works too.
164
+
165
+ **Step 3**
166
+
167
+ The calendar's controls come from `calendar-ui`, not from your app's `components/ui`: its
168
+ buttons, badges, tooltips, selects, popovers, dialogs and toasts. They're a default: to use your
169
+ own, see
170
+ [Use your own controls](./theming.md#use-your-own-controls). ui-sdk
171
+ adds a little CSS of its own to the page, in a layer named `ui-sdk`. Name that layer before
172
+ Tailwind in your global CSS, so your styles and Tailwind's win over it:
173
+
174
+ ```css title="globals.css"
175
+ @layer ui-sdk;
176
+ @import "tailwindcss";
177
+ ```
178
+
179
+ The calendar's popups, such as the view select's list, its tooltips, popovers and dialogs, open
180
+ in the browser's top layer, through the Popover API: Chrome and Edge 114, Safari 17 and Firefox 125 or later. In an older browser they
181
+ render at the end of the page instead, and a server-rendered page doesn't hydrate them cleanly.
182
+ The toolbar's tooltips open after 400 ms; change `tooltipDefaults` in
183
+ `components/calendar/ui/tooltip.styles.ts`, or pass `delay` to a `Tooltip`.
184
+
185
+ For an app on StyleX rather than Tailwind, every item has a `stylex-` version; see
186
+ [StyleX](./stylex.md).
187
+
188
+ The theme's tokens and rules go into your global CSS inside `@layer base`, so your own rules win
189
+ over them. Each `shadcn add` writes that block again, so change tokens in your own rules instead,
190
+ as [Theming](./theming.md#changing-tokens) shows. Run `shadcn add` again to update the files: it
191
+ asks before it replaces a file you already have, and `--overwrite` replaces them all, with any
192
+ changes you made.
193
+
194
+ ## Run from source
195
+
196
+ To work on Time, or to try changes that aren't released yet, run it and this documentation site
197
+ from the repository. You need Node.js 26 and the [Vite+ CLI](https://viteplus.dev/guide/) (`vp`).
198
+
199
+ ```bash
200
+ git clone https://github.com/Moltenship/time.git
201
+ cd time
202
+ vp install
203
+ vp run dev
204
+ ```
205
+
206
+ `vp run dev` starts this site locally. The examples on these pages are real files, type-checked
207
+ against the current packages. They are in `apps/showcase/content/examples`.
208
+
209
+ Next, build a calendar in the [Quick start](./quick-start.md).