@moltenship/calendar 1.0.0-rc.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +27 -6
  2. package/dist/index.d.mts +3 -3
  3. package/dist/index.mjs +2 -2
  4. package/docs/accessibility.md +305 -0
  5. package/docs/agents/changes.md +449 -0
  6. package/docs/agents/coding-agents.md +116 -0
  7. package/docs/agents/connect.md +444 -0
  8. package/docs/agents/deleting.md +296 -0
  9. package/docs/agents/reference.md +511 -0
  10. package/docs/agents/server.md +317 -0
  11. package/docs/agents/webmcp.md +153 -0
  12. package/docs/agents.md +355 -0
  13. package/docs/annotations.md +198 -0
  14. package/docs/api/changes.md +264 -0
  15. package/docs/api/components.md +245 -0
  16. package/docs/api/dnd-kit.md +265 -0
  17. package/docs/api/events.md +153 -0
  18. package/docs/api/primitives.md +218 -0
  19. package/docs/api/store.md +92 -0
  20. package/docs/api.md +57 -0
  21. package/docs/availability.md +576 -0
  22. package/docs/comparison.md +278 -0
  23. package/docs/concepts/anatomy.md +73 -0
  24. package/docs/concepts/events.md +163 -0
  25. package/docs/concepts/how-it-works.md +112 -0
  26. package/docs/concepts/state.md +244 -0
  27. package/docs/concepts/time.md +168 -0
  28. package/docs/customization.md +271 -0
  29. package/docs/frameworks.md +116 -0
  30. package/docs/guides/dnd-kit.md +333 -0
  31. package/docs/guides/google-calendar-sync.md +1246 -0
  32. package/docs/guides/google-calendar.md +367 -0
  33. package/docs/guides/motion.md +414 -0
  34. package/docs/guides/nextjs-app-router.md +630 -0
  35. package/docs/guides/nextjs.md +149 -0
  36. package/docs/guides/performance.md +103 -0
  37. package/docs/guides/tanstack-query.md +485 -0
  38. package/docs/ics/feed.md +484 -0
  39. package/docs/ics/import.md +183 -0
  40. package/docs/ics/reference.md +482 -0
  41. package/docs/ics.md +142 -0
  42. package/docs/index.md +149 -0
  43. package/docs/installation.md +209 -0
  44. package/docs/interactions.md +441 -0
  45. package/docs/llms.txt +99 -0
  46. package/docs/migrating-to-2.md +497 -0
  47. package/docs/quick-start.md +163 -0
  48. package/docs/recurrence/calendar.md +598 -0
  49. package/docs/recurrence/model.md +128 -0
  50. package/docs/recurrence/reference.md +547 -0
  51. package/docs/recurrence.md +122 -0
  52. package/docs/stylex.md +290 -0
  53. package/docs/temporal/daylight-saving-time.md +172 -0
  54. package/docs/temporal/month-grid.md +119 -0
  55. package/docs/temporal/reference.md +167 -0
  56. package/docs/temporal.md +105 -0
  57. package/docs/testing.md +600 -0
  58. package/docs/theme-builder.md +82 -0
  59. package/docs/theming.md +275 -0
  60. package/docs/undo-redo.md +347 -0
  61. package/docs/views/agenda.md +222 -0
  62. package/docs/views/custom-views.md +195 -0
  63. package/docs/views/month.md +110 -0
  64. package/docs/views/resource-columns.md +265 -0
  65. package/docs/views/resource-timeline.md +226 -0
  66. package/docs/views/scrolling.md +193 -0
  67. package/docs/views/week-and-day.md +258 -0
  68. package/docs/views/year.md +138 -0
  69. package/docs/views.md +69 -0
  70. package/package.json +42 -14
  71. package/skills/moltenship-time/SKILL.md +77 -0
  72. package/skills/moltenship-time/references/agent-ready.md +272 -0
  73. package/skills/moltenship-time/references/changes.md +188 -0
  74. package/skills/moltenship-time/references/compose.md +175 -0
  75. package/skills/moltenship-time/references/mistakes.md +100 -0
  76. package/skills/moltenship-time/references/solid.md +213 -0
  77. package/skills/moltenship-time/references/state.md +129 -0
  78. package/skills/moltenship-time/references/testing.md +176 -0
