@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.
Files changed (75) hide show
  1. package/README.md +11 -10
  2. package/dist/index.d.mts +2 -2
  3. package/dist/index.mjs +2 -2
  4. package/docs/accessibility.md +5 -4
  5. package/docs/agents/changes.md +3 -3
  6. package/docs/agents/coding-agents.md +19 -20
  7. package/docs/agents/connect.md +20 -11
  8. package/docs/agents/deleting.md +2 -2
  9. package/docs/agents/reference.md +5 -6
  10. package/docs/agents/server.md +4 -4
  11. package/docs/agents/webmcp.md +2 -2
  12. package/docs/agents.md +10 -8
  13. package/docs/annotations.md +10 -8
  14. package/docs/api/changes.md +37 -21
  15. package/docs/api/{react.md → components.md} +65 -56
  16. package/docs/api/dnd-kit.md +1 -3
  17. package/docs/api/events.md +14 -13
  18. package/docs/api/primitives.md +61 -11
  19. package/docs/api/store.md +3 -3
  20. package/docs/api.md +23 -23
  21. package/docs/availability.md +25 -22
  22. package/docs/comparison.md +23 -24
  23. package/docs/concepts/anatomy.md +3 -3
  24. package/docs/concepts/events.md +2 -3
  25. package/docs/concepts/how-it-works.md +33 -16
  26. package/docs/concepts/state.md +1 -1
  27. package/docs/concepts/time.md +5 -7
  28. package/docs/customization.md +271 -0
  29. package/docs/frameworks.md +116 -0
  30. package/docs/guides/dnd-kit.md +2 -2
  31. package/docs/guides/google-calendar-sync.md +3 -3
  32. package/docs/guides/google-calendar.md +4 -4
  33. package/docs/guides/motion.md +2 -2
  34. package/docs/guides/nextjs-app-router.md +1 -1
  35. package/docs/guides/nextjs.md +1 -1
  36. package/docs/guides/performance.md +6 -6
  37. package/docs/guides/tanstack-query.md +2 -2
  38. package/docs/{guides/ics.md → ics/feed.md} +7 -9
  39. package/docs/ics/import.md +183 -0
  40. package/docs/{api/ics.md → ics/reference.md} +11 -53
  41. package/docs/ics.md +142 -0
  42. package/docs/index.md +81 -50
  43. package/docs/installation.md +48 -33
  44. package/docs/interactions.md +36 -3
  45. package/docs/llms.txt +81 -68
  46. package/docs/migrating-to-2.md +200 -25
  47. package/docs/quick-start.md +27 -23
  48. package/docs/{guides/recurring-events.md → recurrence/calendar.md} +23 -8
  49. package/docs/{concepts/recurrence.md → recurrence/model.md} +13 -12
  50. package/docs/{api/recurrence.md → recurrence/reference.md} +22 -61
  51. package/docs/recurrence.md +122 -0
  52. package/docs/stylex.md +74 -49
  53. package/docs/temporal/daylight-saving-time.md +172 -0
  54. package/docs/temporal/month-grid.md +119 -0
  55. package/docs/{api/temporal.md → temporal/reference.md} +7 -12
  56. package/docs/temporal.md +105 -0
  57. package/docs/testing.md +20 -1
  58. package/docs/theme-builder.md +9 -8
  59. package/docs/theming.md +108 -2
  60. package/docs/undo-redo.md +24 -16
  61. package/docs/views/agenda.md +14 -13
  62. package/docs/views/custom-views.md +13 -10
  63. package/docs/views/month.md +10 -9
  64. package/docs/views/resource-columns.md +21 -17
  65. package/docs/views/resource-timeline.md +16 -15
  66. package/docs/views/scrolling.md +7 -6
  67. package/docs/views/week-and-day.md +15 -14
  68. package/docs/views/year.md +11 -11
  69. package/docs/views.md +1 -1
  70. package/package.json +7 -6
  71. package/skills/moltenship-time/SKILL.md +7 -5
  72. package/skills/moltenship-time/references/compose.md +13 -6
  73. package/skills/moltenship-time/references/mistakes.md +4 -2
  74. package/skills/moltenship-time/references/solid.md +36 -25
  75. package/docs/api/solid.md +0 -460
