@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.
- package/README.md +27 -6
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/docs/accessibility.md +305 -0
- package/docs/agents/changes.md +449 -0
- package/docs/agents/coding-agents.md +116 -0
- package/docs/agents/connect.md +444 -0
- package/docs/agents/deleting.md +296 -0
- package/docs/agents/reference.md +511 -0
- package/docs/agents/server.md +317 -0
- package/docs/agents/webmcp.md +153 -0
- package/docs/agents.md +355 -0
- package/docs/annotations.md +198 -0
- package/docs/api/changes.md +264 -0
- package/docs/api/components.md +245 -0
- package/docs/api/dnd-kit.md +265 -0
- package/docs/api/events.md +153 -0
- package/docs/api/primitives.md +218 -0
- package/docs/api/store.md +92 -0
- package/docs/api.md +57 -0
- package/docs/availability.md +576 -0
- package/docs/comparison.md +278 -0
- package/docs/concepts/anatomy.md +73 -0
- package/docs/concepts/events.md +163 -0
- package/docs/concepts/how-it-works.md +112 -0
- package/docs/concepts/state.md +244 -0
- package/docs/concepts/time.md +168 -0
- package/docs/customization.md +271 -0
- package/docs/frameworks.md +116 -0
- package/docs/guides/dnd-kit.md +333 -0
- package/docs/guides/google-calendar-sync.md +1246 -0
- package/docs/guides/google-calendar.md +367 -0
- package/docs/guides/motion.md +414 -0
- package/docs/guides/nextjs-app-router.md +630 -0
- package/docs/guides/nextjs.md +149 -0
- package/docs/guides/performance.md +103 -0
- package/docs/guides/tanstack-query.md +485 -0
- package/docs/ics/feed.md +484 -0
- package/docs/ics/import.md +183 -0
- package/docs/ics/reference.md +482 -0
- package/docs/ics.md +142 -0
- package/docs/index.md +149 -0
- package/docs/installation.md +209 -0
- package/docs/interactions.md +441 -0
- package/docs/llms.txt +99 -0
- package/docs/migrating-to-2.md +497 -0
- package/docs/quick-start.md +163 -0
- package/docs/recurrence/calendar.md +598 -0
- package/docs/recurrence/model.md +128 -0
- package/docs/recurrence/reference.md +547 -0
- package/docs/recurrence.md +122 -0
- package/docs/stylex.md +290 -0
- package/docs/temporal/daylight-saving-time.md +172 -0
- package/docs/temporal/month-grid.md +119 -0
- package/docs/temporal/reference.md +167 -0
- package/docs/temporal.md +105 -0
- package/docs/testing.md +600 -0
- package/docs/theme-builder.md +82 -0
- package/docs/theming.md +275 -0
- package/docs/undo-redo.md +347 -0
- package/docs/views/agenda.md +222 -0
- package/docs/views/custom-views.md +195 -0
- package/docs/views/month.md +110 -0
- package/docs/views/resource-columns.md +265 -0
- package/docs/views/resource-timeline.md +226 -0
- package/docs/views/scrolling.md +193 -0
- package/docs/views/week-and-day.md +258 -0
- package/docs/views/year.md +138 -0
- package/docs/views.md +69 -0
- package/package.json +42 -14
- package/skills/moltenship-time/SKILL.md +77 -0
- package/skills/moltenship-time/references/agent-ready.md +272 -0
- package/skills/moltenship-time/references/changes.md +188 -0
- package/skills/moltenship-time/references/compose.md +175 -0
- package/skills/moltenship-time/references/mistakes.md +100 -0
- package/skills/moltenship-time/references/solid.md +213 -0
- package/skills/moltenship-time/references/state.md +129 -0
- package/skills/moltenship-time/references/testing.md +176 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Week and day
|
|
2
|
+
|
|
3
|
+
Time-grid views with an all-day row, a current-time line, and DST-aware hours.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/week-and-day
|
|
6
|
+
|
|
7
|
+
> Live example of the `week` view: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
8
|
+
|
|
9
|
+
Try both views in the [live demo](https://moltenship-time-demo.vercel.app).
|
|
10
|
+
|
|
11
|
+
`createWeekView` and `createDayView` show the hours of the day down the side and one column per day.
|
|
12
|
+
The week view has seven columns, starting on `weekRules.firstDay`. The day view has one column for
|
|
13
|
+
the anchor date. `createThreeDayView` has three, from the anchor date: on a phone, where a week's
|
|
14
|
+
seven columns are too narrow to read, it shows more than a day.
|
|
15
|
+
|
|
16
|
+
## Add them
|
|
17
|
+
|
|
18
|
+
Add the views to your app with the shadcn CLI, as described in
|
|
19
|
+
[UI source](../installation.md#ui-source-optional). The item brings the theme, the shared
|
|
20
|
+
`calendar` parts, and the shadcn components it uses:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx shadcn@latest add https://time.molten.sh/r/time-grid-view.json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then register the views:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { createDayView, createWeekView } from "@/components/calendar/time-grid-view/time-grid-view";
|
|
30
|
+
|
|
31
|
+
const getEventColor = (meeting: Meeting) => meeting.color;
|
|
32
|
+
|
|
33
|
+
export const Calendar = createCalendar<Meeting>()({
|
|
34
|
+
eventAdapter,
|
|
35
|
+
views: [
|
|
36
|
+
createWeekView<Meeting>({ dayView: "day", getEventColor }),
|
|
37
|
+
createDayView<Meeting>({ getEventColor }),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The views are named `week`, `day` and `3-day`. Pass your event type, as in
|
|
43
|
+
`createWeekView<Meeting>`, so `getEventColor` receives your records.
|
|
44
|
+
|
|
45
|
+
## Anatomy
|
|
46
|
+
|
|
47
|
+
All three views render `TimeGridView` from `registry/time-grid-view`, with seven day columns for the
|
|
48
|
+
week, three for the 3-day view and one for the day. The view builds these parts itself, so they're
|
|
49
|
+
not parts you compose: to change one, edit its file. The tree shows where each part lives.
|
|
50
|
+
|
|
51
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
52
|
+
|
|
53
|
+
```txt title="Rendered by TimeGridView"
|
|
54
|
+
TimeGridView time-grid-view.tsx
|
|
55
|
+
├── TimeGridHeader time-grid-header.tsx
|
|
56
|
+
├── TimeGridAllDay time-grid-all-day.tsx
|
|
57
|
+
└── TimeGridBody time-grid-body.tsx, scrolls
|
|
58
|
+
├── Time gutter --calendar-gutter-width
|
|
59
|
+
│ └── TimeGridZoneHours time-grid-zones.tsx, one per secondary time zone
|
|
60
|
+
└── TimeGridColumn time-grid-column.tsx, one per day, data-date
|
|
61
|
+
├── TimeGridEvent time-grid-event.tsx
|
|
62
|
+
│ ├── Title and time
|
|
63
|
+
│ └── Resize handles data-resize="start" and "end"
|
|
64
|
+
└── Now line data-slot="time-grid-now"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- The gutter is `--calendar-gutter-width` wide: `--calendar-hours-width` for the hours (3rem, or
|
|
68
|
+
4rem from the `sm` breakpoint), plus `--calendar-zone-width` (4rem) for each
|
|
69
|
+
[secondary time zone](#secondary-time-zones). To change the hours' width, edit
|
|
70
|
+
`--calendar-hours-width` in `time-grid-zones.tsx`.
|
|
71
|
+
- An event's `TimeGridEventLayout` sets its `top` and `height` from its times, and its `left` and
|
|
72
|
+
`width` from the [overlap layout](#overlapping-events). A column renders its events in layout
|
|
73
|
+
order, so a stacked event draws over the ones it overlaps.
|
|
74
|
+
- `useNow()` moves the now line.
|
|
75
|
+
|
|
76
|
+
## Options
|
|
77
|
+
|
|
78
|
+
| Name | Type | Default | Description |
|
|
79
|
+
| ----------------------- | ----------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
+
| `dayView` | `string` | | A registered view that opens when you click a date in the header, usually `"day"`. Without it the header dates are plain text. |
|
|
81
|
+
| `dragPreview` | `"snapped" \| "free"` | `"snapped"` | How a drag's preview moves: from slot to slot, or with the pointer over a marker of where it would land, snapping there on release. See [snapped and free drags](../interactions.md#snapped-and-free-drags). |
|
|
82
|
+
| `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
|
|
83
|
+
| `getEventIcon` | `(event: TEvent) => ReactNode` | | A small icon before each event's title, such as a repeat mark on recurring events, or nothing. It's decorative and hidden from screen readers: say the same in `describeEvent`, which adds to the event's [accessible name](../accessibility.md#event-names). |
|
|
84
|
+
| `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | An event's own layout, such as its calendar's. A group of overlapping events takes it when they all agree. See [by calendar](#by-calendar). |
|
|
85
|
+
| `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | How overlapping events share a day column. See [overlapping events](#overlapping-events). |
|
|
86
|
+
| `stackIndent` | `number` | `0.15` | How far each level of a stack is indented, as a fraction of the column width, the same for every stacked group. A value that isn't positive throws, whatever the layout. |
|
|
87
|
+
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
|
|
88
|
+
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time: a function of its props and its state. See [customize the shading](../availability.md#customize-the-shading). |
|
|
89
|
+
| `annotations` | `TimeGridAnnotationOptions` | | How the root's annotations draw: a rail beside the events or an overlay (`placement`), the rail's size and side, or your own parts. See [Annotations](../annotations.md#options). |
|
|
90
|
+
|
|
91
|
+
Set options when you create the view, or per calendar with
|
|
92
|
+
`viewOptions={{ week: { dayView: "day" } }}` on `Root`.
|
|
93
|
+
|
|
94
|
+
## What it shows
|
|
95
|
+
|
|
96
|
+
- **Header:** the weekday and date of each column, with today highlighted and marked
|
|
97
|
+
`aria-current="date"`. The corner shows the time zone's offset, such as "GMT+2", after the name
|
|
98
|
+
of each [secondary time zone](#secondary-time-zones).
|
|
99
|
+
- **All-day row:** all-day events, plus timed and floating events that last 24 hours or more. Busy days collapse
|
|
100
|
+
to three rows with "+N more", and a chevron in the corner expands the row.
|
|
101
|
+
- **Hours:** labels come from `Intl`, so they read "1 PM" or "13:00" depending on the locale. Each hour
|
|
102
|
+
is `--calendar-hour-height` tall (3rem by default).
|
|
103
|
+
- **Events:** overlapping events sit side by side, or as `overlapLayout` sets. Events shorter than 45 minutes show on one line,
|
|
104
|
+
as "Standup, 9:30 AM". Events that run past midnight show their real times on both days, as
|
|
105
|
+
"10:00 PM – 2:00 AM". A title that doesn't fit its event shows in full in a tooltip while you
|
|
106
|
+
hover or focus the event.
|
|
107
|
+
- **Daylight saving time:** hours skipped when the clocks go forward are hatched, and hours repeated
|
|
108
|
+
when they go back are tinted, with both occurrences side by side.
|
|
109
|
+
- **Current time:** a line across today's column, from [`useNow()`](../concepts/time.md#the-current-time).
|
|
110
|
+
The grid opens scrolled to the current time, or to 08:00 when today isn't visible, and keeps its
|
|
111
|
+
scroll position when you move between weeks.
|
|
112
|
+
- **Editing:** with `onEventChange` on `Root`, drag an event to move it (onto the all-day row to
|
|
113
|
+
make it all-day), drag its top or bottom edge to resize it, and drag across empty time or all-day
|
|
114
|
+
cells to create one. See [Interactions](../interactions.md#drag-resize-and-create).
|
|
115
|
+
- **Changes being saved:** events with a [pending change](../interactions.md#pending-changes) get
|
|
116
|
+
`data-pending` and render at 60% opacity.
|
|
117
|
+
|
|
118
|
+
The day view works on narrow screens:
|
|
119
|
+
|
|
120
|
+
> Live example of the `day` view: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
121
|
+
|
|
122
|
+
## Overlapping events
|
|
123
|
+
|
|
124
|
+
`overlapLayout` sets how events that overlap share a day column. Switch between the layouts here,
|
|
125
|
+
and drag an event to see the others make room. "Stack focus time" gives the purple focus time
|
|
126
|
+
calendar a layout of its own, as [by calendar](#by-calendar) describes:
|
|
127
|
+
|
|
128
|
+
> Live example: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
129
|
+
|
|
130
|
+
- **`"columns"`** (the default) puts overlapping events side by side, in as few lanes as they
|
|
131
|
+
need. Each event widens into lanes that stay free beside it, as Google Calendar draws them.
|
|
132
|
+
- **`"equal"`** uses the same lanes, but every event in a busy stretch is one lane wide, so the
|
|
133
|
+
lanes line up.
|
|
134
|
+
- **`"stack"`** cascades them. Each event is indented past the earlier events it overlaps and drawn
|
|
135
|
+
on top of them, reaching to the column's end. `stackIndent` sets the indent as a fraction of the
|
|
136
|
+
column width (0.15 by default). A deep stack indents less, so the top event keeps at least half
|
|
137
|
+
the column. Hover or focus a covered event to bring it to the top and read its title.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
createWeekView<Meeting>({ dayView: "day", overlapLayout: "stack" });
|
|
141
|
+
|
|
142
|
+
// Or switch it at runtime, per view:
|
|
143
|
+
<Calendar.Root viewOptions={{ week: { overlapLayout }, day: { overlapLayout } }} />;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Every layout keeps the same rules:
|
|
147
|
+
|
|
148
|
+
- Events that touch, one ending as the next starts, don't overlap. An event shorter than 15
|
|
149
|
+
minutes still takes up 15 so it stays readable, so it can overlap the next one.
|
|
150
|
+
- Overlapping events form a group, laid out on its own, so a change to one group never moves
|
|
151
|
+
events in another.
|
|
152
|
+
- The order is fixed: by start, then longer first, then event ID. It's the order events are drawn
|
|
153
|
+
in, and the order ↑ and ↓ walk them. ← and → step to the overlapping event drawn beside, and
|
|
154
|
+
mirror right to left.
|
|
155
|
+
- An event picked up with the keyboard, and changes still being saved, are laid out the same way,
|
|
156
|
+
so an event lands where it will stay.
|
|
157
|
+
|
|
158
|
+
The resource columns view takes the same options, for each resource's column, and can give each
|
|
159
|
+
resource a layout of its own: see [rooms and people](./resource-columns.md#rooms-and-people).
|
|
160
|
+
The [scrolling](./scrolling.md) week and day views take them too.
|
|
161
|
+
|
|
162
|
+
### By calendar
|
|
163
|
+
|
|
164
|
+
`getEventOverlapLayout` gives events a layout of their own, usually their calendar's. Return
|
|
165
|
+
`undefined` for events that should follow the view's `overlapLayout`:
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
const layouts: Partial<Record<CalendarId, OverlapLayout>> = { focus: "stack" };
|
|
169
|
+
|
|
170
|
+
createWeekView<Meeting>({
|
|
171
|
+
getEventOverlapLayout: (meeting) => layouts[meeting.calendarId],
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
One column can hold a group of overlapping events from several calendars, and a group is drawn
|
|
176
|
+
one way. So a group takes its events' own layout only when they all agree, and otherwise the
|
|
177
|
+
view's `overlapLayout`. An event without a layout of its own counts as the view's.
|
|
178
|
+
|
|
179
|
+
- An afternoon of focus time stacks, while a focus block that overlaps a meeting stays in lanes
|
|
180
|
+
beside it.
|
|
181
|
+
- A group's layout depends only on its own events, so an event that overlaps none of them never
|
|
182
|
+
changes how they're drawn. An event that joins a group from another calendar can switch the
|
|
183
|
+
group back to the view's layout, as joining a group already redraws it.
|
|
184
|
+
- Agreement doesn't depend on order, and `stackIndent` is the same for every stacked group.
|
|
185
|
+
- While an event is being moved or saved, `getEventOverlapLayout` still gets the event as you
|
|
186
|
+
stored it, not its new time or resources. Base it on what a move doesn't change, such as the
|
|
187
|
+
calendar.
|
|
188
|
+
|
|
189
|
+
## Secondary time zones
|
|
190
|
+
|
|
191
|
+
Pass `secondaryTimeZones` to `Root` to label the hours in other time zones too, like Google
|
|
192
|
+
Calendar's secondary time zone. Each zone gets a column of hours beside the calendar's own:
|
|
193
|
+
|
|
194
|
+
> Live example: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
<Calendar.Root
|
|
198
|
+
timeZone="Europe/Berlin"
|
|
199
|
+
secondaryTimeZones={["America/New_York", { timeZone: "Asia/Tokyo", label: "Tokyo" }]}
|
|
200
|
+
// …
|
|
201
|
+
/>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- **Names:** each column is named by its `label`, or by the zone's short name from `Intl` in the
|
|
205
|
+
calendar's locale, such as "EDT" or "GMT+5:30". Without a `label`, hover it for the zone's full
|
|
206
|
+
name.
|
|
207
|
+
- **Hours:** each line is read on its own date, in both zones' rules, so the labels stay right when
|
|
208
|
+
either zone changes its clocks. Zones off the hour show minutes, such as "4:30 PM" in India.
|
|
209
|
+
"+1" or "-1" marks a time on the next or previous day there.
|
|
210
|
+
- **Daylight saving time:** an hour the calendar's zone skips has no label, and an hour it repeats
|
|
211
|
+
shows its first time. The gutter follows the first day shown on which neither zone changes its
|
|
212
|
+
clocks. A day that reads differently, because a zone changes its offset, says so under its date,
|
|
213
|
+
such as "EST -1h". Hover the note to see from when, and until when if it ends that day.
|
|
214
|
+
- **Width:** each zone's column is `--calendar-zone-width` wide, 4rem by default, which fits
|
|
215
|
+
"12:30 AM+1". Some locales write longer times; set the variable to a rem or px length on an
|
|
216
|
+
element around the calendar, such as `[--calendar-zone-width:4.5rem]`.
|
|
217
|
+
- **Clock:** 12 or 24 hours, as the locale says, including a `-u-hc-h23` extension.
|
|
218
|
+
- **Screen readers:** the extra hours are hidden, like the calendar's own hour labels, so the grid's
|
|
219
|
+
columns stay the same. A focused slot names its time in each zone instead, as in "Monday,
|
|
220
|
+
October 12 at 9:00 PM, 3:00 PM Eastern Daylight Time". Each time is named as its zone is at that
|
|
221
|
+
moment, so the hour repeated in London reads "1:30 AM British Summer Time or 1:30 AM Greenwich
|
|
222
|
+
Mean Time".
|
|
223
|
+
|
|
224
|
+
The scrolling week and day views and the resource columns view show the same columns. The parts
|
|
225
|
+
live in `time-grid-zones.tsx`, and [Time and time zones](../concepts/time.md#secondary-time-zones)
|
|
226
|
+
explains how each line is read.
|
|
227
|
+
|
|
228
|
+
## Keyboard
|
|
229
|
+
|
|
230
|
+
Tab into the preview above, or click a slot, and try these keys. The
|
|
231
|
+
[Accessibility](../accessibility.md#keyboard) page has the full map and what a screen reader hears.
|
|
232
|
+
|
|
233
|
+
| Focus | Key | Effect |
|
|
234
|
+
| --------------- | ------------------ | --------------------------------------------------------------------------------- |
|
|
235
|
+
| An all-day cell | ↓ | First slot of the day |
|
|
236
|
+
| A slot | ↑ ↓ | Previous or next 15-minute slot. Up from the first slot reaches the all-day cell |
|
|
237
|
+
| A day or slot | ← → | Same slot on the previous or next day |
|
|
238
|
+
| A day or slot | Home, End | First or last day shown |
|
|
239
|
+
| A day or slot | Page Up, Page Down | Back or forward a whole week (or day) |
|
|
240
|
+
| A slot | Enter | The event covering it. Escape goes back to the slot it starts in |
|
|
241
|
+
| An all-day cell | Enter | Go into the day's all-day events |
|
|
242
|
+
| A timed event | ↑ ↓, ← → | Previous or next event in the column, or the event beside it that overlaps it |
|
|
243
|
+
| A day or slot | Shift+Enter | Open that date in the day view, when the week has `dayView` |
|
|
244
|
+
| A slot | Space | Start an hour-long event there. Arrow keys extend it, and Enter saves it |
|
|
245
|
+
| An all-day cell | Space | Start an all-day event there |
|
|
246
|
+
| An event | Space | Pick it up. Arrow keys move it by slots and days, Enter saves, and Escape cancels |
|
|
247
|
+
| An event | Shift+Space | Pick up its end to resize it. Shift+Space again switches to its start |
|
|
248
|
+
|
|
249
|
+
Moving a picked-up timed event above the first slot makes it all-day, and moving an all-day event
|
|
250
|
+
below the all-day row makes it timed. Only the focused slot is an element, so a week's 672 slots
|
|
251
|
+
cost nothing until you visit them.
|
|
252
|
+
|
|
253
|
+
## Markup for interactions
|
|
254
|
+
|
|
255
|
+
The view connects the pointer layer for you. If you change its markup, keep the attributes the
|
|
256
|
+
pointer layer reads: day columns have `data-date` and cover the full 24 hours, all-day cells have
|
|
257
|
+
`data-date` and `data-all-day`, each event is a `<button>` with `data-event-id`, and events you can
|
|
258
|
+
edit have `data-resize="start"` and `data-resize="end"` handles.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Year
|
|
2
|
+
|
|
3
|
+
Twelve months at a glance, with a dot for each event color on a day and a popover of its events.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/year
|
|
6
|
+
|
|
7
|
+
> Live example of the `year` view: see it at https://time.molten.sh/docs/react/views/year
|
|
8
|
+
|
|
9
|
+
Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Year in the view switcher,
|
|
10
|
+
or press Y.
|
|
11
|
+
|
|
12
|
+
`createYearView` shows the anchor's calendar year, January to December, as twelve small month
|
|
13
|
+
grids. Weeks start on `weekRules.firstDay`. Each date shows once: a week that reaches into the
|
|
14
|
+
month before or after leaves those cells empty, so every month keeps its own shape.
|
|
15
|
+
|
|
16
|
+
## Add it
|
|
17
|
+
|
|
18
|
+
Add the view to your app with the shadcn CLI, as described in
|
|
19
|
+
[UI source](../installation.md#ui-source-optional). The item brings the theme, the shared
|
|
20
|
+
`calendar` parts, and shadcn's `popover`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx shadcn@latest add https://time.molten.sh/r/year-view.json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then register the view:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { createYearView } from "@/components/calendar/year-view/year-view";
|
|
30
|
+
|
|
31
|
+
export const Calendar = createCalendar<Meeting>()({
|
|
32
|
+
eventAdapter,
|
|
33
|
+
views: [
|
|
34
|
+
createMonthView<Meeting>({ getEventColor: (meeting) => meeting.color }),
|
|
35
|
+
createYearView<Meeting>({ getEventColor: (meeting) => meeting.color }),
|
|
36
|
+
createDayView<Meeting>(),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The view is named `year`. Previous and Next move by one year. Its range is the whole year, so
|
|
42
|
+
`onVisibleRangeChange` asks for a year of events at a time: see
|
|
43
|
+
[loading events by range](./scrolling.md#loading-events-as-you-scroll).
|
|
44
|
+
|
|
45
|
+
## Anatomy
|
|
46
|
+
|
|
47
|
+
`YearView` renders the parts below. To change one, edit it in the `components/calendar/year-view`
|
|
48
|
+
files you added.
|
|
49
|
+
|
|
50
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/year
|
|
51
|
+
|
|
52
|
+
```txt title="Rendered by YearView"
|
|
53
|
+
YearView year-view.tsx
|
|
54
|
+
├── YearMonthGrid year-month.tsx, one per month
|
|
55
|
+
│ ├── Month name opens the month view
|
|
56
|
+
│ ├── Weekday initials
|
|
57
|
+
│ └── Day cell data-date, the popover's trigger
|
|
58
|
+
│ ├── Date aria-current="date" on today
|
|
59
|
+
│ └── Event dots data-color, one per color
|
|
60
|
+
└── YearDayPopover year-day-popover.tsx, one for the whole year
|
|
61
|
+
├── Date opens the day view
|
|
62
|
+
└── YearEvent a [data-event-id] button per event
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The popover is one popover from the calendar's controls, with a trigger in every day that shares
|
|
66
|
+
it through a handle, so the year never mounts hundreds of popovers.
|
|
67
|
+
|
|
68
|
+
## Options
|
|
69
|
+
|
|
70
|
+
| Name | Type | Default | Description |
|
|
71
|
+
| ------------------- | ---------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `getEventColor` | `(event: TEvent) => CalendarEventColor` | | The color of each event's dot and of its row in the popover. See [event colors](../theming.md#event-colors). |
|
|
73
|
+
| `getEventIcon` | `(event: TEvent) => ReactNode` | | A small icon before each event's title in the popover, such as a repeat mark on recurring events, or nothing; the dots don't show it. It's decorative and hidden from screen readers: say the same in `describeEvent`, which adds to the event's [accessible name](../accessibility.md#event-names). |
|
|
74
|
+
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
|
|
75
|
+
| `dayView` | `string` | `"day"` | The registered view a date opens. |
|
|
76
|
+
| `monthView` | `string` | `"month"` | The registered view a month's name opens. |
|
|
77
|
+
| `closedDays` | `"exceptions" \| "all" \| "none"` | `"exceptions"` | Which closed days are shaded: the dates an exception closes, such as holidays; those and the weekly closed days, such as weekends; or none. A closed day is named "closed" either way. See [Closed days](#closed-days). |
|
|
78
|
+
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of the closed days `closedDays` picks. See [Availability](../availability.md#customize-the-shading). |
|
|
79
|
+
|
|
80
|
+
## What it shows
|
|
81
|
+
|
|
82
|
+
- **Months:** two to a row on a phone, up to six on a wide screen. Each keeps room for six weeks, so
|
|
83
|
+
months side by side line up.
|
|
84
|
+
- **Days:** today's date sits in a filled circle. Under each date, a dot for every event color on
|
|
85
|
+
that day, up to three, in the order the day's events start. All-day and multi-day events count on
|
|
86
|
+
every date they cover.
|
|
87
|
+
- **A day's events:** clicking a day opens a popover with its events, all-day first, then by start
|
|
88
|
+
time. Each event is a `<button data-event-id>`, so the app's own event details open from it as from
|
|
89
|
+
any other view. The date at the top opens the day in the view named `day`.
|
|
90
|
+
- **Month names** open that month in the view named `month`.
|
|
91
|
+
- **Closed days:** with [availability](../availability.md), see [below](#closed-days).
|
|
92
|
+
- **Scrolling:** where the months don't fit, the view opens with today's month, or the day you last
|
|
93
|
+
focused, in view. Today, Previous, Next and a picked date scroll their month into view. Only the
|
|
94
|
+
view scrolls, never the page around it.
|
|
95
|
+
- **Editing:** none. The year shows events without moving or creating them; open a day or a month
|
|
96
|
+
to edit.
|
|
97
|
+
|
|
98
|
+
## Closed days
|
|
99
|
+
|
|
100
|
+
With [availability](../availability.md), a day without working hours is named "closed" for screen
|
|
101
|
+
readers, as in the month view. What's shaded depends on `closedDays`:
|
|
102
|
+
|
|
103
|
+
- `"exceptions"` (the default) shades the dates an exception closes, such as a public holiday or an
|
|
104
|
+
offsite. Weekly closed days, such as weekends, stay plain: the weekday columns already show them,
|
|
105
|
+
and a third of the year in gray would bury the holidays.
|
|
106
|
+
- `"all"` shades the weekly closed days too.
|
|
107
|
+
- `"none"` shades nothing.
|
|
108
|
+
|
|
109
|
+
Shaded days next to each other in a week join into one band with rounded ends, so a weekend or a
|
|
110
|
+
long holiday reads as one stretch, and the rows stay apart. To draw it differently, such as hatching,
|
|
111
|
+
pass `renderUnavailable`; its `band` carries the reason, the exception's label and whether open time
|
|
112
|
+
meets each end.
|
|
113
|
+
|
|
114
|
+
Set `closedDays` when you create the view, or per calendar with
|
|
115
|
+
`viewOptions={{ year: { closedDays: "all" } }}` on `Root`.
|
|
116
|
+
|
|
117
|
+
## Keyboard
|
|
118
|
+
|
|
119
|
+
Tab into the preview above, or click a day, and try these keys. The
|
|
120
|
+
[Accessibility](../accessibility.md#keyboard) page has the full map.
|
|
121
|
+
|
|
122
|
+
| Focus | Key | Effect |
|
|
123
|
+
| ----- | ------------------ | ------------------------------------------------------------------------ |
|
|
124
|
+
| A day | ← → | Previous or next day, across months |
|
|
125
|
+
| A day | ↑ ↓ | Same weekday a week earlier or later, across months |
|
|
126
|
+
| A day | Home, End | First or last day of the week's row in its month |
|
|
127
|
+
| A day | Page Up, Page Down | Same day in the previous or next month |
|
|
128
|
+
| A day | Enter, Space | Open the day's events. Tab moves through them; Escape returns to the day |
|
|
129
|
+
| A day | Shift+Enter | Open the day in the day view |
|
|
130
|
+
|
|
131
|
+
Moving past December 31 or before January 1 navigates to the next or previous year.
|
|
132
|
+
|
|
133
|
+
## Build your own
|
|
134
|
+
|
|
135
|
+
The strategy pieces are exported, for a year that looks different, such as a heat map of busy days:
|
|
136
|
+
`getYearRange`, `navigateYear`, `getYearTitle`, `projectYear` and `yearSpatialNavigation`.
|
|
137
|
+
`projectYear` returns twelve months of week rows, each day with its event fragments in display
|
|
138
|
+
order, or `null` outside the month. See [Custom views](./custom-views.md).
|
package/docs/views.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
How views work, how to switch between them, and which ones exist today.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views
|
|
6
|
+
|
|
7
|
+
A view decides which dates are visible and how to draw them. A calendar can have several views, for
|
|
8
|
+
example a week view and a month view. The `view` state names the active one, and
|
|
9
|
+
`<Calendar.ActiveView />` renders it.
|
|
10
|
+
|
|
11
|
+
## Built-in views
|
|
12
|
+
|
|
13
|
+
The built-in views are source files in the repository's `registry` folder. You add them to your
|
|
14
|
+
app with the shadcn CLI and can change anything in them; see
|
|
15
|
+
[UI source](./installation.md#ui-source-optional).
|
|
16
|
+
|
|
17
|
+
- [Week and day](./views/week-and-day.md): Hours down the side, one column per day, and an all-day row.
|
|
18
|
+
- [Month](./views/month.md): A month grid with multi-day bars and a popover for busy days.
|
|
19
|
+
- [Year](./views/year.md): Twelve months at a glance, with each day's events a click away.
|
|
20
|
+
- [Scrolling views](./views/scrolling.md): Week, day, month and agenda that scroll without end.
|
|
21
|
+
- [Agenda](./views/agenda.md): Upcoming events, grouped by day.
|
|
22
|
+
- [Resource columns](./views/resource-columns.md): A day or a few days of rooms or people side by side, grouped by team.
|
|
23
|
+
- [Resource timeline](./views/resource-timeline.md): Rooms or people as rows and time as columns, for a day, a week or a month.
|
|
24
|
+
- [Custom views](./views/custom-views.md): Write your own view with a strategy and a Renderer.
|
|
25
|
+
|
|
26
|
+
## Registering views
|
|
27
|
+
|
|
28
|
+
Pass views to `createCalendar`. The first one is active by default unless you set `defaultView` or
|
|
29
|
+
`view` on `Root`. TypeScript learns the view names from this list, so `setView` and `defaultView`
|
|
30
|
+
only accept names you registered.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
const Calendar = createCalendar<Meeting>()({
|
|
34
|
+
eventAdapter,
|
|
35
|
+
views: [createWeekView<Meeting>(), createMonthView<Meeting>()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each name must be unique. `createCalendar` throws `calendar-duplicate-view-name` if two views share
|
|
40
|
+
one.
|
|
41
|
+
|
|
42
|
+
## View options
|
|
43
|
+
|
|
44
|
+
A view can declare `defaultOptions`. Override them per calendar with `viewOptions` on `Root`, keyed
|
|
45
|
+
by view name. Each entry is typed from that view's `defaultOptions`, and you only pass the fields you
|
|
46
|
+
want to change. For example, `viewOptions={{ agenda: { weeks: 2 } }}` makes the
|
|
47
|
+
[agenda view](./views/agenda.md) show two weeks instead of four.
|
|
48
|
+
|
|
49
|
+
## Switching views
|
|
50
|
+
|
|
51
|
+
`Calendar.ViewSwitcher` renders a plain `<select>` with one option per registered view:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
const labels = { week: "Week", month: "Month" };
|
|
55
|
+
|
|
56
|
+
<Calendar.ViewSwitcher getViewLabel={(name) => labels[name]} />;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For a styled control, `registry/calendar` has a `ViewSwitcher` built on shadcn's `Select`. The
|
|
60
|
+
[Quick start](./quick-start.md) shows how to connect it. To build your own, call `setView` from
|
|
61
|
+
`useCalendarActions()`. Inside a view's Renderer, use the `actions` prop instead.
|
|
62
|
+
|
|
63
|
+
The active view also drives `Title`, `PreviousTrigger`, and `NextTrigger`. The title comes from the
|
|
64
|
+
view's `getTitle`, and the buttons move by the view's own step: a week in the week view, a month in
|
|
65
|
+
the month view.
|
|
66
|
+
|
|
67
|
+
If the active name doesn't match a registered view, `ActiveView` renders its `fallback` prop, the
|
|
68
|
+
previous and next buttons are disabled, and `meta.diagnostics` includes an `unregistered-active-view`
|
|
69
|
+
error.
|
package/package.json
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltenship/calendar",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Moltenship Time for React, a headless calendar built on the Temporal API with week, day, month, year, agenda and resource views, exact time zones and DST, drag and drop, and actions an AI agent can call.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agenda",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"calendar",
|
|
9
|
+
"drag-and-drop",
|
|
10
|
+
"dst",
|
|
11
|
+
"event-calendar",
|
|
12
|
+
"headless",
|
|
13
|
+
"month-view",
|
|
14
|
+
"nextjs",
|
|
15
|
+
"react",
|
|
16
|
+
"react-calendar",
|
|
17
|
+
"react-component",
|
|
18
|
+
"resource-timeline",
|
|
19
|
+
"scheduler",
|
|
20
|
+
"shadcn",
|
|
21
|
+
"ssr",
|
|
22
|
+
"temporal",
|
|
23
|
+
"timezone",
|
|
24
|
+
"typescript",
|
|
25
|
+
"week-view"
|
|
26
|
+
],
|
|
5
27
|
"homepage": "https://time.molten.sh/docs",
|
|
6
28
|
"bugs": {
|
|
7
29
|
"url": "https://github.com/Moltenship/time/issues"
|
|
@@ -13,7 +35,9 @@
|
|
|
13
35
|
"directory": "packages/calendar"
|
|
14
36
|
},
|
|
15
37
|
"files": [
|
|
16
|
-
"dist"
|
|
38
|
+
"dist",
|
|
39
|
+
"docs",
|
|
40
|
+
"skills"
|
|
17
41
|
],
|
|
18
42
|
"type": "module",
|
|
19
43
|
"sideEffects": false,
|
|
@@ -28,28 +52,32 @@
|
|
|
28
52
|
"access": "public"
|
|
29
53
|
},
|
|
30
54
|
"dependencies": {
|
|
31
|
-
"@moltenship/calendar-core": "
|
|
32
|
-
"@moltenship/calendar-dnd": "
|
|
33
|
-
"@moltenship/calendar-react": "
|
|
34
|
-
"@moltenship/calendar-temporal": "
|
|
55
|
+
"@moltenship/calendar-core": "2.0.0",
|
|
56
|
+
"@moltenship/calendar-dnd": "2.0.0",
|
|
57
|
+
"@moltenship/calendar-react": "2.0.0",
|
|
58
|
+
"@moltenship/calendar-temporal": "2.0.0"
|
|
35
59
|
},
|
|
36
60
|
"devDependencies": {
|
|
37
61
|
"@types/react": "19.3.0",
|
|
38
62
|
"@types/react-dom": "19.3.0",
|
|
39
|
-
"
|
|
40
|
-
"react": "
|
|
41
|
-
"
|
|
63
|
+
"@ui-sdk/core": "0.1.0-beta.16",
|
|
64
|
+
"@ui-sdk/react": "0.1.0-beta.16",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"react": "19.3.1",
|
|
67
|
+
"react-dom": "19.3.1",
|
|
42
68
|
"typescript": "^7.0.2",
|
|
43
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
44
|
-
"vite-plus": "1.
|
|
69
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
70
|
+
"vite-plus": "1.4.0"
|
|
45
71
|
},
|
|
46
72
|
"peerDependencies": {
|
|
73
|
+
"@ui-sdk/core": "^0.1.0-beta.16",
|
|
74
|
+
"@ui-sdk/react": "^0.1.0-beta.16",
|
|
47
75
|
"react": "^19.0.0"
|
|
48
76
|
},
|
|
49
77
|
"scripts": {
|
|
50
|
-
"build": "vp pack",
|
|
51
|
-
"check": "vp check",
|
|
78
|
+
"build": "vp pack && node --run docs",
|
|
52
79
|
"dev": "vp pack --watch",
|
|
80
|
+
"docs": "cd ../../apps/showcase && node --run docs:package",
|
|
53
81
|
"test": "vp test --passWithNoTests"
|
|
54
82
|
}
|
|
55
83
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moltenship-time
|
|
3
|
+
description: Builds calendars with Moltenship Time (@moltenship/calendar), a headless calendar on the Temporal API, built on ui-sdk, with React and SolidJS 2 integrations. Covers composing week, day, month, year, agenda and resource views from the registry, controlling view, date and time zone, saving moved, resized, created and deleted events, policies and undo, making the calendar usable by AI agents through the ui-sdk agent bridge and WebMCP, and testing with @moltenship/calendar-testing. Use whenever a project has @moltenship/calendar or @moltenship/calendar-solid installed, or the user mentions Moltenship Time.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build with Moltenship Time
|
|
7
|
+
|
|
8
|
+
Moltenship Time is a headless calendar. The npm packages hold the behaviour: state, dates and time zones, layout, drag and keyboard editing, recurrence. The views (week, month, agenda and the rest) are source files the app owns, added with the shadcn CLI. Since 2.0 the calendar's parts are [ui-sdk](https://ui-sdk.dev) components, so an AI agent can read the calendar and act on it once the app creates ui-sdk's agent bridge.
|
|
9
|
+
|
|
10
|
+
The engine and the calendar's state import no UI framework. The React and SolidJS 2 integrations have the same parts and hooks, keyboard navigation and dragging included, and the registry has its views in both. Solid's has every view in Tailwind CSS, and no StyleX views, testing package or dnd-kit adapter. This file describes React unless it says otherwise.
|
|
11
|
+
|
|
12
|
+
## Read first
|
|
13
|
+
|
|
14
|
+
The docs for the installed version ship in the package, as Markdown:
|
|
15
|
+
|
|
16
|
+
- `node_modules/@moltenship/calendar/docs/llms.txt` is the index. Read it first.
|
|
17
|
+
- Then read only the pages the task needs, such as `docs/interactions.md` or `docs/agents/connect.md`. Links between pages are relative paths.
|
|
18
|
+
- The API is those docs and the `.d.ts` types. Don't read compiled JavaScript in `dist`. When the docs and types don't answer, write a small test that tries it (see [references/testing.md](references/testing.md)).
|
|
19
|
+
|
|
20
|
+
The same docs are online at https://time.molten.sh/docs, with `https://time.molten.sh/llms.txt` as the index and `.md` after any page's address for its Markdown. Prefer the installed copy: it matches the version in the project.
|
|
21
|
+
|
|
22
|
+
If the package isn't installed yet, in a React app:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`@ui-sdk/core` and `@ui-sdk/react` are peer dependencies since 2.0. Use the project's package manager. The runtime needs `Temporal`: Node.js 26 has it, and a browser without it needs a polyfill loaded before the calendar (`docs/installation.md`). A SolidJS 2 app installs other packages, which [references/solid.md](references/solid.md) lists.
|
|
29
|
+
|
|
30
|
+
## How it fits together
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
your records ──adapter──▶ createCalendar({ eventAdapter, views }) ──▶ Calendar
|
|
34
|
+
│
|
|
35
|
+
<Calendar.Root events=… onEventChange=…> state, saving, policies │
|
|
36
|
+
<Calendar.Frame> the element agents find │
|
|
37
|
+
<CalendarToolbar calendar={Calendar} /> registry source, yours │
|
|
38
|
+
<Calendar.Viewport>
|
|
39
|
+
<Calendar.ActiveView /> the active view's Renderer
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- **The app owns the events.** The calendar never stores or edits them. It proposes a change, and `onEventChange` saves it and updates the `events` you pass.
|
|
43
|
+
- **An adapter reads your records.** `defineEventAdapter<Meeting>()({ getId, getTitle, getInterval, getResourceIds })`. You don't convert records to a library shape.
|
|
44
|
+
- **`createCalendar` returns a typed `Calendar`**: its parts (`Calendar.Root`, `Calendar.Frame`, …) and hooks (`Calendar.useCalendarActions()`, …). Create it once, at module scope.
|
|
45
|
+
- **Views are source in the app**, usually `components/calendar/`. Edit them there.
|
|
46
|
+
- **Six state values**: `view`, `anchorDate`, `timeZone`, `selection`, `focus`, `expandedResourceIds`. Each is uncontrolled (`defaultView`) or controlled (`view` + `onViewChange`).
|
|
47
|
+
|
|
48
|
+
## Pick your path
|
|
49
|
+
|
|
50
|
+
1. **Put a calendar on a page, or add a view**: [references/compose.md](references/compose.md).
|
|
51
|
+
2. **Read or control the view, date, time zone or selection**: [references/state.md](references/state.md).
|
|
52
|
+
3. **Save changes, restrict them, undo them**: [references/changes.md](references/changes.md).
|
|
53
|
+
4. **Let an AI agent use the calendar**: [references/agent-ready.md](references/agent-ready.md).
|
|
54
|
+
5. **Test it**: [references/testing.md](references/testing.md).
|
|
55
|
+
6. **SolidJS**: [references/solid.md](references/solid.md). It has no StyleX views or testing package; read that file before promising anything.
|
|
56
|
+
|
|
57
|
+
Before you finish, check your work against [references/mistakes.md](references/mistakes.md).
|
|
58
|
+
|
|
59
|
+
## Rules for every path
|
|
60
|
+
|
|
61
|
+
- **`Temporal`, never `Date`.** A timed event's `start` and `end` are `Temporal.Instant`, an all-day event's are `Temporal.PlainDate`, a floating one's `Temporal.PlainDateTime`. `anchorDate` is a `Temporal.PlainDate`. Convert at the edge of the app: `Temporal.Instant.from(record.startsAt)`.
|
|
62
|
+
- **Ends are exclusive.** An all-day event on October 8 has `end` October 9. A range is never empty or reversed.
|
|
63
|
+
- **Time zones are explicit.** `Root` needs `defaultTimeZone` or `timeZone` (an IANA name), `locale` and `weekRules`. Nothing reads the system zone for you.
|
|
64
|
+
- **Import from `@moltenship/calendar`.** It re-exports the React integration, the engine and the Temporal helpers. Add `@moltenship/calendar-recurrence`, `@moltenship/ics` or `@moltenship/calendar-dnd-kit` only for those features. Don't import `@moltenship/calendar-core`, `-react`, `-primitives`, `-temporal` or `-dnd` in an app.
|
|
65
|
+
- **Use the hooks on your `Calendar`**, such as `Calendar.useCalendarActions()`, inside its `Root`. They carry your event and view types. Outside `Root` they throw `calendar-hook-outside-root`.
|
|
66
|
+
- **Without `onEventChange` the calendar is read-only**, for people and agents alike.
|
|
67
|
+
- **Give the frame a height.** The views fill `Calendar.Frame` and scroll inside it.
|
|
68
|
+
- **Calendar modules are Client Components** in the Next.js App Router: start the file with `"use client"`.
|
|
69
|
+
- **Keep one copy of `@ui-sdk/core`.** Every `@ui-sdk/*` package on the same version. With two copies an agent sees no calendar.
|
|
70
|
+
- **Don't invent API.** If a name isn't in the docs or the types, it doesn't exist. `Root` has no `onEventClick`, the views have no `onEventClick` option, and an agent's actions are the fifteen in agent-ready.md and no others. What a view does on a click is in its source, which the app owns.
|
|
71
|
+
|
|
72
|
+
## When you're done
|
|
73
|
+
|
|
74
|
+
1. **Typecheck** with the project's own command.
|
|
75
|
+
2. **Run the tests**, and add one for what you built. A calendar that agents use gets a test that runs a step through the bridge (testing.md has it).
|
|
76
|
+
3. **Look at it in a browser** when you changed what people see. jsdom lays nothing out, so sizes, scrolling and pointer drags aren't checked there.
|
|
77
|
+
4. **Report** each command you ran with its exit code, what you couldn't check, and anything the docs or types got wrong.
|