@@ -0,0 +1,92 @@
1
+ # State store
2
+
3
+ Create calendar state outside Root, and change it from anywhere in your app.
4
+
5
+ Source: https://time.molten.sh/docs/react/api/store
6
+
7
+ `Root` creates a store for its [state](../concepts/state.md) automatically. Create one yourself when
8
+ code outside `Root` needs to change the calendar, or when the state should survive `Root`
9
+ unmounting. Everything here is exported from `@moltenship/calendar`. The store has no
10
+ framework in it: `@moltenship/calendar-solid` exports the same `createCalendarStore`.
11
+
12
+ ## createCalendarStore
13
+
14
+ ```ts
15
+ import { createCalendarStore } from "@moltenship/calendar";
16
+
17
+ const store = createCalendarStore<"day" | "days">({
18
+ defaultView: "day",
19
+ defaultAnchorDate: Temporal.PlainDate.from("2026-10-08"),
20
+ defaultTimeZone: "Europe/Berlin",
21
+ });
22
+
23
+ store.actions.setView("days");
24
+ store.getSnapshot().view; // "days"
25
+ ```
26
+
27
+ | Name | Type | Default | Description |
28
+ | ---------------------------- | ------------------------ | ------- | --------------------------------- |
29
+ | `defaultView` | `TView` | | Required. Initial view. |
30
+ | `defaultAnchorDate` | `Temporal.PlainDate` | | Required. Initial date. |
31
+ | `defaultTimeZone` | `string` | | Required. Initial IANA time zone. |
32
+ | `defaultSelection` | `TSelection \| null` | `null` | Initial selection. |
33
+ | `defaultFocus` | `TFocus \| null` | `null` | Initial focus. |
34
+ | `defaultExpandedResourceIds` | `readonly TResourceId[]` | `[]` | Initial expanded resources. |
35
+
36
+ The type arguments are `<TView, TSelection, TFocus, TResourceId>`. The store has three members:
37
+
38
+ - `actions`: `setView`, `setAnchorDate`, `setTimeZone`, `setSelection`, `setFocus`, and
39
+ `setExpandedResourceIds`. Each takes the new value and, optionally, `{ event?, reason?, source? }`
40
+ (`CalendarCommandOptions`), which a mounted `Root` passes on to its
41
+ [change handler](../concepts/state.md#what-a-handler-hears).
42
+ - `getSnapshot()`: the current state as one frozen object. It's a new object after each change.
43
+ - `subscribe(listener)`: calls `listener` after each change and returns an unsubscribe function.
44
+
45
+ `getSnapshot` and `subscribe` fit React's `useSyncExternalStore`, so any component can read the
46
+ store, inside `Root` or not:
47
+
48
+ ```tsx
49
+ import { useSyncExternalStore } from "react";
50
+
51
+ function ActiveViewName() {
52
+ const state = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
53
+ return <span>{state.view}</span>;
54
+ }
55
+ ```
56
+
57
+ ## Sharing a store with Root
58
+
59
+ Pass the store to `Root` with the `store` prop:
60
+
61
+ ```tsx
62
+ function JumpToHolidays() {
63
+ return (
64
+ <button onClick={() => store.actions.setAnchorDate(Temporal.PlainDate.from("2026-12-24"))}>
65
+ Holidays
66
+ </button>
67
+ );
68
+ }
69
+
70
+ <Calendar.Root
71
+ store={store}
72
+ events={meetings}
73
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
74
+ defaultTimeZone="Europe/Berlin"
75
+ locale="en-US"
76
+ weekRules={weekRules}
77
+ >
78
+ <Calendar.ActiveView />
79
+ </Calendar.Root>;
80
+ ```
81
+
82
+ - `Root` shows the store's values. TypeScript still asks for `defaultAnchorDate` and
83
+ `defaultTimeZone`, but `Root` ignores them when it has a store.
84
+ - `store.actions` go through the mounted `Root`: controlled props stay controlled, and their change
85
+ handlers run. If several mounted roots share the store, the most recently mounted one handles
86
+ them. A handler hears such a call with `reason: "imperative"` and `source: "programmatic"`, and
87
+ can stop it with `cancel()`.
88
+ - An [agent](../agents.md)'s changes go through the same store. The store has no agent API of its
89
+ own: agents reach the calendar through the mounted `Root`.
90
+ - `getSnapshot()` returns the values the store holds. A value you control with a prop lives in your
91
+ own state, not in the store.
92
+ - Unmounting `Root` leaves the store as it was.
package/docs/api.md ADDED
@@ -0,0 +1,57 @@
1
+ # Overview
2
+
3
+ What each package exports, and where to import it from.
4
+
5
+ Source: https://time.molten.sh/docs/react/api
6
+
7
+ In a React app, import from `@moltenship/calendar`. It includes the React components and hooks,
8
+ the event engine, the Temporal helpers, and the pointer interactions, so one import line covers the
9
+ calendar:
10
+
11
+ ```ts
12
+ import { createCalendar, defineCalendarView, plainDateInterval } from "@moltenship/calendar";
13
+ ```
14
+
15
+ - [Components and hooks](./api/components.md): createCalendar, Root and its props, components, hooks, meta, diagnostics.
16
+ - [Events and snapshots](./api/events.md): Adapters, ranges, validation, snapshots, and queries.
17
+ - [Event changes](./api/changes.md): Proposals, changes, policies, placement helpers, and the pointer layer.
18
+ - [State store](./api/store.md): Calendar state without Root, and sharing a store with Root.
19
+ - [Temporal helpers](./temporal/reference.md): Ranges, grids, rounding, day boundaries, and DST from calendar-temporal.
20
+ - [Primitives](./api/primitives.md): The calendar without a framework, for integrations. A separate package.
21
+ - [iCalendar (ICS)](./ics/reference.md): Parse ICS feeds and files into typed Temporal values. A separate package.
22
+ - [Recurrence](./recurrence/reference.md): Expand recurring series for the dates on screen, and edit them. A separate package.
23
+ - [dnd-kit adapter](./api/dnd-kit.md): Drag your dnd-kit items into the calendar and events out. A separate package.
24
+ - [Agent reference](./agents/reference.md): What a calendar tells an AI agent: snapshot fields, actions, arguments and errors.
25
+
26
+ The iCalendar parser, `@moltenship/ics`, stands alone. `@moltenship/calendar` doesn't re-export it,
27
+ so install it and import it by its own name. It doesn't need the calendar either.
28
+
29
+ Recurring events come from `@moltenship/calendar-recurrence`, which `@moltenship/calendar` doesn't
30
+ re-export either. It turns series into occurrences that the calendar shows as ordinary events.
31
+
32
+ `@moltenship/calendar-dnd-kit` connects the calendar to dnd-kit, for apps that drag their own items
33
+ into it. It's optional and not re-exported, so the calendar's install carries no dnd-kit.
34
+
35
+ Tests use `@moltenship/calendar-testing`, a development dependency: see [Testing](./testing.md).
36
+
37
+ The agent bridge isn't the calendar's: `createAgent`, `agentTools` and `registerTools` come from
38
+ `@ui-sdk/react/agent`, which your app imports itself. See [Agents in your app](./agents.md).
39
+
40
+ ## Packages
41
+
42
+ | Package | Contents | Dependencies |
43
+ | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
44
+ | `@moltenship/calendar` | Re-exports `calendar-react`, `-core`, `-temporal` and `-dnd`. Since 2.0 it ships these docs as Markdown and a skill for coding agents | Those four; React 19, `@ui-sdk/core`, `@ui-sdk/react` (peers) |
45
+ | `@moltenship/calendar-react` | `createCalendar`, `defineCalendarView`, components, hooks, store | `calendar-primitives`, `calendar-dnd`, `calendar-core`, `calendar-temporal`; React 19, `@ui-sdk/core`, `@ui-sdk/react` (peers) |
46
+ | `@moltenship/calendar-primitives` | The calendar's state, actions and runtime, agent actions included, with no framework. Not re-exported. | `calendar-core`, `calendar-temporal`; `@ui-sdk/core` (peer) |
47
+ | `@moltenship/calendar-solid` | `createCalendar`, `defineCalendarView`, parts and hooks for SolidJS 2, and re-exports `-core`, `-temporal` and the pointer helpers of `-dnd`. Not re-exported. | `calendar-primitives`, `calendar-dnd`, `calendar-core`, `calendar-temporal`; `solid-js`, `@solidjs/web`, `@ui-sdk/core`, `@ui-sdk/solid` (peers) |
48
+ | `@moltenship/calendar-core` | Adapters, validation, snapshots, queries, changes and policies, view strategies, availability. No React. | `calendar-temporal`, `@flatten-js/interval-tree` |
49
+ | `@moltenship/calendar-temporal` | Ranges, grids, rounding, zoned days, DST | None |
50
+ | `@moltenship/calendar-dnd` | Pointer drag, resize, and create for views, with no framework | `calendar-core`, `calendar-temporal` |
51
+ | `@moltenship/ics` | iCalendar parsing into Temporal values. Not re-exported. | None |
52
+ | `@moltenship/calendar-recurrence` | Series expansion, occurrence IDs, series edits. Not re-exported. | `calendar-core`, `calendar-temporal`, `ics` |
53
+ | `@moltenship/calendar-dnd-kit` | dnd-kit items dragged in, events dragged out. Not re-exported. | `calendar-dnd`, `calendar-core`; React 19, dnd-kit 0.5 (peers) |
54
+ | `@moltenship/calendar-testing` | A test harness for a React calendar: fixed clock, builders, render and hydration | `calendar`, `calendar-recurrence`; React and React DOM 19, `@ui-sdk/core`, `@ui-sdk/react` (peers) |
55
+
56
+ Every package is ESM only. Import from the package name: paths inside a package aren't part of the
57
+ API.