@@ -0,0 +1,105 @@
1
+ # Overview
2
+
3
+ What @moltenship/calendar-temporal is, how to install it, and a first example of its date ranges.
4
+
5
+ Source: https://time.molten.sh/docs/react/temporal
6
+
7
+ `@moltenship/calendar-temporal` is the date math under the calendar: ranges, week and month grids,
8
+ rounding and snapping, the real length of a day in a time zone, and what happens to a time when
9
+ the clocks change. Dates and times go in and out as native `Temporal` values.
10
+
11
+ Apart from `createSystemClock`, nothing in it reads the clock, and nothing reads the host's time
12
+ zone. Every function takes the date, the time zone and the first day of the week as arguments, so
13
+ the same call gives the same answer on a server, in a browser and in a test.
14
+
15
+ ## Use it without the calendar
16
+
17
+ The package has no dependencies and imports no UI framework. Install it alone for a date picker of
18
+ your own, a booking form, a report grouped by week, or any code that needs a correct month grid or
19
+ a day that is 23 hours long.
20
+
21
+ `@moltenship/calendar` re-exports all of it. An app that has the calendar imports these functions
22
+ from there, and needs nothing more installed:
23
+
24
+ ```ts
25
+ import { plainDateInterval, zonedDayRange } from "@moltenship/calendar";
26
+ ```
27
+
28
+ ## Install
29
+
30
+ **pnpm**
31
+
32
+ ```bash
33
+ pnpm add @moltenship/calendar-temporal
34
+ ```
35
+
36
+ **npm**
37
+
38
+ ```bash
39
+ npm install @moltenship/calendar-temporal
40
+ ```
41
+
42
+ **yarn**
43
+
44
+ ```bash
45
+ yarn add @moltenship/calendar-temporal
46
+ ```
47
+
48
+ **bun**
49
+
50
+ ```bash
51
+ bun add @moltenship/calendar-temporal
52
+ ```
53
+
54
+ The package is versioned with the calendar.
55
+
56
+ It needs a runtime with `Temporal`, or a polyfill loaded first, and TypeScript's `ESNext` library.
57
+ [Installation](./installation.md#temporal) shows both.
58
+
59
+ ## A first example
60
+
61
+ A range has a `start` and an `end`. It includes the start and excludes the end, which is how
62
+ nights, bookings and visible dates are counted:
63
+
64
+ ```ts title="stay.ts"
65
+ import {
66
+ intersectPlainDateIntervals,
67
+ plainDateInterval,
68
+ weekRange,
69
+ } from "@moltenship/calendar-temporal";
70
+
71
+ const date = (value: string) => Temporal.PlainDate.from(value);
72
+
73
+ // A stay that arrives on October 9 and leaves on the 14th. A range includes its start and
74
+ // excludes its end, so the 14th isn't one of its nights.
75
+ export const stay = plainDateInterval(date("2026-10-09"), date("2026-10-14"));
76
+
77
+ // The week of October 8 that starts on a Monday: October 5 up to the 12th.
78
+ export const week = weekRange(date("2026-10-08"), { weekStartsOn: 1 });
79
+
80
+ // The part of the stay inside that week, or null when they don't overlap.
81
+ export const nights = intersectPlainDateIntervals(stay, week);
82
+ ```
83
+
84
+ `nights` runs from October 9 up to October 12: the three nights of the stay that fall in that
85
+ week. `plainDateInterval` throws an `InvalidHalfOpenIntervalError` when the start isn't before the
86
+ end, so a range that exists is valid.
87
+
88
+ ## What's in it
89
+
90
+ | You need | Use |
91
+ | ----------------------------------------------------------- | --------------------------------------------------------------- |
92
+ | A range of dates, instants or wall-clock times | `plainDateInterval`, `instantInterval`, `plainDateTimeInterval` |
93
+ | Whether two ranges overlap, and where | `plainDateIntervalsIntersect`, `intersectPlainDateIntervals` |
94
+ | The week or the month grid around a date | `weekRange`, `monthGrid`, `iteratePlainDates` |
95
+ | A time rounded to a grid of minutes | `snapPlainTime`, `snapZonedDateTime`, `snapZonedWallTime` |
96
+ | When a date starts and ends in a time zone | `zonedDayRange`, `splitInstantRangeByZonedDay` |
97
+ | The instant of a wall-clock time, with gaps and folds named | `resolveZonedWallTime` |
98
+ | The rows of a day view | `slotsInZonedDay` |
99
+ | A clock you can fix in a test | `createFixedClock`, `createSystemClock` |
100
+
101
+ ## Next
102
+
103
+ - [Build a month grid](./temporal/month-grid.md): The weeks of a month, the weekday names above them, and the days of the months around it.
104
+ - [Handle daylight saving time](./temporal/daylight-saving-time.md): Days of 23 and 25 hours, times the clocks skip or repeat, and the rows of a day view.
105
+ - [API reference](./temporal/reference.md): Every function, by what it works on.
package/docs/testing.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Test the calendar you built with a fixed clock, typed builders, a render harness, and keyboard and pointer drivers.
4
4
 
5
- Source: https://time.molten.sh/docs/testing
5
+ Source: https://time.molten.sh/docs/react/testing
6
6
 
7
7
  `@moltenship/calendar-testing` tests the calendar your app builds: your copies of the registry
8
8
  views, your policies and the code that saves changes. It renders your `Root` with a fixed clock,
@@ -43,6 +43,25 @@ throw an error that says so when `Temporal` is missing.
43
43
  if (!("Temporal" in globalThis)) await import("temporal-polyfill/global");
44
44
  ```
45
45
 
46
+ The registry's controls are ui-sdk's, which read paint timing, measure toasts and wait for
47
+ transitions, none of which jsdom has. jsdom's stylesheet also hides every popup that isn't
48
+ `:popover-open`, which nothing matches without the Popover API. A test that renders them adds
49
+ these to the setup file:
50
+
51
+ ```ts title="tests/setup.ts"
52
+ performance.getEntriesByType ??= () => [];
53
+ globalThis.ResizeObserver ??= class {
54
+ disconnect() {}
55
+ observe() {}
56
+ unobserve() {}
57
+ };
58
+ Element.prototype.getAnimations ??= () => [];
59
+ // ui-sdk marks an open popup `data-open`; jsdom weighs its rules by specificity alone.
60
+ const popups = document.createElement("style");
61
+ popups.textContent = "[popover][data-open] { display: block !important; }";
62
+ document.head.append(popups);
63
+ ```
64
+
46
65
  The harness turns on React's `IS_REACT_ACT_ENVIRONMENT` flag when it first renders, unless your
47
66
  setup set it already.
48
67
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Change the calendar's tokens in light and dark, see them live, and copy the CSS or a StyleX theme.
4
4
 
5
- Source: https://time.molten.sh/docs/theme-builder
5
+ Source: https://time.molten.sh/docs/react/theme-builder
6
6
 
7
7
  Pick a preset or change a token, and the calendar follows. Light and dark have their own values:
8
8
  the preview starts in the docs' theme, and **Light** and **Dark** above it switch the theme you see
9
9
  and edit. Your changes stay in the preview, and nothing is saved.
10
10
 
11
- > Live example: see it at https://time.molten.sh/docs/theme-builder
11
+ > Live example: see it at https://time.molten.sh/docs/react/theme-builder
12
12
 
13
13
  ## Paste the CSS into your app
14
14
 
@@ -30,11 +30,12 @@ like those in [Changing tokens](./theming.md#changing-tokens). Change those toke
30
30
  Below the preview, **Tailwind + shadcn** gives the CSS above and **StyleX** gives a theme for the
31
31
  [StyleX flavour](./stylex.md). The preview is the Tailwind-rendered calendar either way: the views
32
32
  read the same tokens, so it shows your theme, and compiling StyleX inside these docs isn't worth it.
33
- The **Astryx neutral** preset approximates the colors the StyleX flavour gets from
34
- `@astryxdesign/theme-neutral`.
33
+ The **Monochrome** preset sets every base color, as an app does that
34
+ [maps its design system's colors](./stylex.md#use-your-design-systems-colors) onto the calendar's.
35
35
 
36
- Paste the code into a file of your own, then apply the theme on a wrapper around the calendar. To
37
- reach popovers and tooltips, which open in a portal under `<body>`, put its class on `<body>` instead:
36
+ Paste the code into a file of your own, then apply the theme on a wrapper around the calendar. The
37
+ calendar's popovers, tooltips and toasts open inside it, in the browser's top layer, so the theme
38
+ reaches them too:
38
39
 
39
40
  ```tsx
40
41
  import * as stylex from "@stylexjs/stylex";
@@ -49,8 +50,8 @@ import { calendarTheme } from "./calendar-theme";
49
50
  - **Changed tokens** copies what differs from the theme as it ships, in either mode, with one value
50
51
  for both through `light-dark()`. It adds the tokens that read one you changed: on a wrapper they'd
51
52
  keep the value they got on `:root`. So changing `--primary` also restates `--calendar-event-border`.
52
- - **All tokens** copies the whole theme. It pins the base colors too, so they stop following your
53
- Astryx theme.
53
+ - **All tokens** copies the whole theme. It pins the base colors too, so they stop following a
54
+ mapping of your design system's colors.
54
55
  - A palette color you changed, or any change to what the colors derive, comes as each color's three
55
56
  tokens, such as `--calendar-event-blue`, with the hue and chroma filled in.
56
57
  - A shading recipe comes last, in a comment: StyleX can't select the closed-time band, so it goes in
package/docs/theming.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Theming
2
2
 
3
- Calendar color tokens, dark mode, and the event color palette.
3
+ Calendar color tokens, dark mode, the event color palette, and controls of your own.
4
4
 
5
- Source: https://time.molten.sh/docs/theming
5
+ Source: https://time.molten.sh/docs/react/theming
6
6
 
7
7
  The packages don't ship any CSS. The styled parts in the registry read their colors and sizes from
8
8
  CSS variables defined in `calendar-theme.css`. The `calendar-theme` item, which every view brings,
@@ -167,3 +167,109 @@ event tokens for light and dark mode. To add a color, add its name to `calendarE
167
167
  --calendar-event-chroma: 0.2;
168
168
  }
169
169
  ```
170
+
171
+ ## Use your own controls
172
+
173
+ The kit's files are your app's code once you add them: a default to edit or replace. Swapping a
174
+ control is one of four ways to change the calendar's UI, and
175
+ [Customization](./customization.md) sets it beside the other three.
176
+
177
+ The Tailwind views take their buttons, badges, tooltips, the view select, popovers, dialogs and
178
+ toasts from the files `calendar-ui` adds to `components/calendar/ui/`. They don't import ui-sdk themselves, and they
179
+ don't reach into a control's parts or attributes. To use a control of your own, replace the body
180
+ of its file: keep the file's name, the names it exports and the props below, and render your
181
+ component. The views stay as they are.
182
+
183
+ With shadcn's button, from a Base UI style, the button file is a few lines:
184
+
185
+ ```tsx title="components/calendar/ui/button.tsx"
186
+ import type { ComponentProps } from "react";
187
+
188
+ import { Button as AppButton, buttonVariants } from "@/components/ui/button";
189
+
190
+ export type ButtonProps = ComponentProps<typeof AppButton>;
191
+
192
+ export function Button(props: ButtonProps) {
193
+ return <AppButton {...props} />;
194
+ }
195
+
196
+ export { buttonVariants };
197
+ ```
198
+
199
+ Pass on every other prop, `aria-*` and `data-*` included, to the element your control renders,
200
+ around its children. The views set them, and their CSS and tests read some of them. What the views
201
+ import from each file, and what they pass:
202
+
203
+ | File | The views import | What the views pass |
204
+ | ------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
205
+ | `button.tsx` | `Button` | `variant` (`outline`, `ghost`), `size` (`default`, `lg`, `icon`, `icon-sm`, `icon-xs`), `className`, `onClick`, `disabled`, `tabIndex`, `ref`, `aria-*`, `data-scope`, and `render` |
206
+ | `badge.tsx` | `Badge` | `variant="outline"`, `className`, `title`, and `data-slot="resource-status"` with `data-state`, which colours the status dot inside it |
207
+ | `tooltip.tsx` | `Tooltip`, `TooltipTrigger`, `TooltipContent`, `createTooltipHandle`, `TooltipHandle` | `Tooltip`: `delay`, and for one tooltip many triggers share, `handle`, `trackCursorAxis="y"`, `onOpenChange` with `details.cancel()` and `details.payload`, and children as a function of `{ payload }`. `TooltipTrigger`: `render`, the element it shows on, and `handle` and `payload`. `TooltipContent`: the text, and `side`, `align`, `sideOffset`, `className` and `aria-label` |
208
+ | `select.tsx` | `Select`, `SelectTrigger`, `SelectValue`, `SelectContent`, `SelectGroup`, `SelectItem` | `Select`: `items` (`{ label, value }`), `value` and `onValueChange`, which gets the new value. `SelectTrigger`: `aria-label` and `className`. `SelectContent`: `align` and `alignItemWithTrigger`. `SelectItem`: `value`, `label`, and the label with its shortcut as children |
209
+ | `popover.tsx` | `Popover`, `PopoverTrigger`, `PopoverContent`, `PopoverTitle`, `PopoverClose`, `createPopoverHandle`, `PopoverHandle` | `createPopoverHandle()`: one popover for many triggers, with `open(triggerId)`, `close()` and `getPayload()`. `Popover`: `handle`, `modal`, `onOpenChange`, and children as a function of `{ payload }`. `PopoverTrigger`: `handle`, `payload`, `id`, `render`, `aria-label`, `className`, `style`, `tabIndex` and `onMouseDown`. `PopoverContent`: `aria-label`, `side` (`inline-start` and `inline-end` too), `align`, `sideOffset`, `className`, `ref`, `initialFocus` (a ref) and `finalFocus` (`false`, or a function that returns the element). `PopoverClose`: `render` |
210
+ | `dialog.tsx` | `Dialog`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`, `DialogClose` | `Dialog`: `open`, `onOpenChange` and `onOpenChangeComplete`; it's modal. `DialogContent`: `className` and `initialFocus` (a ref). `DialogClose`: `render`, the button. The rest: children and `className` |
211
+ | `toast.tsx` | `ToastViewport`, `Toast`, `ToastTitle`, `ToastDescription`, `ToastAction`, `ToastClose`, `createToastManager`, `ToastManager` | `createToastManager()`: `add({ id, title, description, timeout, actionProps, onRemove })`, where `timeout: 0` keeps a toast and `actionProps.onClick` gets `{ input }`, and `close(id)`. `ToastViewport`: `manager`, `aria-label` and one toast's parts as children. `ToastClose`: `aria-label`. The parts render the toast's own text |
212
+
213
+ The kit's files also export `buttonVariants`, `badgeVariants`, `SelectGroupLabel` and
214
+ `SelectSeparator` for your own code. Keep them, or remove what you don't use. Beside them,
215
+ `tooltip-handle.ts`, `popover-handle.ts` and `toast-manager.ts` hold the kit's tooltip, popover
216
+ and toast state, and `popup-side.ts` maps `inline-start` and `inline-end` for the tooltip and the
217
+ popover. A control you replace can stop importing them; keep each one another kit file still
218
+ imports.
219
+
220
+ `render` is an element to render in place of the `<button>`. The toolbar passes the calendar's
221
+ `TodayTrigger`, `PreviousTrigger` and `NextTrigger` this way: the trigger keeps its own props and
222
+ runs the command, and your button adds its look and passes on `disabled`. If your button takes
223
+ `asChild` instead, as a Radix style's does, render the `render` element as its child with
224
+ `asChild`. Typing on the view select matches each item's `label`, so pass it on to your select's
225
+ items.
226
+
227
+ The year's day popover and the annotations each open one popover from many triggers, so a view
228
+ never mounts hundreds of roots. With shadcn's popover, build the handle
229
+ on Base UI's `Popover.createHandle()`: it opens a trigger by its `id` and closes, and your
230
+ `getPayload()` returns the `payload` of the trigger that opened it last. The views move focus
231
+ themselves where `finalFocus` says, so map `false` to Base UI's `finalFocus={false}`. The
232
+ calendar's own tests swap in shadcn's popover and dialog this way, and the views keep working by
233
+ pointer and by keyboard.
234
+
235
+ A control that isn't built on ui-sdk gives up two things:
236
+
237
+ - **What an agent sees.** An [agent bridge](./agents/connect.md) lists ui-sdk's components. It
238
+ reads your control only as far as your component tells it, and a stock shadcn control tells it
239
+ nothing. The calendar stays on the bridge, so an agent can still change the view with its
240
+ `setView` action.
241
+ - **The same control in React and Solid.** ui-sdk has the same components in both frameworks, so
242
+ a control built on it behaves alike in both. Yours behaves as your component does, so a Solid
243
+ app needs its own version of it. The Solid registry's controls are in its `calendar-ui` item.
244
+
245
+ ### In the StyleX items
246
+
247
+ The `stylex-` views take the same controls from `stylex-calendar-ui`, in
248
+ `components/calendar-stylex/ui/`: the same files, exports and props as in the table, with StyleX
249
+ styles in place of class names. Where the table says `className`, the StyleX views pass `xstyle`, a
250
+ value of `stylex.create`, and a control applies it after its own styles:
251
+
252
+ ```tsx title="components/calendar-stylex/ui/button.tsx"
253
+ import type { ComponentProps, CSSProperties } from "react";
254
+
255
+ import { Button as AppButton } from "@/components/ui/button";
256
+ import { buttonVariants } from "@/components/calendar-stylex/ui/button.styles";
257
+ import { type XStyle, xprops } from "@/components/calendar-stylex/xprops";
258
+
259
+ // Base UI's className and style can be functions of state; the views pass plain values.
260
+ export interface ButtonProps extends Omit<ComponentProps<typeof AppButton>, "className" | "style"> {
261
+ readonly className?: string;
262
+ readonly style?: CSSProperties;
263
+ readonly xstyle?: XStyle;
264
+ }
265
+
266
+ export function Button({ className, style, xstyle, ...props }: ButtonProps) {
267
+ return <AppButton {...props} {...xprops({ className, style }, xstyle)} />;
268
+ }
269
+
270
+ export { buttonVariants };
271
+ ```
272
+
273
+ `xprops`, from the StyleX theme item, merges the styles with a `className` and `style` the element
274
+ also gets. A control from a StyleX design system that takes `xstyle` itself can take it as it
275
+ comes.
package/docs/undo-redo.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Record the changes people make, and take them back through the same pipeline that saved them.
4
4
 
5
- Source: https://time.molten.sh/docs/undo-redo
5
+ Source: https://time.molten.sh/docs/react/undo-redo
6
6
 
7
- > Live example: see it at https://time.molten.sh/docs/undo-redo
7
+ > Live example: see it at https://time.molten.sh/docs/react/undo-redo
8
8
 
9
9
  An event history records the changes your calendar commits, and undoes them by proposing the
10
10
  inverse change. The inverse goes through the same pipeline as a drag: your policies check it, the
@@ -114,9 +114,9 @@ server and hydration read an empty history.
114
114
 
115
115
  ## Keyboard shortcuts
116
116
 
117
- `useCalendarHistoryShortcuts(history, { scope })` adds undo and redo keys to an element, usually the
118
- root's frame. They're Mod+Z to undo and Shift+Mod+Z or Ctrl+Y to redo, where Mod is ⌘ on Apple
119
- platforms and Ctrl elsewhere.
117
+ `useCalendarHistoryShortcuts(history, options)` adds undo and redo keys to the element its `scope`
118
+ option names, usually the root's frame. They're Mod+Z to undo and Shift+Mod+Z or Ctrl+Y to redo,
119
+ where Mod is ⌘ on Apple platforms and Ctrl elsewhere.
120
120
 
121
121
  ```tsx
122
122
  const history = useCalendarHistory(eventHistory, { messages: calendarHistoryAnnouncements });
@@ -146,10 +146,11 @@ pass `{ input: "keyboard" }`.
146
146
 
147
147
  ## Undo toast
148
148
 
149
- The registry's `calendar-history-toast` item is an "Undo" toast built on Base UI's Toast. After each
150
- change it offers to undo it, and after an undo, to redo it. It also adds the keys above in the
151
- calendar's frame and speaks undo and redo through the `Announcer`. Install it with the
152
- [shadcn CLI](./installation.md#ui-source-optional), then render it inside `Root`:
149
+ The registry's `calendar-history-toast` item is an "Undo" toast built on the calendar's toast, in
150
+ `components/calendar/ui/toast.tsx`. After each change it offers to undo it, and after an undo, to
151
+ redo it. It also adds the keys above in the calendar's frame and speaks undo and redo through the
152
+ `Announcer`. Install it with the [shadcn CLI](./installation.md#ui-source-optional), then render
153
+ it inside `Root`:
153
154
 
154
155
  ```tsx
155
156
  import { CalendarHistoryToast } from "@/components/calendar/calendar-history-toast/calendar-history-toast";
@@ -170,13 +171,20 @@ import { CalendarHistoryToast } from "@/components/calendar/calendar-history-toa
170
171
  | `timeout` | `6000` | How long a toast stays, in milliseconds |
171
172
  | `className` | | Classes for the toast's region, such as where it sits |
172
173
 
174
+ Undo and Redo buttons of your own, such as in the toolbar, take `useCalendarHistory` beside the
175
+ toast. The toast already adds the keys, so they need no `useCalendarHistoryShortcuts`.
176
+
173
177
  One toast shows at a time, and a cleared history closes it. A message that returns `null` shows no
174
178
  toast and closes the one on screen: the English set does so for an empty stack or a change you
175
- cancelled. The toast's region doesn't speak, so nothing is said twice: changes made by a gesture
176
- are announced as they're made, and undo and redo by the `Announcer`. Deletes, updates and changes
177
- from your own UI, which no gesture announced, are spoken once with how to reach Undo
178
- (`recordedAnnouncement`), and that toast stays at least 10 seconds, long enough to hear it out and
179
- press F6. The region's name is `region`.
179
+ cancelled. A screen reader reads each toast as it shows. Changes made by a gesture are announced
180
+ as they're made, so their toast's title follows that announcement, and undo and redo are spoken by
181
+ the `Announcer` too. Deletes, updates and changes from your own UI, which no gesture announced,
182
+ add how to reach Undo after the title (`recordedHint`), and that toast stays at least 10 seconds,
183
+ long enough to hear it out. F6 moves focus to the toast's region and back, Tab reaches its
184
+ buttons, and Escape dismisses it. The region's name is `region`.
185
+
186
+ The toast's look comes from the kit's `toast.styles.ts` and `history-toast.styles.ts` beside the
187
+ item, which the registry's React and Solid toasts share.
180
188
 
181
189
  ## What gets recorded
182
190
 
@@ -315,9 +323,9 @@ PM." The packages ship no text: the registry's `calendar/announcements.ts` has a
315
323
  `calendarHistoryAnnouncements`, to edit or translate. Each message gets the outcome and the
316
324
  announcement context, with the step's event when the calendar shows it.
317
325
 
318
- ## Outside React
326
+ ## Without a framework
319
327
 
320
- `createEventHistory` doesn't use React. Record each result yourself, and pass `undo` and `redo` the
328
+ `createEventHistory` needs no `Root`. Record each result yourself, and pass `undo` and `redo` the
321
329
  events the user sees and a function that proposes, such as `propose` from
322
330
  [`createEventTransactions`](./api/changes.md#results). `getEvents` must return the same snapshot
323
331
  until the events change: the history tells events that haven't caught up with its own saves by
@@ -2,9 +2,9 @@
2
2
 
3
3
  A chronological list of upcoming events, grouped by day, and a version that scrolls through months or years.
4
4
 
5
- Source: https://time.molten.sh/docs/views/agenda
5
+ Source: https://time.molten.sh/docs/react/views/agenda
6
6
 
7
- > Live example of the `agenda` view: see it at https://time.molten.sh/docs/views/agenda
7
+ > Live example of the `agenda` view: see it at https://time.molten.sh/docs/react/views/agenda
8
8
 
9
9
  Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Agenda in the view switcher.
10
10
 
@@ -34,12 +34,13 @@ export const Calendar = createCalendar<Meeting>()({
34
34
  });
35
35
  ```
36
36
 
37
- The view is named `agenda`. It renders with `@tanstack/react-virtual`, which the registry item
38
- installs.
37
+ The view is named `agenda`. It decides which days render with `@tanstack/virtual-core`, which the
38
+ registry item installs. A Solid app adds the [Solid agenda](https://time.molten.sh/docs/solid/views/agenda.md), built from the same
39
+ styles, labels and virtualizer.
39
40
 
40
41
  ## Scrolling agenda
41
42
 
42
- > Live example of the `scrolling-agenda` view: see it at https://time.molten.sh/docs/views/agenda
43
+ > Live example of the `scrolling-agenda` view: see it at https://time.molten.sh/docs/react/views/agenda
43
44
 
44
45
  `createScrollingAgendaView` from the `scrolling-list-view` item is the agenda as a
45
46
  [scrolling view](./scrolling.md): one list that scrolls through months or years, with the
@@ -148,7 +149,7 @@ shows a loading state in place of the empty one. Time never fetches or keeps eve
148
149
  parts itself, so they're not parts you compose: to change one, edit its file. The tree shows where
149
150
  each part lives.
150
151
 
151
- > Diagram: see it at https://time.molten.sh/docs/views/agenda
152
+ > Diagram: see it at https://time.molten.sh/docs/react/views/agenda
152
153
 
153
154
  ```txt title="Rendered by AgendaView"
154
155
  AgendaView agenda-view.tsx
@@ -161,20 +162,20 @@ AgendaView agenda-view.tsx
161
162
  ```
162
163
 
163
164
  `AgendaItem` shows the time range or an "All day" badge, the title, and "Day 2 of 3", which comes
164
- from `dayIndex` and `dayCount`. `use-agenda-virtualizer.ts` decides which days render. The
165
+ from `dayIndex` and `dayCount`. `agenda-virtualizer.ts` decides which days render, and `use-agenda-virtualizer.ts` binds it to the list. The
165
166
  scrolling agenda's `ScrollingAgendaView` renders the same parts, and `use-agenda-scroll.ts` in
166
167
  `registry/scrolling-list-view` keeps its scroll position and the anchor date together.
167
168
 
168
169
  ## Options
169
170
 
170
- | Name | Type | Default | Description |
171
- | --------------- | ---------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
172
- | `weeks` | `number` | `4` | How many whole weeks to show, from the week of the anchor date, or from the anchor date itself in the scrolling agenda. Previous and Next move by the same number of weeks. |
171
+ | Name | Type | Default | Description |
172
+ | --------------- | ---------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
173
+ | `weeks` | `number` | `4` | How many whole weeks to show, from the week of the anchor date, or from the anchor date itself in the scrolling agenda. Previous and Next move by the same number of weeks. |
173
174
  | `getEventColor` | `(event: TEvent) => CalendarEventColor` | | The color for each event. See [event colors](../theming.md#event-colors). |
174
175
  | `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). |
175
- | `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
176
- | `loading` | `boolean` | `false` | Events for the view's dates are still being fetched: the view says they're loading instead of that nothing is scheduled. |
177
- | `dayView` | `string` | `"day"` | Scrolling agenda only: the registered view a date opens. |
176
+ | `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
177
+ | `loading` | `boolean` | `false` | Events for the view's dates are still being fetched: the view says they're loading instead of that nothing is scheduled. |
178
+ | `dayView` | `string` | `"day"` | Scrolling agenda only: the registered view a date opens. |
178
179
 
179
180
  ## What it shows
180
181
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Define a view with a pure strategy and a Renderer component.
4
4
 
5
- Source: https://time.molten.sh/docs/views/custom-views
5
+ Source: https://time.molten.sh/docs/react/views/custom-views
6
6
 
7
7
  A view has two halves:
8
8
 
@@ -14,8 +14,9 @@ A view has two halves:
14
14
 
15
15
  ## Define a view
16
16
 
17
- This view shows a few days at a time and counts the meetings on each one. Everything it imports
18
- comes from `@moltenship/calendar`.
17
+ This view shows a few days at a time and counts the meetings on each one.
18
+
19
+ Everything it imports comes from `@moltenship/calendar`.
19
20
 
20
21
  ```tsx title="days-view.tsx"
21
22
  import {
@@ -95,19 +96,21 @@ The title reads "Oct 5 – 9", and the list has five days.
95
96
 
96
97
  ## Strategy
97
98
 
98
- | Name | Type | Description |
99
- | ---------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
100
- | `getRange` | `(anchor, environment, options) => PlainDateInterval` | Required. The visible dates, end excluded. Build it with `plainDateInterval`. |
101
- | `navigate` | `(anchor, delta, options) => Temporal.PlainDate` | Required. The anchor date after moving `delta` steps. Previous and Next pass -1 and 1. |
102
- | `getLoadRange` | `(anchor, environment, options) => PlainDateInterval` | The dates to project and have events for, around the visible ones, as a [scrolling view](./scrolling.md) keeps a page on each side. It must contain `getRange`'s dates. Without it, the view projects what it shows. |
103
- | `getTitle` | `(range, environment, options) => string` | Required. The text for `<Calendar.Title />`. |
104
- | `project` | `(input) => TProjection` | Required. Turns the events into what the Renderer draws. See the input below. |
99
+ | Name | Type | Description |
100
+ | ---------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
101
+ | `getRange` | `(anchor, environment, options) => PlainDateInterval` | Required. The visible dates, end excluded. Build it with `plainDateInterval`. |
102
+ | `navigate` | `(anchor, delta, options) => Temporal.PlainDate` | Required. The anchor date after moving `delta` steps. Previous and Next pass -1 and 1. |
103
+ | `getLoadRange` | `(anchor, environment, options) => PlainDateInterval` | The dates to project and have events for, around the visible ones, as a scrolling view keeps a page on each side. It must contain `getRange`'s dates. Without it, the view projects what it shows. |
104
+ | `getTitle` | `(range, environment, options) => string` | Required. The text for `<Calendar.Title />`. |
105
+ | `project` | `(input) => TProjection` | Required. Turns the events into what the Renderer draws. See the input below. |
105
106
  | `getSpatialNavigation` | `(input) => CalendarSpatialNavigation \| null` | Where the arrows, Home, End, Page Up and Page Down move focus, and where Enter and Escape go into and out of a cell's events. A view without it has no keyboard navigation. See [in your own views](../accessibility.md#in-your-own-views). |
106
107
 
107
108
  `anchor` is the date in the `anchorDate` state. `environment` holds `locale`, `timeZone`,
108
109
  `secondaryTimeZones`, `weekRules`, `direction`, and `disambiguation`. The functions should be pure:
109
110
  `Root` calls them during render and reuses the projection until one of its inputs changes.
110
111
 
112
+ The [scrolling views](./scrolling.md) are the built-in views with a `getLoadRange`.
113
+
111
114
  `project` receives:
112
115
 
113
116
  | Field | Contents |
@@ -2,9 +2,9 @@
2
2
 
3
3
  A month grid with multi-day bars and a "+N more" popover.
4
4
 
5
- Source: https://time.molten.sh/docs/views/month
5
+ Source: https://time.molten.sh/docs/react/views/month
6
6
 
7
- > Live example of the `month` view: see it at https://time.molten.sh/docs/views/month
7
+ > Live example of the `month` view: see it at https://time.molten.sh/docs/react/views/month
8
8
 
9
9
  Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Month in the view switcher.
10
10
 
@@ -40,7 +40,7 @@ The view is named `month`. Previous and Next move by one month.
40
40
  parts you compose: to change one, edit it in the `components/calendar/month-view` files you added.
41
41
  The tree shows where each part lives.
42
42
 
43
- > Diagram: see it at https://time.molten.sh/docs/views/month
43
+ > Diagram: see it at https://time.molten.sh/docs/react/views/month
44
44
 
45
45
  ```txt title="Rendered by MonthView"
46
46
  MonthView month-view.tsx
@@ -57,12 +57,13 @@ into another week, and days with `inMonth: false` are muted.
57
57
 
58
58
  ## Options
59
59
 
60
- | Name | Type | Description |
61
- | ------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
- | `getEventColor` | `(event: TEvent) => CalendarEventColor` | The color for each event. See [event colors](../theming.md#event-colors). |
63
- | `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). |
64
- | `describeEvent` | `(event: TEvent) => string \| undefined` | Extra words for each event's accessible name, such as its calendar. |
65
- | `renderUnavailable` | `UnavailableTimeRender` | Replaces the shading of closed days: an element, or a function of its props. See [customize the shading](../availability.md#customize-the-shading). |
60
+ | Name | Type | Default | Description |
61
+ | ------------------- | ---------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | `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). |
63
+ | `getEventColor` | `(event: TEvent) => CalendarEventColor` | | The color for each event. See [event colors](../theming.md#event-colors). |
64
+ | `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). |
65
+ | `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
66
+ | `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed days: a function of its props and its state. See [customize the shading](../availability.md#customize-the-shading). |
66
67
 
67
68
  ## What it shows
68
69