@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
@@ -2,35 +2,33 @@
2
2
 
3
3
  What changes between Time 1.x and 2.0, and what to do about each change.
4
4
 
5
- Source: https://time.molten.sh/docs/migrating-to-2
5
+ Source: https://time.molten.sh/docs/react/migrating-to-2
6
6
 
7
- 2.0 rebuilds the calendar's parts on [ui-sdk](https://ui-sdk.dev). That gives the calendar an
8
- [agent surface](./agents.md) and a second framework, [Solid](./api/solid.md). The engine didn't
9
- move: dates, time zones, recurrence, layouts, transactions and policies work as they did.
7
+ 2.0 rebuilds the calendar's parts on [ui-sdk](https://ui-sdk.dev). With it, an
8
+ [agent](./agents.md) can call the calendar's actions, and the calendar has a second framework,
9
+ Solid, with [docs of its own](https://time.molten.sh/docs/solid.md). The engine didn't move: dates, time zones, recurrence, layouts, transactions and policies work as they did.
10
10
 
11
11
  For most apps the upgrade is two more packages to install. The rest of this page is for code that
12
12
  names the types 2.0 widened.
13
13
 
14
- > **2.0 is a pre-release**
15
- >
16
- > Its API can still change before 2.0.0, and ui-sdk is in beta. Stay on 1.x if you need a stable API
17
- > today: it keeps the shape it has.
18
-
19
14
  ## In short
20
15
 
21
- | Change | Do this | Who it affects |
22
- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
23
- | `@ui-sdk/core` and `@ui-sdk/react` are peer dependencies | [Install them](#install-the-new-peer-dependencies) | Everyone |
24
- | `CalendarInputMethod` has a fourth value, `"agent"` | [Handle it](#handle-the-agent-input) | Code that switches on `detail.input` |
25
- | `onEventChange` and policies get the proposal's detail, with `fields` | [Check handlers with a second parameter](#handlers-and-policies-hear-who-proposed) | Handlers with an optional second parameter, and code that calls a typed handler |
26
- | The toolbar parts and the frame render a `data-slot` attribute | [Check selectors on `data-slot="calendar"`](#the-parts-have-data-slot) | Apps with shadcn's date picker, or such CSS |
27
- | State handlers hear `reason`, `source`, `event` and can `cancel()` | Nothing. [Use it](#state-handlers-hear-why-and-who) | Code that builds a `detail` by hand, in tests |
28
- | Actions take options last | [Wrap an action used as an event handler](#actions-take-options) | Code such as `onClick={actions.navigateNext}` |
29
- | `Root` has `label`, `allowAgentDelete` and `formatAgentEventLabel` | [Name your calendar](#name-the-calendar) | Apps that want agents, or a fixed name |
30
- | The store and state types moved to `@moltenship/calendar-primitives` | Nothing: [the old imports still work](#new-packages) | Nobody |
31
-
32
- What didn't change: the engine, the registry's views, the `data-calendar-part` attributes and the
33
- other attributes your CSS and tests target, the keyboard model, and every hook's name and return
16
+ | Change | Do this | Who it affects |
17
+ | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
18
+ | `@ui-sdk/core` and `@ui-sdk/react` are peer dependencies | [Install them](#install-the-new-peer-dependencies) | Everyone |
19
+ | `CalendarInputMethod` has a fourth value, `"agent"` | [Handle it](#handle-the-agent-input) | Code that switches on `detail.input` |
20
+ | `onEventChange` and policies get the proposal's detail, with `fields` | [Check handlers with a second parameter](#handlers-and-policies-hear-who-proposed) | Handlers with an optional second parameter, and code that calls a typed handler |
21
+ | The toolbar parts and the frame render a `data-slot` attribute | [Check selectors on `data-slot="calendar"`](#the-parts-have-data-slot) | Apps with shadcn's date picker, or such CSS |
22
+ | State handlers hear `reason`, `source`, `event` and can `cancel()` | Nothing. [Use it](#state-handlers-hear-why-and-who) | Code that builds a `detail` by hand, in tests |
23
+ | Actions take options last | [Wrap an action used as an event handler](#actions-take-options) | Code such as `onClick={actions.navigateNext}` |
24
+ | `Root` has `label`, `allowAgentDelete` and `formatAgentEventLabel` | [Name your calendar](#name-the-calendar) | Apps that want agents, or a fixed name |
25
+ | The store and state types moved to `@moltenship/calendar-primitives` | Nothing: [the old imports still work](#new-packages) | Nobody |
26
+ | `useCalendarPointer` moved to `@moltenship/calendar-react` | [Import it from there](#the-pointer-hook-moved) | Code that imports it from `@moltenship/calendar-dnd` |
27
+ | The registry's controls and popups come from a new item, `calendar-ui`, without Base UI | [Add the registry's items again](#add-the-registrys-items-again) | Apps with the Tailwind items from the registry |
28
+ | The StyleX items' controls come from `stylex-calendar-ui`, without Astryx or Base UI | [Add the StyleX items again](#add-the-stylex-items-again) | Apps with the StyleX items from the registry |
29
+
30
+ What didn't change: the engine, what the registry's views do, the `data-calendar-part` attributes
31
+ and the other attributes your CSS and tests target, the keyboard model, and every hook's name and return
34
32
  value. The parts gained one attribute, [`data-slot`](#the-parts-have-data-slot).
35
33
 
36
34
  ## Install the new peer dependencies
@@ -65,8 +63,9 @@ bun add @moltenship/calendar @ui-sdk/core @ui-sdk/react
65
63
  and a 1.x package beside a 2.0 one brings a second copy of the engine.
66
64
  - **`@moltenship/calendar-testing` has the same two peers.** A project that tests with it needs
67
65
  nothing more once the app has them.
68
- - **`shadcn add` doesn't install them.** The registry's items list `@moltenship/calendar` and not
69
- the ui-sdk packages, so an app set up from the registry alone adds them by hand.
66
+ - **`shadcn add` installs them only if they're missing.** The registry's `calendar-ui` item lists
67
+ the ui-sdk packages without a version, so an app that already has them keeps its own. Install
68
+ the version the calendar asks for yourself.
70
69
  - **Keep one copy of `@ui-sdk/core`.** The calendar and an [agent bridge](./agents/connect.md)
71
70
  find each other through it. Your package manager keeps one as long as every `@ui-sdk/*` package
72
71
  is on the same version; `pnpm why @ui-sdk/core` shows whether it did.
@@ -265,6 +264,123 @@ shadcn's date picker renders `data-slot="calendar"` on its root. A rule such as
265
264
  frame too. Scope such a selector to the date picker, or select the scheduler by
266
265
  `data-calendar-part="frame"`.
267
266
 
267
+ ## Add the registry's items again
268
+
269
+ In 1.x the registry's Tailwind items used shadcn's `button`, `badge`, `tooltip`, `select`,
270
+ `popover` and `dialog` from your app's `components/ui`, and Base UI's toast, so a change you made
271
+ there changed the calendar too, and your app needed a Base UI style. In 2.0 they use
272
+ `calendar-ui`, the calendar's own controls, built on ui-sdk, and no longer need Base UI. The controls no longer follow your
273
+ app's `components/ui`: they look the same in every app, and you restyle them in their own files.
274
+ They are a default and the files are yours, so you can still put your own components in their
275
+ place. [Customization](./customization.md) lists every way to change the calendar's UI.
276
+
277
+ 1. Add the items you use again, or all of them:
278
+
279
+ ```bash
280
+ npx shadcn@latest add https://time.molten.sh/r/calendar-full.json
281
+ ```
282
+
283
+ This now installs `calendar-ui` too: `button.tsx`, `badge.tsx`, `tooltip.tsx`, `select.tsx`,
284
+ `popover.tsx`, `dialog.tsx` and `toast.tsx` in `components/calendar/ui/`, with the classes each
285
+ one uses in a `*.styles.ts` file beside it.
286
+ It adds `@ui-sdk/core` and `@ui-sdk/react` if your app doesn't have them yet. `shadcn add` asks
287
+ before it replaces a file you changed; redo your changes on the new files.
288
+
289
+ 2. ui-sdk adds a little CSS to the page in a layer named `ui-sdk`. Name that layer before Tailwind
290
+ in your global CSS, so Tailwind's utilities win over it:
291
+
292
+ ```css title="globals.css"
293
+ @layer ui-sdk;
294
+ @import "tailwindcss";
295
+ ```
296
+
297
+ The calendar's popups, from the view select's list and the tooltips to the popovers, the
298
+ recurrence dialog and the undo toast, open in the browser's top layer, through the Popover API,
299
+ so the registry's items now need Chrome and Edge 114, Safari 17 or Firefox 125. In
300
+ an older browser they render at the end of the page, and a server-rendered page doesn't
301
+ hydrate them cleanly.
302
+
303
+ 3. If you restyled the calendar's buttons, badges, tooltips, popovers, dialogs or the view
304
+ switcher through `components/ui`, make those changes in `components/calendar/ui/` instead. To
305
+ keep using your own components there, make those files render them, as
306
+ [Use your own controls](./theming.md#use-your-own-controls) shows.
307
+
308
+ 4. The items no longer install shadcn's components or `@base-ui/react`, and any shadcn style
309
+ works. Keep the ones your app uses itself; the calendar doesn't need them. An app without
310
+ shadcn's tokens can add `base-tokens`, as [UI source](./installation.md#ui-source-optional)
311
+ shows.
312
+
313
+ An [agent bridge](./agents/connect.md) now lists the toolbar's buttons and the view select
314
+ beside the calendar, as `button` and `select` entries, and your `allow` hears the steps an agent
315
+ takes on them. The calendar's tooltips no longer need a `TooltipProvider`, and they don't follow
316
+ its `delay`: the toolbar's open after 400 ms, which `tooltipDefaults` in
317
+ `components/calendar/ui/tooltip.styles.ts` sets.
318
+
319
+ If you edited the views, in either flavour, a few of their own props changed with the move:
320
+
321
+ - `renderUnavailable` is a function of the band's props and its state, `(props, state) =>
322
+ element`. An element alone no longer works: wrap it in a function that spreads `props` on it.
323
+ - `AnnotationMark`'s `render` takes an element, and the mark's props merge into it. A function no
324
+ longer works.
325
+ - The history toast's `recordedAnnouncement(step, title)` message is now
326
+ `recordedHint(step)`, in `stylex-calendar-history-toast` too. It returns only the part after the
327
+ toast's title, such as "To undo it, press F6 and choose Undo.", since the title is read first. A screen reader now reads every toast
328
+ as it shows, after the announcement of the gesture that caused it.
329
+ - A popover trigger has `aria-expanded` while its popover is open, in place of Base UI's
330
+ `data-popup-open`. Style it with `aria-expanded:`, or `"[aria-expanded=true]"` in StyleX.
331
+ - The time grid's event tooltips share one tooltip per view. A composition that renders
332
+ `TimeGridEvent` outside the registry's views wraps them in `TimeGridEventTooltip` to do the
333
+ same; without it, each event brings its own.
334
+
335
+ ## Add the StyleX items again
336
+
337
+ In 1.x the `stylex-` items took their buttons, badges, tooltips and the view select from Astryx,
338
+ and their popovers, dialog and toast from Base UI. Their base colors, such as `--background` and
339
+ `--primary`, read the Astryx theme around them. In 2.0 they use `stylex-calendar-ui`, the StyleX
340
+ twin of `calendar-ui`, on ui-sdk, with the same look as the Tailwind items, and their tokens hold
341
+ their own values.
342
+
343
+ 1. Add the items you use again, or all of them:
344
+
345
+ ```bash
346
+ npx shadcn@latest add https://time.molten.sh/r/stylex-calendar-full.json
347
+ ```
348
+
349
+ This installs `stylex-calendar-ui` in `components/calendar-stylex/ui/`, with each control's
350
+ styles in a `*.styles.ts` file beside it, and adds `@ui-sdk/core` and `@ui-sdk/react`.
351
+
352
+ 2. Name ui-sdk's layer at the top of your global CSS, as [Add the global CSS](./stylex.md#add-the-global-css)
353
+ shows. If Astryx's `Theme` set your root's `color-scheme`, and you drop it, set it yourself.
354
+
355
+ 3. To keep the calendar in your Astryx theme's colors, map them onto the base colors, as
356
+ [Use your design system's colors](./stylex.md#use-your-design-systems-colors) shows. Without
357
+ that, the calendar takes the Tailwind theme's neutral colors. Astryx's root `Theme` puts its
358
+ variables on `<html>`, so the theme goes there too:
359
+
360
+ ```tsx
361
+ const astryxCalendarTheme = stylex.createTheme(calendarVars, {
362
+ "--radius": "var(--radius-element)",
363
+ "--background": "var(--color-background-surface)",
364
+ "--foreground": "var(--color-text-primary)",
365
+ "--popover": "var(--color-background-popover)",
366
+ "--primary": "var(--color-accent)",
367
+ "--muted-foreground": "var(--color-text-secondary)",
368
+ "--border": "var(--color-border)",
369
+ "--ring": "var(--focus-outline-color)",
370
+ // …and the rest of the base colors, in the same way.
371
+ });
372
+
373
+ document.documentElement.classList.add(
374
+ ...(stylex.props(astryxCalendarTheme).className ?? "").split(" "),
375
+ );
376
+ ```
377
+
378
+ 4. The items no longer list `@astryxdesign/core` or `@base-ui/react`. Keep them if your app uses
379
+ them itself. The views hide text visually with `visuallyHiddenStyles`, in
380
+ `components/calendar-stylex/visually-hidden.styles.ts`, in place of Astryx's `VisuallyHidden`.
381
+
382
+ The props that changed for the Tailwind views, listed above, changed in the StyleX views too.
383
+
268
384
  ## Name the calendar
269
385
 
270
386
  `Root` takes three new props:
@@ -299,19 +415,78 @@ event action, as it gives a person no editing.
299
415
  | Package | What it is | Install it when |
300
416
  | --------------------------------- | ------------------------------------------------------ | --------------------------------- |
301
417
  | `@moltenship/calendar-primitives` | The framework-free runtime, store and ui-sdk primitive | You write a framework integration |
302
- | `@moltenship/calendar-solid` | The Solid integration, a preview | Your app is on SolidJS 2 |
418
+ | `@moltenship/calendar-solid` | The Solid integration | Your app is on SolidJS 2 |
303
419
 
304
420
  `createCalendarStore`, `resolveViewOptions` and the state types moved from
305
421
  `@moltenship/calendar-react` into the primitives. Both `@moltenship/calendar` and
306
422
  `@moltenship/calendar-react` re-export them, so imports from either still work and a store you
307
423
  created keeps its contract. See [Primitives](./api/primitives.md).
308
424
 
425
+ ## The pointer hook moved
426
+
427
+ `@moltenship/calendar-dnd` imports no framework in 2.0, and `@moltenship/calendar-solid` binds it too. Its
428
+ one React hook, `useCalendarPointer`, is in `@moltenship/calendar-react` now, with the same
429
+ options and return value. `@moltenship/calendar` exports it as before, so an import from the
430
+ facade doesn't change. An import from the pointer package does:
431
+
432
+ ```ts title="my-week-view.tsx"
433
+ // 1.x
434
+ import { useCalendarPointer } from "@moltenship/calendar-dnd";
435
+ // 2.0
436
+ import { useCalendarPointer } from "@moltenship/calendar-react";
437
+ ```
438
+
439
+ Everything else in `@moltenship/calendar-dnd` stays where it was: `attachCalendarPointer`,
440
+ `startCalendarDrop`, `monitorCalendarDrags` and the attribute helpers. It no longer has React as a
441
+ peer dependency.
442
+
443
+ ### With React but without calendar-react
444
+
445
+ An app that used `@moltenship/calendar-dnd` in React without `@moltenship/calendar-react` has two
446
+ ways on:
447
+
448
+ - **Add `@moltenship/calendar-react`** and its peers, `@ui-sdk/core` and `@ui-sdk/react`, then
449
+ import the hook from it as above.
450
+ - **Keep the hook in the app.** It's a few lines around `attachCalendarPointer`:
451
+
452
+ ```tsx title="use-calendar-pointer.ts"
453
+ import type { EventId, ResourceId } from "@moltenship/calendar-core";
454
+ import { attachCalendarPointer, type CalendarPointerOptions } from "@moltenship/calendar-dnd";
455
+ import { useCallback, useInsertionEffect, useRef, type RefCallback } from "react";
456
+
457
+ export function useCalendarPointer<
458
+ TEvent,
459
+ TEventId extends EventId,
460
+ TResourceId extends ResourceId,
461
+ >(options: CalendarPointerOptions<TEvent, TEventId, TResourceId>): RefCallback<HTMLElement> {
462
+ const latest = useRef(options);
463
+ useInsertionEffect(() => {
464
+ latest.current = options;
465
+ });
466
+ const disabled = options.disabled === true;
467
+ // Options are read as a gesture goes; only `disabled` attaches the listeners again.
468
+ return useCallback(
469
+ (element: HTMLElement | null) =>
470
+ element === null ? undefined : attachCalendarPointer(element, () => latest.current),
471
+ [disabled],
472
+ );
473
+ }
474
+ ```
475
+
476
+ Either way, keep every `@moltenship/calendar*` package on one version. `@moltenship/calendar-react`
477
+ depends on `@moltenship/calendar-dnd` at its own exact version, and the pointer package keeps its
478
+ drag registry in the module: two copies of it don't hear each other's drags, so a drop from one
479
+ never reaches a view bound through the other.
480
+
309
481
  ## Tests
310
482
 
311
483
  - **Scripted clicks.** A click a test dispatches reads `source: "programmatic"` in a state
312
484
  handler. Only a real pointer reads `"mouse"`.
313
485
  - **The frame's name.** A test that finds the frame by its accessible name finds the `label` once
314
486
  you set one.
487
+ - **The registry's controls in jsdom.** They're ui-sdk's, which read paint timing, measure
488
+ toasts and wait for transitions, none of which jsdom has, and jsdom hides every popup. Add the
489
+ stubs [Testing](./testing.md#set-up-vitest) lists to your test setup file.
315
490
  - **Agent changes.** [Testing](./testing.md#changes-an-agent-makes) shows how to run an agent's
316
491
  step in a test.
317
492
 
@@ -1,13 +1,13 @@
1
1
  # Quick start
2
2
 
3
- Build a week, day, month, and agenda calendar with the built-in views.
3
+ Build a week, day, month and agenda calendar in React with the built-in views.
4
4
 
5
- Source: https://time.molten.sh/docs/quick-start
5
+ Source: https://time.molten.sh/docs/react/quick-start
6
6
 
7
- You'll build this calendar: a toolbar, a view switcher, and the built-in week, day, month, and
8
- agenda views, showing your own meetings.
7
+ You'll build this calendar in React: a toolbar, a view switcher, and the built-in week, day, month
8
+ and agenda views, showing your own meetings.
9
9
 
10
- > Live example: see it at https://time.molten.sh/docs/quick-start
10
+ > Live example: see it at https://time.molten.sh/docs/react/quick-start
11
11
 
12
12
  To see these views running with more data before you start, open the [live demo](https://moltenship-time-demo.vercel.app).
13
13
 
@@ -15,16 +15,22 @@ To see these views running with more data before you start, open the [live demo]
15
15
 
16
16
  ### Install
17
17
 
18
- Install `@moltenship/calendar` as described in [Installation](./installation.md), including
19
- `Temporal` if your browsers need it.
18
+ Install `@moltenship/calendar` and its peer dependencies as [Installation](./installation.md#install)
19
+ describes, with a `Temporal` polyfill if your browsers need one.
20
20
 
21
21
  **Step 2**
22
22
 
23
23
  ### Add the UI source
24
24
 
25
- The views are source files that you add to your app with the shadcn CLI. They're built on
26
- shadcn/ui and its default Base UI primitives, so your app needs a Base UI style (see
27
- [UI source](./installation.md#ui-source-optional)). Add the week and day, month, and agenda views:
25
+ The views are source files that you add to your app with the shadcn CLI. They use shadcn/ui's
26
+ tokens and bring their own controls, so any shadcn style works (see
27
+ [UI source](./installation.md#ui-source-optional)). Name ui-sdk's CSS layer before Tailwind in
28
+ your global CSS, then add the week and day, month, and agenda views:
29
+
30
+ ```css title="globals.css"
31
+ @layer ui-sdk;
32
+ @import "tailwindcss";
33
+ ```
28
34
 
29
35
  ```bash
30
36
  npx shadcn@latest add \
@@ -34,7 +40,15 @@ npx shadcn@latest add \
34
40
  ```
35
41
 
36
42
  They bring the theme, the toolbar, view switcher and event chip from the shared `calendar` item,
37
- and the shadcn components they use. The files land in `components/calendar/`.
43
+ and the calendar's controls and popups from `calendar-ui`. The files land in
44
+ `components/calendar/` and are yours to change, as [Customization](./customization.md) describes.
45
+ The controls are built on ui-sdk, so name its CSS layer before Tailwind in
46
+ your global CSS:
47
+
48
+ ```css title="globals.css"
49
+ @layer ui-sdk;
50
+ @import "tailwindcss";
51
+ ```
38
52
 
39
53
  **Step 3**
40
54
 
@@ -136,17 +150,6 @@ Give the frame a height: the views fill it and scroll inside it. The calendar is
136
150
  you add an `onEventChange` handler; [Interactions](./interactions.md) shows how to save dragged and
137
151
  resized events.
138
152
 
139
- The toolbar's buttons use shadcn's `Tooltip`, which shadcn sets up with a `TooltipProvider` around
140
- your app. If your app doesn't have one yet, add it once:
141
-
142
- ```tsx title="app.tsx"
143
- import { TooltipProvider } from "@/components/ui/tooltip";
144
-
145
- <TooltipProvider>
146
- <TeamCalendar meetings={meetings} />
147
- </TooltipProvider>;
148
- ```
149
-
150
153
  > **Using Next.js?**
151
154
  >
152
155
  > Calendar modules are Client Components, which is why the file starts with `"use client"`. See
@@ -156,4 +159,5 @@ import { TooltipProvider } from "@/components/ui/tooltip";
156
159
 
157
160
  - [Interactions](./interactions.md): Let people move, resize, create, and delete events.
158
161
  - [Views](./views.md): Options for each built-in view.
159
- - [Theming](./theming.md): Colors, dark mode, and event colors.
162
+ - [Customization](./customization.md): Set tokens, edit the files you added, swap the controls, or build your own UI.
163
+ - [Agents](./agents/connect.md): Let an AI agent read this calendar and change it, under your rules.
@@ -2,9 +2,9 @@
2
2
 
3
3
  Expand series for the dates on screen, and ask which events a change applies to.
4
4
 
5
- Source: https://time.molten.sh/docs/guides/recurring-events
5
+ Source: https://time.molten.sh/docs/react/recurrence/calendar
6
6
 
7
- > Live example: see it at https://time.molten.sh/docs/guides/recurring-events
7
+ > Live example: see it at https://time.molten.sh/docs/react/recurrence/calendar
8
8
 
9
9
  These events repeat: a stand-up every weekday, with Wednesday's skipped and Thursday's moved an
10
10
  hour later, a 1:1 every other week, planning on eight Mondays, and a release day every Friday. Drag
@@ -13,15 +13,13 @@ this event, this and following events, or all events. The change waits on screen
13
13
 
14
14
  This guide builds that calendar with `@moltenship/calendar-recurrence`. It expands each series into
15
15
  its occurrences for the dates on screen, and turns a change to one occurrence into what to save.
16
- [Recurring events](../concepts/recurrence.md) explains the model behind it.
16
+ [Recurring events](./model.md) explains the model behind it.
17
17
 
18
18
  ## Install
19
19
 
20
20
  The recurrence package is separate from the calendar. It doesn't use React, so you can also expand
21
21
  series on a server.
22
22
 
23
- Like the calendar, `@moltenship/calendar-recurrence` is on npm as a release candidate for 1.0.0.
24
-
25
23
  **pnpm**
26
24
 
27
25
  ```bash
@@ -380,7 +378,7 @@ With your own event type or a database, write the same steps yourself:
380
378
  | `otherOverrides` | Call `recurrenceOverrideEdit(edit, recurrenceId)` for each override of `seriesId` you store, loaded or not, and keep, delete or rekey it. |
381
379
 
382
380
  The edit describes placement and recurrence only. If the change also edited the event's title or
383
- other fields, copy them yourself. [The reference](../api/recurrence.md#recurrenceedit) describes
381
+ other fields, copy them yourself. [The reference](./reference.md#recurrenceedit) describes
384
382
  each write.
385
383
 
386
384
  A "This event" delete adds the occurrence's start to the master's exception dates, which every
@@ -577,7 +575,24 @@ function applyEventChange(
577
575
  }
578
576
  ```
579
577
 
578
+ ## The dialog
579
+
580
+ The dialog shows one button per scope offered, always in the same order, then Cancel. Focus starts
581
+ on the narrowest scope offered, usually "This event".
582
+
583
+ | Key | What it does |
584
+ | -------------- | ------------------------------------------------------------------------ |
585
+ | Arrow keys | Move between the scopes, wrapping at the ends. Left and Right follow RTL |
586
+ | Tab, Shift+Tab | Move through the scopes and Cancel, and stay inside the dialog |
587
+ | Enter, Space | Pick the focused scope, or cancel |
588
+ | Escape | Cancel |
589
+
590
+ When it closes, focus goes back to where it was, such as the event, and only then does `ask`
591
+ resolve. Safari skips buttons on Tab unless a setting says otherwise, so the arrow keys reach every
592
+ scope there. The wording, English, is in `recurrence-scope.ts` beside the dialog, to edit or
593
+ translate.
594
+
580
595
  ## Recipes
581
596
 
582
- - [Google Calendar events](./google-calendar.md): Read masters, changed and cancelled occurrences, and RRULE, EXDATE and RDATE lines from the Calendar API.
583
- - [An ICS feed](./ics.md#recurring-events): Group a parsed feed into series with recurringEventsFromIcs, and expand it.
597
+ - [Google Calendar events](../guides/google-calendar.md): Read masters, changed and cancelled occurrences, and RRULE, EXDATE and RDATE lines from the Calendar API.
598
+ - [An ICS feed](../ics/feed.md#recurring-events): Group a parsed feed into series with recurringEventsFromIcs, and expand it.
@@ -1,16 +1,17 @@
1
- # Recurring events
1
+ # Series and occurrences
2
2
 
3
3
  Series, exceptions and overrides, how each series keeps its own time, occurrence IDs, and what "this", "following" and "all" change.
4
4
 
5
- Source: https://time.molten.sh/docs/concepts/recurrence
5
+ Source: https://time.molten.sh/docs/react/recurrence/model
6
6
 
7
7
  The calendar shows events, and knows nothing about series. `@moltenship/calendar-recurrence` sits
8
8
  beside it: it expands each series into its occurrences for the dates on screen, and the calendar
9
9
  shows those as ordinary events. Views, drag and drop, and the event engine work the same with or
10
10
  without it, and apps that don't import it pay nothing for it.
11
11
 
12
- This page explains the model. [Show and edit recurring events](../guides/recurring-events.md) wires
13
- it into a calendar, and the [API reference](../api/recurrence.md) lists every export.
12
+ This page explains the model. The [API reference](./reference.md) lists every export.
13
+
14
+ [Show and edit recurring events](./calendar.md) wires the model into a calendar.
14
15
 
15
16
  ## Series
16
17
 
@@ -34,9 +35,9 @@ Occurrences, 19–23 Oct: Mon 09:00, Tue 09:00, Thu 10:00, Fri 09:00
34
35
  ```
35
36
 
36
37
  Your events keep their own shape. A recurrence adapter, beside your event adapter, reads the
37
- recurrence of a master and what an override replaces, as an
38
- [event adapter](./events.md) reads titles and times. Series can be endless, so occurrences
39
- exist only for the dates you expand, usually the dates the calendar shows.
38
+ recurrence of a master and what an override replaces, as an [event adapter](../concepts/events.md)
39
+ reads titles and times. Series can be endless, so occurrences exist only for the dates you expand,
40
+ usually the dates the calendar shows.
40
41
 
41
42
  ## Each series keeps its own time
42
43
 
@@ -72,8 +73,9 @@ own keeps its ID, and with it its selection and focus. An override shows under t
72
73
  its master loads. One-off events keep their own IDs.
73
74
 
74
75
  Changing the following occurrences, or all of them, changes their original starts, and so their
75
- IDs. The edit maps old IDs to new ones, so your selection can follow; see
76
- [Keep the selection](../guides/recurring-events.md#keep-the-selection).
76
+ IDs. The edit's `occurrenceIds` maps old IDs to new ones, so your selection can follow.
77
+
78
+ See [Keep the selection](./calendar.md#keep-the-selection).
77
79
 
78
80
  ## Editing a series
79
81
 
@@ -114,9 +116,8 @@ events change and the series is expanded again.
114
116
  - **Drags use the calendar's clock.** In a time zone whose daylight saving time changes on other
115
117
  dates than the series' zone, a drag, resize or editor change with "All events" or "This and
116
118
  following events" moves the series by an hour more or less than the user did, unless the edit
117
- gets the calendar's `timeZone`, which
118
- [the guide](../guides/recurring-events.md#ask-which-events-a-change-applies-to) passes. With it,
119
- the change is replayed on the series' clock.
119
+ gets the calendar's `timeZone`. With it, the change is replayed on the series' clock.
120
+ [The guide](./calendar.md#ask-which-events-a-change-applies-to) passes it.
120
121
  - **A repeated hour.** A rule can't say "the later 02:30" of the night clocks go back, so with "All
121
122
  events" a start dropped on the later of two equal wall times gets an override there, and the rest
122
123
  of the series repeats at the earlier one.
@@ -1,53 +1,14 @@
1
- # Recurrence
1
+ # API reference
2
2
 
3
- Expand recurring series for the dates on screen, and edit one occurrence, the following ones or all of them, with @moltenship/calendar-recurrence.
3
+ Everything @moltenship/calendar-recurrence exports. Series and adapters, expansion, occurrence IDs, rules, the ICS bridge and edits.
4
4
 
5
- Source: https://time.molten.sh/docs/api/recurrence
5
+ Source: https://time.molten.sh/docs/react/recurrence/reference
6
6
 
7
- `@moltenship/calendar-recurrence` turns your recurring events into the occurrences the calendar
8
- shows. A series is stored the way iCalendar, Google Calendar and Outlook store it: one master event
9
- with a rule, plus events that replace single occurrences. The package expands masters for a range
10
- of dates, and turns a change to one occurrence into what to save for "this event", "this and
11
- following events" or "all events".
7
+ Everything on this page is exported from `@moltenship/calendar-recurrence`. The
8
+ [Overview](../recurrence.md) has the install command and a first example, and
9
+ [Series and occurrences](./model.md) explains the model.
12
10
 
13
- It's a separate package. `@moltenship/calendar` doesn't re-export it, and the calendar doesn't need
14
- it: occurrences reach the calendar as ordinary events, through an adapter. It depends on
15
- `@moltenship/calendar-core`, `@moltenship/calendar-temporal` and `@moltenship/ics`, and not on
16
- React.
17
-
18
- [Recurring events](../concepts/recurrence.md) explains the model, and
19
- [Show and edit recurring events](../guides/recurring-events.md) wires it into a calendar.
20
-
21
- ## Install
22
-
23
- Like the calendar, `@moltenship/calendar-recurrence` is on npm as a release candidate for 1.0.0.
24
-
25
- **pnpm**
26
-
27
- ```bash
28
- pnpm add @moltenship/calendar-recurrence
29
- ```
30
-
31
- **npm**
32
-
33
- ```bash
34
- npm install @moltenship/calendar-recurrence
35
- ```
36
-
37
- **yarn**
38
-
39
- ```bash
40
- yarn add @moltenship/calendar-recurrence
41
- ```
42
-
43
- **bun**
44
-
45
- ```bash
46
- bun add @moltenship/calendar-recurrence
47
- ```
48
-
49
- It needs the same setup as the calendar: a runtime with `Temporal`, or a polyfill loaded first,
50
- and TypeScript's `ESNext` library. See [Installation](../installation.md#temporal).
11
+ [Show and edit recurring events](./calendar.md) wires the package into a calendar.
51
12
 
52
13
  ## Series
53
14
 
@@ -82,7 +43,7 @@ DURATION.
82
43
  A `RecurrencePeriod` is an extra occurrence with its own `start` and `end`, both in the series'
83
44
  kind.
84
45
 
85
- `RecurrenceRule` is `@moltenship/ics`'s [`IcsRecurrenceRule`](./ics.md#recurrence), with
46
+ `RecurrenceRule` is `@moltenship/ics`'s [`IcsRecurrenceRule`](../ics/reference.md#recurrence), with
86
47
  `until` as a `RecurrenceDate`: `frequency`, `interval`, `count`, `until`, `byDay`, `byMonth`,
87
48
  `byMonthDay`, `bySetPosition`, `weekStart` and the rest. UNTIL is inclusive. With COUNT too, the
88
49
  series ends at whichever comes first.
@@ -103,12 +64,11 @@ An event that is both a master and an override is read as the override, with a
103
64
 
104
65
  ### RecurringCalendarEvent
105
66
 
106
- `RecurringCalendarEvent<TData, TEventId, TResourceId>` is core's
107
- [`CalendarEvent`](../concepts/events.md#records-in-times-own-shape) with an optional
108
- `recurrence: EventRecurrence` and `override: RecurrenceOverride`. Use it when your app has no event
109
- type of its own, with [`createCanonicalRecurrenceAdapter`](#adapters). It's also what
110
- [`recurringEventsFromIcs`](#ics-bridge) returns and [`applyRecurrenceEdit`](#applyrecurrenceedit)
111
- changes.
67
+ `RecurringCalendarEvent<TData, TEventId, TResourceId>` is core's [`CalendarEvent`](../concepts/events.md#records-in-times-own-shape)
68
+ with an optional `recurrence: EventRecurrence` and `override: RecurrenceOverride`. Use it when your
69
+ app has no event type of its own, with [`createCanonicalRecurrenceAdapter`](#adapters). It's also
70
+ what [`recurringEventsFromIcs`](#ics-bridge) returns and
71
+ [`applyRecurrenceEdit`](#applyrecurrenceedit) changes.
112
72
 
113
73
  ## Adapters
114
74
 
@@ -133,7 +93,6 @@ expander and the edit functions take it.
133
93
  exist only when `eventAdapter` has them, so core's defaults still apply.
134
94
 
135
95
  ```ts
136
- import { createCalendar } from "@moltenship/calendar";
137
96
  import {
138
97
  createCanonicalRecurrenceAdapter,
139
98
  createOccurrenceAdapter,
@@ -142,11 +101,11 @@ import {
142
101
  } from "@moltenship/calendar-recurrence";
143
102
 
144
103
  type Event = RecurringCalendarEvent<{ color: string }>;
104
+ type Occurrence = RecurrenceOccurrence<Event, string>;
145
105
  const adapters = createCanonicalRecurrenceAdapter<{ color: string }>();
146
106
 
147
- const Calendar = createCalendar<RecurrenceOccurrence<Event, string>>()({
148
- eventAdapter: createOccurrenceAdapter(adapters.event),
149
- });
107
+ // `createCalendar<Occurrence>()` takes this as its `eventAdapter`.
108
+ const eventAdapter = createOccurrenceAdapter(adapters.event);
150
109
  ```
151
110
 
152
111
  An occurrence's revision combines the revisions of its event and its series' master with its
@@ -466,8 +425,9 @@ setEvents(
466
425
  - `recurrenceEditScopes(change, adapters, options)` lists the `RecurrenceEditScope`s worth
467
426
  offering, in order: `"this"`, `"following"`, `"all"`. It leaves out those
468
427
  `resolveRecurrenceEdit` would reject, and `"following"` where it means `"all"`, as on the first
469
- occurrence. It's empty for a change that isn't recurring. Hand it to the
470
- [scope dialog](../guides/recurring-events.md#ask-which-events-a-change-applies-to).
428
+ occurrence. It's empty for a change that isn't recurring. Hand it to the dialog that asks for
429
+ the scope. [Ask which events a change applies
430
+ to](./calendar.md#ask-which-events-a-change-applies-to) builds one.
471
431
  - `resolveRecurrenceEdit(change, scope, adapters, options)` returns a `RecurrenceEdit`. It reads its
472
432
  arguments only: it never changes them or calls your code.
473
433
 
@@ -582,5 +542,6 @@ same objects.
582
542
 
583
543
  `createId(event)`, the one field of `ApplyRecurrenceEditOptions`, returns the ID of an event the
584
544
  edit creates: an override, or the new series when `newSeries.id` isn't set. It gets the event
585
- without its ID. Apps with their own event type or store write the same steps themselves; see
586
- [Save the edit](../guides/recurring-events.md#save-the-edit).
545
+ without its ID. Apps with their own event type or store write the same steps themselves.
546
+
547
+ See [Save the edit](./calendar.md#save-the-edit).