@moltenship/calendar 2.0.0-beta.1 → 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 +11 -10
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/docs/accessibility.md +5 -4
- package/docs/agents/changes.md +3 -3
- package/docs/agents/coding-agents.md +19 -20
- package/docs/agents/connect.md +20 -11
- package/docs/agents/deleting.md +2 -2
- package/docs/agents/reference.md +5 -6
- package/docs/agents/server.md +4 -4
- package/docs/agents/webmcp.md +2 -2
- package/docs/agents.md +10 -8
- package/docs/annotations.md +10 -8
- package/docs/api/changes.md +37 -21
- package/docs/api/{react.md → components.md} +65 -56
- package/docs/api/dnd-kit.md +1 -3
- package/docs/api/events.md +14 -13
- package/docs/api/primitives.md +61 -11
- package/docs/api/store.md +3 -3
- package/docs/api.md +23 -23
- package/docs/availability.md +25 -22
- package/docs/comparison.md +23 -24
- package/docs/concepts/anatomy.md +3 -3
- package/docs/concepts/events.md +2 -3
- package/docs/concepts/how-it-works.md +33 -16
- package/docs/concepts/state.md +1 -1
- package/docs/concepts/time.md +5 -7
- package/docs/customization.md +271 -0
- package/docs/frameworks.md +116 -0
- package/docs/guides/dnd-kit.md +2 -2
- package/docs/guides/google-calendar-sync.md +3 -3
- package/docs/guides/google-calendar.md +4 -4
- package/docs/guides/motion.md +2 -2
- package/docs/guides/nextjs-app-router.md +1 -1
- package/docs/guides/nextjs.md +1 -1
- package/docs/guides/performance.md +6 -6
- package/docs/guides/tanstack-query.md +2 -2
- package/docs/{guides/ics.md → ics/feed.md} +7 -9
- package/docs/ics/import.md +183 -0
- package/docs/{api/ics.md → ics/reference.md} +11 -53
- package/docs/ics.md +142 -0
- package/docs/index.md +81 -50
- package/docs/installation.md +48 -33
- package/docs/interactions.md +36 -3
- package/docs/llms.txt +81 -68
- package/docs/migrating-to-2.md +200 -25
- package/docs/quick-start.md +27 -23
- package/docs/{guides/recurring-events.md → recurrence/calendar.md} +23 -8
- package/docs/{concepts/recurrence.md → recurrence/model.md} +13 -12
- package/docs/{api/recurrence.md → recurrence/reference.md} +22 -61
- package/docs/recurrence.md +122 -0
- package/docs/stylex.md +74 -49
- package/docs/temporal/daylight-saving-time.md +172 -0
- package/docs/temporal/month-grid.md +119 -0
- package/docs/{api/temporal.md → temporal/reference.md} +7 -12
- package/docs/temporal.md +105 -0
- package/docs/testing.md +20 -1
- package/docs/theme-builder.md +9 -8
- package/docs/theming.md +108 -2
- package/docs/undo-redo.md +24 -16
- package/docs/views/agenda.md +14 -13
- package/docs/views/custom-views.md +13 -10
- package/docs/views/month.md +10 -9
- package/docs/views/resource-columns.md +21 -17
- package/docs/views/resource-timeline.md +16 -15
- package/docs/views/scrolling.md +7 -6
- package/docs/views/week-and-day.md +15 -14
- package/docs/views/year.md +11 -11
- package/docs/views.md +1 -1
- package/package.json +7 -6
- package/skills/moltenship-time/SKILL.md +7 -5
- package/skills/moltenship-time/references/compose.md +13 -6
- package/skills/moltenship-time/references/mistakes.md +4 -2
- package/skills/moltenship-time/references/solid.md +36 -25
- package/docs/api/solid.md +0 -460
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A day or a few days of rooms or people side by side, grouped by team, with hundreds of columns.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views/resource-columns
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/resource-columns
|
|
6
6
|
|
|
7
|
-
> Live example of the `resources` view: see it at https://time.molten.sh/docs/views/resource-columns
|
|
7
|
+
> Live example of the `resources` view: see it at https://time.molten.sh/docs/react/views/resource-columns
|
|
8
8
|
|
|
9
9
|
Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Resources in the view
|
|
10
10
|
switcher.
|
|
@@ -137,7 +137,7 @@ at a glance, while a person's meetings sit side by side. `getResourceOverlapLayo
|
|
|
137
137
|
resource's columns a layout of its own; it takes the resource with your `data` type, so it can read
|
|
138
138
|
what kind it is:
|
|
139
139
|
|
|
140
|
-
> Live example: see it at https://time.molten.sh/docs/views/resource-columns
|
|
140
|
+
> Live example: see it at https://time.molten.sh/docs/react/views/resource-columns
|
|
141
141
|
|
|
142
142
|
```tsx
|
|
143
143
|
const view = createResourceColumnsView<Meeting, Resource>({
|
|
@@ -171,7 +171,7 @@ they're not parts you compose: to change one, edit its file. The exception is ea
|
|
|
171
171
|
row, which you can replace with [`ResourceHeader`](#avatars-and-icons). The tree shows where each
|
|
172
172
|
part lives.
|
|
173
173
|
|
|
174
|
-
> Diagram: see it at https://time.molten.sh/docs/views/resource-columns
|
|
174
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/resource-columns
|
|
175
175
|
|
|
176
176
|
```txt title="Rendered by ResourceColumnsView"
|
|
177
177
|
ResourceColumnsView resource-columns-view.tsx
|
|
@@ -189,26 +189,30 @@ ResourceColumnsView resource-columns-view.tsx
|
|
|
189
189
|
└── Now line data-slot="time-grid-now"
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
-
|
|
193
|
-
width until they are 128px per day, then the
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
them
|
|
192
|
+
- The column virtualizer in `column-virtualizer.ts`, which `use-column-virtualizer.ts` binds,
|
|
193
|
+
decides which columns render. Columns share the width until they are 128px per day, then the
|
|
194
|
+
view scrolls sideways.
|
|
195
|
+
- The header, all-day row and gutter sit beside the scrolling body, not over it. The axis sync in
|
|
196
|
+
`axis-sync.ts`, which `use-axis-sync.ts` binds, moves them with the body's scroll, so a drag never
|
|
197
|
+
lands on a column hidden behind them.
|
|
198
|
+
- Words such as "Unassigned" are in `resource-columns-labels.ts`, sizes in
|
|
199
|
+
`resource-columns-layout.ts`, and the classes in `resource-columns.styles.ts`.
|
|
197
200
|
|
|
198
201
|
## Options
|
|
199
202
|
|
|
200
|
-
| Name | Type | Default | Description
|
|
201
|
-
| -------------------------- | ----------------------------------------------------------------------- | ----------------------- |
|
|
202
|
-
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar.
|
|
203
|
+
| Name | Type | Default | Description |
|
|
204
|
+
| -------------------------- | ----------------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
|
+
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
|
|
206
|
+
| `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). |
|
|
203
207
|
| `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
|
|
204
208
|
| `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). |
|
|
205
209
|
| `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | An event's own layout, such as its calendar's, as in the [week and day views](./week-and-day.md#by-calendar). A group that disagrees takes its column's. |
|
|
206
|
-
| `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | A resource's layout in its columns, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`. See [rooms and people](#rooms-and-people).
|
|
210
|
+
| `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | A resource's layout in its columns, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`. See [rooms and people](#rooms-and-people). |
|
|
207
211
|
| `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | How overlapping events share a resource's column, as in the [week and day views](./week-and-day.md#overlapping-events), unless `getResourceOverlapLayout` gives the resource its own. |
|
|
208
|
-
| `ResourceHeader` | `ComponentType<ResourceHeaderProps<TResource>>` | `DefaultResourceHeader` | Draws each header's name row from the `resource-header.tsx` parts. See [avatars and icons](#avatars-and-icons).
|
|
209
|
-
| `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.
|
|
210
|
-
| `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" column after the resources.
|
|
211
|
-
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time:
|
|
212
|
+
| `ResourceHeader` | `ComponentType<ResourceHeaderProps<TResource>>` | `DefaultResourceHeader` | Draws each header's name row from the `resource-header.tsx` parts. See [avatars and icons](#avatars-and-icons). |
|
|
213
|
+
| `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. |
|
|
214
|
+
| `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" column after the resources. |
|
|
215
|
+
| `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). |
|
|
212
216
|
| `resourceStatus` | `boolean \| ResourceStatusOptions` | | Shows each resource's status, such as "Busy until 3:00 PM". See [busy badge](../availability.md#busy-badge-in-resource-views). |
|
|
213
217
|
|
|
214
218
|
Set options when you create the view, or per calendar with
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Rooms or people as rows and time as columns, for a day, a week or a month, with hundreds of rows.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views/resource-timeline
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/resource-timeline
|
|
6
6
|
|
|
7
|
-
> Live example of the `timeline` view: see it at https://time.molten.sh/docs/views/resource-timeline
|
|
7
|
+
> Live example of the `timeline` view: see it at https://time.molten.sh/docs/react/views/resource-timeline
|
|
8
8
|
|
|
9
9
|
Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Timeline in the view
|
|
10
10
|
switcher.
|
|
@@ -19,7 +19,7 @@ fast with hundreds of resources over a whole month.
|
|
|
19
19
|
|
|
20
20
|
Add the view to your app with the shadcn CLI, as described in
|
|
21
21
|
[UI source](../installation.md#ui-source-optional). The item brings the theme, the shared
|
|
22
|
-
`calendar` parts, shadcn's `button`, and `@tanstack/
|
|
22
|
+
`calendar` parts, shadcn's `button`, and `@tanstack/virtual-core`:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
npx shadcn@latest add https://time.molten.sh/r/resource-timeline-view.json
|
|
@@ -75,7 +75,7 @@ toggles it. To control expansion yourself, pass `expandedResourceIds` and
|
|
|
75
75
|
`ResourceTimelineView` renders the parts below. The view builds them itself from its projection, so
|
|
76
76
|
they're not parts you compose: to change one, edit its file. The tree shows where each part lives.
|
|
77
77
|
|
|
78
|
-
> Diagram: see it at https://time.molten.sh/docs/views/resource-timeline
|
|
78
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/resource-timeline
|
|
79
79
|
|
|
80
80
|
```txt title="Rendered by ResourceTimelineView"
|
|
81
81
|
ResourceTimelineView resource-timeline-view.tsx
|
|
@@ -104,17 +104,18 @@ ResourceTimelineView resource-timeline-view.tsx
|
|
|
104
104
|
|
|
105
105
|
## Options
|
|
106
106
|
|
|
107
|
-
| Name | Type | Default | Description
|
|
108
|
-
| -------------------------- | ----------------------------------------------------------------------- | ----------- |
|
|
109
|
-
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar.
|
|
107
|
+
| Name | Type | Default | Description |
|
|
108
|
+
| -------------------------- | ----------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
|
|
110
|
+
| `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). |
|
|
110
111
|
| `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
|
|
111
112
|
| `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). |
|
|
112
|
-
| `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, an event's own layout, such as its calendar's: a group of overlapping events in a row takes it when they all agree. See [stacked rows](#stacked-rows).
|
|
113
|
-
| `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, a resource's layout in its row, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`.
|
|
114
|
-
| `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | In an hour timeline, how a row shares out overlapping events: a lane for each level of overlap, or `"stack"` to cascade them. See [stacked rows](#stacked-rows).
|
|
115
|
-
| `slotUnit` | `"hour" \| "day"` | | What a column spans: hours for a day and days for a week or a month unless you set it.
|
|
116
|
-
| `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" row after the resources.
|
|
117
|
-
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time and closed days:
|
|
113
|
+
| `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, an event's own layout, such as its calendar's: a group of overlapping events in a row takes it when they all agree. See [stacked rows](#stacked-rows). |
|
|
114
|
+
| `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, a resource's layout in its row, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`. |
|
|
115
|
+
| `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | In an hour timeline, how a row shares out overlapping events: a lane for each level of overlap, or `"stack"` to cascade them. See [stacked rows](#stacked-rows). |
|
|
116
|
+
| `slotUnit` | `"hour" \| "day"` | | What a column spans: hours for a day and days for a week or a month unless you set it. |
|
|
117
|
+
| `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" row after the resources. |
|
|
118
|
+
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time and closed days: a function of its props and its state. See [customize the shading](../availability.md#customize-the-shading). |
|
|
118
119
|
| `resourceStatus` | `boolean \| ResourceStatusOptions` | | Shows each resource's status, such as "Busy until 3:00 PM". See [busy badge](../availability.md#busy-badge-in-resource-views). |
|
|
119
120
|
|
|
120
121
|
Set options when you create the view, or per calendar with
|
|
@@ -151,7 +152,7 @@ Set options when you create the view, or per calendar with
|
|
|
151
152
|
|
|
152
153
|
A day of rooms and people, in hours:
|
|
153
154
|
|
|
154
|
-
> Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/views/resource-timeline
|
|
155
|
+
> Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/react/views/resource-timeline
|
|
155
156
|
|
|
156
157
|
## Stacked rows
|
|
157
158
|
|
|
@@ -161,7 +162,7 @@ lane below the one it covers and is drawn over it, and a deep stack steps less,
|
|
|
161
162
|
more than two lanes tall. `getResourceOverlapLayout` picks it per resource, as in
|
|
162
163
|
[resource columns](./resource-columns.md#rooms-and-people):
|
|
163
164
|
|
|
164
|
-
> Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/views/resource-timeline
|
|
165
|
+
> Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/react/views/resource-timeline
|
|
165
166
|
|
|
166
167
|
```tsx
|
|
167
168
|
const view = createTimelineDayView<Meeting, Resource>({
|
package/docs/views/scrolling.md
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Week, day and month views that scroll without end, swiping a page at a time.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views/scrolling
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/scrolling
|
|
6
6
|
|
|
7
7
|
**Week**
|
|
8
8
|
|
|
9
|
-
> Live example of the `scrolling-week` view: see it at https://time.molten.sh/docs/views/scrolling
|
|
9
|
+
> Live example of the `scrolling-week` view: see it at https://time.molten.sh/docs/react/views/scrolling
|
|
10
10
|
|
|
11
11
|
**3 days**
|
|
12
12
|
|
|
13
|
-
> Live example of the `scrolling-3-day` view: see it at https://time.molten.sh/docs/views/scrolling
|
|
13
|
+
> Live example of the `scrolling-3-day` view: see it at https://time.molten.sh/docs/react/views/scrolling
|
|
14
14
|
|
|
15
15
|
**Day**
|
|
16
16
|
|
|
17
|
-
> Live example of the `scrolling-day` view: see it at https://time.molten.sh/docs/views/scrolling
|
|
17
|
+
> Live example of the `scrolling-day` view: see it at https://time.molten.sh/docs/react/views/scrolling
|
|
18
18
|
|
|
19
19
|
Try them in the [live demo](https://moltenship-time-demo.vercel.app): turn on "Scroll days, weeks,
|
|
20
20
|
months and agenda" in the settings.
|
|
@@ -97,7 +97,7 @@ The month shows the anchor's month as the paged month does: six weeks from the o
|
|
|
97
97
|
first day, which every month fits, with the days of other months dimmed. A swipe comes to rest on
|
|
98
98
|
the next month with its first week on top, four or five weeks on, so the distance varies.
|
|
99
99
|
|
|
100
|
-
> Live example of the `scrolling-month` view: see it at https://time.molten.sh/docs/views/scrolling
|
|
100
|
+
> Live example of the `scrolling-month` view: see it at https://time.molten.sh/docs/react/views/scrolling
|
|
101
101
|
|
|
102
102
|
## Loading events as you scroll
|
|
103
103
|
|
|
@@ -176,7 +176,8 @@ from screen readers, so the grid reads as one week, one day, or six weeks.
|
|
|
176
176
|
|
|
177
177
|
Drag, resize, and create work as in the paged views. Dragging toward an edge keeps scrolling into
|
|
178
178
|
the days or weeks beyond, rendering them as it goes. The week and day views stop snapping while a
|
|
179
|
-
gesture is under way, and come to rest on the nearest page when you let go.
|
|
179
|
+
gesture is under way, and come to rest on the nearest page when you let go. The `dragPreview`
|
|
180
|
+
option picks [snapped or free drags](../interactions.md#snapped-and-free-drags) here too.
|
|
180
181
|
|
|
181
182
|
## How it's built
|
|
182
183
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Time-grid views with an all-day row, a current-time line, and DST-aware hours.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views/week-and-day
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/week-and-day
|
|
6
6
|
|
|
7
|
-
> Live example of the `week` view: see it at https://time.molten.sh/docs/views/week-and-day
|
|
7
|
+
> Live example of the `week` view: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
8
8
|
|
|
9
9
|
Try both views in the [live demo](https://moltenship-time-demo.vercel.app).
|
|
10
10
|
|
|
@@ -48,7 +48,7 @@ All three views render `TimeGridView` from `registry/time-grid-view`, with seven
|
|
|
48
48
|
week, three for the 3-day view and one for the day. The view builds these parts itself, so they're
|
|
49
49
|
not parts you compose: to change one, edit its file. The tree shows where each part lives.
|
|
50
50
|
|
|
51
|
-
> Diagram: see it at https://time.molten.sh/docs/views/week-and-day
|
|
51
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
52
52
|
|
|
53
53
|
```txt title="Rendered by TimeGridView"
|
|
54
54
|
TimeGridView time-grid-view.tsx
|
|
@@ -75,16 +75,17 @@ TimeGridView time-grid-view.tsx
|
|
|
75
75
|
|
|
76
76
|
## Options
|
|
77
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.
|
|
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). |
|
|
81
82
|
| `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
|
|
82
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). |
|
|
83
|
-
| `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).
|
|
84
|
-
| `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | How overlapping events share a day column. See [overlapping events](#overlapping-events).
|
|
85
|
-
| `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.
|
|
86
|
-
| `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar.
|
|
87
|
-
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time:
|
|
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). |
|
|
88
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). |
|
|
89
90
|
|
|
90
91
|
Set options when you create the view, or per calendar with
|
|
@@ -116,7 +117,7 @@ Set options when you create the view, or per calendar with
|
|
|
116
117
|
|
|
117
118
|
The day view works on narrow screens:
|
|
118
119
|
|
|
119
|
-
> Live example of the `day` view: see it at https://time.molten.sh/docs/views/week-and-day
|
|
120
|
+
> Live example of the `day` view: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
120
121
|
|
|
121
122
|
## Overlapping events
|
|
122
123
|
|
|
@@ -124,7 +125,7 @@ The day view works on narrow screens:
|
|
|
124
125
|
and drag an event to see the others make room. "Stack focus time" gives the purple focus time
|
|
125
126
|
calendar a layout of its own, as [by calendar](#by-calendar) describes:
|
|
126
127
|
|
|
127
|
-
> Live example: see it at https://time.molten.sh/docs/views/week-and-day
|
|
128
|
+
> Live example: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
128
129
|
|
|
129
130
|
- **`"columns"`** (the default) puts overlapping events side by side, in as few lanes as they
|
|
130
131
|
need. Each event widens into lanes that stay free beside it, as Google Calendar draws them.
|
|
@@ -190,7 +191,7 @@ view's `overlapLayout`. An event without a layout of its own counts as the view'
|
|
|
190
191
|
Pass `secondaryTimeZones` to `Root` to label the hours in other time zones too, like Google
|
|
191
192
|
Calendar's secondary time zone. Each zone gets a column of hours beside the calendar's own:
|
|
192
193
|
|
|
193
|
-
> Live example: see it at https://time.molten.sh/docs/views/week-and-day
|
|
194
|
+
> Live example: see it at https://time.molten.sh/docs/react/views/week-and-day
|
|
194
195
|
|
|
195
196
|
```tsx
|
|
196
197
|
<Calendar.Root
|
package/docs/views/year.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Twelve months at a glance, with a dot for each event color on a day and a popover of its events.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views/year
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views/year
|
|
6
6
|
|
|
7
|
-
> Live example of the `year` view: see it at https://time.molten.sh/docs/views/year
|
|
7
|
+
> Live example of the `year` view: see it at https://time.molten.sh/docs/react/views/year
|
|
8
8
|
|
|
9
9
|
Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Year in the view switcher,
|
|
10
10
|
or press Y.
|
|
@@ -47,7 +47,7 @@ The view is named `year`. Previous and Next move by one year. Its range is the w
|
|
|
47
47
|
`YearView` renders the parts below. To change one, edit it in the `components/calendar/year-view`
|
|
48
48
|
files you added.
|
|
49
49
|
|
|
50
|
-
> Diagram: see it at https://time.molten.sh/docs/views/year
|
|
50
|
+
> Diagram: see it at https://time.molten.sh/docs/react/views/year
|
|
51
51
|
|
|
52
52
|
```txt title="Rendered by YearView"
|
|
53
53
|
YearView year-view.tsx
|
|
@@ -62,19 +62,19 @@ YearView year-view.tsx
|
|
|
62
62
|
└── YearEvent a [data-event-id] button per event
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
The popover is one
|
|
66
|
-
hundreds of popovers.
|
|
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
67
|
|
|
68
68
|
## Options
|
|
69
69
|
|
|
70
|
-
| Name | Type | Default | Description
|
|
71
|
-
| ------------------- | ---------------------------------------- | -------------- |
|
|
70
|
+
| Name | Type | Default | Description |
|
|
71
|
+
| ------------------- | ---------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
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
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).
|
|
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
78
|
| `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of the closed days `closedDays` picks. See [Availability](../availability.md#customize-the-shading). |
|
|
79
79
|
|
|
80
80
|
## What it shows
|
package/docs/views.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
How views work, how to switch between them, and which ones exist today.
|
|
4
4
|
|
|
5
|
-
Source: https://time.molten.sh/docs/views
|
|
5
|
+
Source: https://time.molten.sh/docs/react/views
|
|
6
6
|
|
|
7
7
|
A view decides which dates are visible and how to draw them. A calendar can have several views, for
|
|
8
8
|
example a week view and a month view. The `view` state names the active one, and
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltenship/calendar",
|
|
3
|
-
"version": "2.0.0
|
|
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
5
|
"keywords": [
|
|
6
6
|
"agenda",
|
|
7
|
+
"ai-agents",
|
|
7
8
|
"calendar",
|
|
8
9
|
"drag-and-drop",
|
|
9
10
|
"dst",
|
|
@@ -51,10 +52,10 @@
|
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@moltenship/calendar-core": "2.0.0
|
|
55
|
-
"@moltenship/calendar-dnd": "2.0.0
|
|
56
|
-
"@moltenship/calendar-react": "2.0.0
|
|
57
|
-
"@moltenship/calendar-temporal": "2.0.0
|
|
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"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@types/react": "19.3.0",
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: moltenship-time
|
|
3
|
-
description: Builds calendars with Moltenship Time (@moltenship/calendar), a headless calendar
|
|
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
4
|
---
|
|
5
5
|
|
|
6
6
|
# Build with Moltenship Time
|
|
7
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
|
|
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.
|
|
9
11
|
|
|
10
12
|
## Read first
|
|
11
13
|
|
|
@@ -17,13 +19,13 @@ The docs for the installed version ship in the package, as Markdown:
|
|
|
17
19
|
|
|
18
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.
|
|
19
21
|
|
|
20
|
-
If the package isn't installed yet:
|
|
22
|
+
If the package isn't installed yet, in a React app:
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
25
|
pnpm add @moltenship/calendar @ui-sdk/core @ui-sdk/react react react-dom
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
`@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`).
|
|
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.
|
|
27
29
|
|
|
28
30
|
## How it fits together
|
|
29
31
|
|
|
@@ -50,7 +52,7 @@ your records ──adapter──▶ createCalendar({ eventAdapter, views }) ─
|
|
|
50
52
|
3. **Save changes, restrict them, undo them**: [references/changes.md](references/changes.md).
|
|
51
53
|
4. **Let an AI agent use the calendar**: [references/agent-ready.md](references/agent-ready.md).
|
|
52
54
|
5. **Test it**: [references/testing.md](references/testing.md).
|
|
53
|
-
6. **SolidJS**: [references/solid.md](references/solid.md). It
|
|
55
|
+
6. **SolidJS**: [references/solid.md](references/solid.md). It has no StyleX views or testing package; read that file before promising anything.
|
|
54
56
|
|
|
55
57
|
Before you finish, check your work against [references/mistakes.md](references/mistakes.md).
|
|
56
58
|
|
|
@@ -4,7 +4,7 @@ A calendar is three things: an adapter that reads your records, a `Calendar` mad
|
|
|
4
4
|
|
|
5
5
|
## 1. Add the views
|
|
6
6
|
|
|
7
|
-
The views are source files, added with the shadcn CLI from the registry at `https://time.molten.sh/r/`. They
|
|
7
|
+
The views are source files, added with the shadcn CLI from the registry at `https://time.molten.sh/r/`. They use shadcn/ui's tokens and bring their own controls (`calendar-ui`, on ui-sdk), so any shadcn style works. An app with a `components.json` but without shadcn's tokens adds `base-tokens`. Check for existing files in `components/calendar/` before adding: the app may already have them.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npx shadcn@latest add \
|
|
@@ -26,11 +26,18 @@ npx shadcn@latest add \
|
|
|
26
26
|
| `scrolling-list-view` | `createScrollingAgendaView` | `scrolling-list-view/scrolling-agenda-view` | `docs/views/agenda.md` |
|
|
27
27
|
| `calendar-full` | Every other item in this table | | `docs/installation.md` |
|
|
28
28
|
| `calendar-history-toast` | `CalendarHistoryToast` (an Undo toast) | `calendar-history-toast/calendar-history-toast` | `docs/undo-redo.md` |
|
|
29
|
-
| `recurrence-scope-dialog` | "This event, following, or all?" | `recurrence-scope-dialog/use-recurrence-scope-prompt` | `docs/
|
|
29
|
+
| `recurrence-scope-dialog` | "This event, following, or all?" | `recurrence-scope-dialog/use-recurrence-scope-prompt` | `docs/recurrence/calendar.md` |
|
|
30
30
|
|
|
31
|
-
Every view item brings the shared `calendar` item: `calendar-toolbar`, `view-switcher`, `event-colors`, `announcements`, the theme. Each item also has a `stylex-` twin for apps on StyleX (`docs/stylex.md`).
|
|
31
|
+
Every view item brings the shared `calendar` item: `calendar-toolbar`, `view-switcher`, `event-colors`, `announcements`, the theme, and `calendar-ui`, the calendar's own buttons, badges, tooltips and selects on ui-sdk (they don't use the app's `components/ui`). They're a default the app owns: to use the app's own control, make its file in `components/calendar/ui/` render it with the same exports and props (theming docs, "Use your own controls"). Each item also has a `stylex-` twin for apps on StyleX (`docs/stylex.md`).
|
|
32
32
|
|
|
33
|
-
`shadcn add` installs `@moltenship/calendar
|
|
33
|
+
`shadcn add` installs `@moltenship/calendar`, and `calendar-ui` adds `@ui-sdk/core` and `@ui-sdk/react` when the app has none. Keep every `@ui-sdk/*` package on the calendar's version.
|
|
34
|
+
|
|
35
|
+
ui-sdk adds CSS in a layer named `ui-sdk`. The app's global CSS names that layer before Tailwind, or the layer wins over Tailwind's utilities:
|
|
36
|
+
|
|
37
|
+
```css title="globals.css"
|
|
38
|
+
@layer ui-sdk;
|
|
39
|
+
@import "tailwindcss";
|
|
40
|
+
```
|
|
34
41
|
|
|
35
42
|
Read a view's docs page for its options before you set any. Options differ between views.
|
|
36
43
|
|
|
@@ -126,7 +133,7 @@ export function TeamCalendar({ meetings }: { readonly meetings: readonly Meeting
|
|
|
126
133
|
|
|
127
134
|
`Root` requires `events`, `locale`, `weekRules`, a date (`defaultAnchorDate` or `anchorDate`) and a time zone (`defaultTimeZone` or `timeZone`). It renders no element of its own.
|
|
128
135
|
|
|
129
|
-
The
|
|
136
|
+
The views' tooltips, popovers, dialogs and toasts come from `calendar-ui` and need no provider. The global CSS names `@layer ui-sdk;` before `@import "tailwindcss"`.
|
|
130
137
|
|
|
131
138
|
With server rendering, the server and the browser must agree on the date and time. Pass `now` (a `Temporal.Instant` made on the server) and a fixed date instead of `Temporal.Now` in the component (`docs/guides/nextjs.md`).
|
|
132
139
|
|
|
@@ -157,7 +164,7 @@ Rooms or people that events belong to are `resources` on `Root`, and `getResourc
|
|
|
157
164
|
|
|
158
165
|
## Recurring events
|
|
159
166
|
|
|
160
|
-
Recurrence is a layer over ordinary events, in `@moltenship/calendar-recurrence`: you expand series into occurrences and pass those as `events`. Read `docs/
|
|
167
|
+
Recurrence is a layer over ordinary events, in `@moltenship/calendar-recurrence`: you expand series into occurrences and pass those as `events`. Read `docs/recurrence/model.md` and `docs/recurrence/calendar.md` before writing any of it. Don't expand RRULEs by hand.
|
|
161
168
|
|
|
162
169
|
## A view of your own
|
|
163
170
|
|
|
@@ -27,9 +27,11 @@ These are the mistakes this library's shape makes easy: the ones a coding agent
|
|
|
27
27
|
| A calendar with no height | Give `Calendar.Frame` a height; `Viewport` takes `min-h-0 flex-1` |
|
|
28
28
|
| Missing `"use client"` in the App Router | Calendar modules are Client Components |
|
|
29
29
|
| Wrapping the calendar in a context "provider" you invented | `Root` is the provider. There is no other |
|
|
30
|
-
| `shadcn add` into an app
|
|
31
|
-
| Installing only `@moltenship/calendar` on 2.0 | Also `@ui-sdk/core` and `@ui-sdk/react
|
|
30
|
+
| `shadcn add` into an app without shadcn's tokens | The views read `--background`, `--primary` and the rest. Add `base-tokens` |
|
|
31
|
+
| Installing only `@moltenship/calendar` on 2.0 | Also `@ui-sdk/core` and `@ui-sdk/react`, on the calendar's version |
|
|
32
|
+
| No `@layer ui-sdk;` before `@import "tailwindcss"` | ui-sdk's popover CSS wins over Tailwind: the view select's list loses its look |
|
|
32
33
|
| Selecting `[data-slot="calendar"]` to find a shadcn date picker | In 2.0 `Calendar.Frame` renders it too. Scope the selector, or use `data-calendar-part="frame"` for the scheduler |
|
|
34
|
+
| `useCalendarPointer` from `@moltenship/calendar-dnd` on 2.0 | 2.0 moved it to the React integration. Import it from `@moltenship/calendar` |
|
|
33
35
|
|
|
34
36
|
## State
|
|
35
37
|
|