@moltenship/calendar 1.0.0-rc.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -6
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/docs/accessibility.md +305 -0
- package/docs/agents/changes.md +449 -0
- package/docs/agents/coding-agents.md +116 -0
- package/docs/agents/connect.md +444 -0
- package/docs/agents/deleting.md +296 -0
- package/docs/agents/reference.md +511 -0
- package/docs/agents/server.md +317 -0
- package/docs/agents/webmcp.md +153 -0
- package/docs/agents.md +355 -0
- package/docs/annotations.md +198 -0
- package/docs/api/changes.md +264 -0
- package/docs/api/components.md +245 -0
- package/docs/api/dnd-kit.md +265 -0
- package/docs/api/events.md +153 -0
- package/docs/api/primitives.md +218 -0
- package/docs/api/store.md +92 -0
- package/docs/api.md +57 -0
- package/docs/availability.md +576 -0
- package/docs/comparison.md +278 -0
- package/docs/concepts/anatomy.md +73 -0
- package/docs/concepts/events.md +163 -0
- package/docs/concepts/how-it-works.md +112 -0
- package/docs/concepts/state.md +244 -0
- package/docs/concepts/time.md +168 -0
- package/docs/customization.md +271 -0
- package/docs/frameworks.md +116 -0
- package/docs/guides/dnd-kit.md +333 -0
- package/docs/guides/google-calendar-sync.md +1246 -0
- package/docs/guides/google-calendar.md +367 -0
- package/docs/guides/motion.md +414 -0
- package/docs/guides/nextjs-app-router.md +630 -0
- package/docs/guides/nextjs.md +149 -0
- package/docs/guides/performance.md +103 -0
- package/docs/guides/tanstack-query.md +485 -0
- package/docs/ics/feed.md +484 -0
- package/docs/ics/import.md +183 -0
- package/docs/ics/reference.md +482 -0
- package/docs/ics.md +142 -0
- package/docs/index.md +149 -0
- package/docs/installation.md +209 -0
- package/docs/interactions.md +441 -0
- package/docs/llms.txt +99 -0
- package/docs/migrating-to-2.md +497 -0
- package/docs/quick-start.md +163 -0
- package/docs/recurrence/calendar.md +598 -0
- package/docs/recurrence/model.md +128 -0
- package/docs/recurrence/reference.md +547 -0
- package/docs/recurrence.md +122 -0
- package/docs/stylex.md +290 -0
- package/docs/temporal/daylight-saving-time.md +172 -0
- package/docs/temporal/month-grid.md +119 -0
- package/docs/temporal/reference.md +167 -0
- package/docs/temporal.md +105 -0
- package/docs/testing.md +600 -0
- package/docs/theme-builder.md +82 -0
- package/docs/theming.md +275 -0
- package/docs/undo-redo.md +347 -0
- package/docs/views/agenda.md +222 -0
- package/docs/views/custom-views.md +195 -0
- package/docs/views/month.md +110 -0
- package/docs/views/resource-columns.md +265 -0
- package/docs/views/resource-timeline.md +226 -0
- package/docs/views/scrolling.md +193 -0
- package/docs/views/week-and-day.md +258 -0
- package/docs/views/year.md +138 -0
- package/docs/views.md +69 -0
- package/package.json +42 -14
- package/skills/moltenship-time/SKILL.md +77 -0
- package/skills/moltenship-time/references/agent-ready.md +272 -0
- package/skills/moltenship-time/references/changes.md +188 -0
- package/skills/moltenship-time/references/compose.md +175 -0
- package/skills/moltenship-time/references/mistakes.md +100 -0
- package/skills/moltenship-time/references/solid.md +213 -0
- package/skills/moltenship-time/references/state.md +129 -0
- package/skills/moltenship-time/references/testing.md +176 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Customization
|
|
2
|
+
|
|
3
|
+
How much of the calendar's UI is yours to change, from its tokens to every element on screen, built on the unstyled parts and hooks.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/customization
|
|
6
|
+
|
|
7
|
+
Time is a headless core and one ready-made UI on top of it.
|
|
8
|
+
|
|
9
|
+
- **The core is the npm packages.** They hold the engine, the calendar's state and actions, and
|
|
10
|
+
parts and hooks that render plain elements. They ship no CSS.
|
|
11
|
+
- **The UI is the registry.** It's a set of React source files built on those packages: the views,
|
|
12
|
+
the toolbar, a kit of controls and a theme, in Tailwind CSS on shadcn/ui's tokens or in
|
|
13
|
+
[StyleX](./stylex.md). `shadcn add` copies them into your app, and from then on
|
|
14
|
+
they are your code.
|
|
15
|
+
|
|
16
|
+
Nothing in the packages depends on the registry. So every part of that UI is yours to change or
|
|
17
|
+
replace, and an app on MUI, Mantine or its own design system uses the same packages without it.
|
|
18
|
+
|
|
19
|
+
There are four levels, from the least work to the most:
|
|
20
|
+
|
|
21
|
+
| Level | You change | Where | What it costs |
|
|
22
|
+
| -------------------- | -------------------------------------------- | ------------------------- | ------------------------------------------------------------------- |
|
|
23
|
+
| 1. Set tokens | Colors, the event palette, sizes | Your global CSS | Nothing |
|
|
24
|
+
| 2. Edit the files | Markup, classes, layout, a view's behaviour | `components/calendar/` | A merge when a file you edited gets an update |
|
|
25
|
+
| 3. Swap the controls | The buttons, tooltips, popovers and the rest | `components/calendar/ui/` | That merge, and an agent sees less of your controls |
|
|
26
|
+
| 4. Build your own UI | Everything on screen | Your own components | You write the views, with their keyboard support and their dragging |
|
|
27
|
+
|
|
28
|
+
[What each level costs](#what-each-level-costs) has the details.
|
|
29
|
+
|
|
30
|
+
The levels mix. One calendar can show the registry's month view, a toolbar you edited and a view
|
|
31
|
+
you wrote.
|
|
32
|
+
|
|
33
|
+
## Level 1: set tokens
|
|
34
|
+
|
|
35
|
+
The registry's views read their colors and sizes from CSS variables. Override them in your own
|
|
36
|
+
CSS:
|
|
37
|
+
|
|
38
|
+
```css title="globals.css"
|
|
39
|
+
:root {
|
|
40
|
+
--calendar-today: oklch(0.55 0.17 150);
|
|
41
|
+
--calendar-hour-height: 4rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dark {
|
|
45
|
+
--calendar-today: oklch(0.72 0.15 150);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Most calendar tokens derive from the shadcn tokens, so an app with its own shadcn theme gets a
|
|
50
|
+
calendar in its colors before it writes a rule. [Theming](./theming.md) lists every token, and the
|
|
51
|
+
[Theme builder](./theme-builder.md) shows your changes live and gives you the CSS to paste. The
|
|
52
|
+
StyleX items have the same tokens as StyleX variables, which
|
|
53
|
+
[Change the tokens](./stylex.md#change-the-tokens) covers.
|
|
54
|
+
|
|
55
|
+
You keep everything, updates included. `shadcn add` writes the theme's own block again each time,
|
|
56
|
+
and your rules sit outside that block. Tokens change colors, the event palette, the hour height
|
|
57
|
+
and the event padding. They don't change markup or layout.
|
|
58
|
+
|
|
59
|
+
## Level 2: edit the files you added
|
|
60
|
+
|
|
61
|
+
`shadcn add` puts source files in `components/calendar/`: a folder for each view, the toolbar,
|
|
62
|
+
the view switcher and the event chip beside them, and the controls in `ui/`. Open a file and
|
|
63
|
+
change it. The toolbar's tooltips open after 400 ms, for example. To open them sooner, change the
|
|
64
|
+
default in the tooltip's file:
|
|
65
|
+
|
|
66
|
+
```ts title="components/calendar/ui/tooltip.styles.ts"
|
|
67
|
+
export const tooltipDefaults = { delay: 150, sideOffset: 4 } as const;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The same goes for a view's markup, the toolbar's layout in `calendar-toolbar.tsx`, and a control's
|
|
71
|
+
classes in its `*.styles.ts` file.
|
|
72
|
+
|
|
73
|
+
### Updates
|
|
74
|
+
|
|
75
|
+
The files are copies, so a fix in the registry reaches your app when you add the item again:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx shadcn@latest add https://time.molten.sh/r/month-view.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The command goes through the item's files and the files of the items it builds on. It writes a
|
|
82
|
+
file your app doesn't have, skips a file that matches the registry's, and asks before it replaces
|
|
83
|
+
a file that differs. Answer no to keep yours. `--overwrite` replaces every file without asking,
|
|
84
|
+
with any edits you made.
|
|
85
|
+
|
|
86
|
+
To see what the command would do before it writes anything, add `--dry-run`. It lists each file
|
|
87
|
+
as `create`, `skip (identical)` or `overwrite`, which marks a file that differs. `--diff` with a
|
|
88
|
+
path from that list prints the difference between your file and the registry's, and writes
|
|
89
|
+
nothing either:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx shadcn@latest add https://time.molten.sh/r/month-view.json --dry-run
|
|
93
|
+
npx shadcn@latest add https://time.molten.sh/r/month-view.json \
|
|
94
|
+
--diff components/calendar/month-view/month-view.tsx
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The diff compares the two files as they are now, so it shows your edits and the registry's changes
|
|
98
|
+
together. To separate them, commit your work, let `shadcn add` replace the file, and put your edits
|
|
99
|
+
back from `git diff`.
|
|
100
|
+
|
|
101
|
+
You keep the registry's UI and everything it does. You take on that merge for each file you
|
|
102
|
+
edited. Files you didn't touch update without a question.
|
|
103
|
+
|
|
104
|
+
## Level 3: swap the controls
|
|
105
|
+
|
|
106
|
+
The Tailwind views take their controls from `button.tsx`, `badge.tsx`, `tooltip.tsx`,
|
|
107
|
+
`select.tsx`, `popover.tsx`, `dialog.tsx` and `toast.tsx` in `components/calendar/ui/`: the
|
|
108
|
+
buttons, badges, tooltips, view select, popovers, the recurrence dialog and the undo toast. Since
|
|
109
|
+
2.0 those controls are built on [ui-sdk](https://ui-sdk.dev), and they are a default. The views import them from
|
|
110
|
+
those files only and use them through a short list of props. To use a control of your own,
|
|
111
|
+
replace the body of its file and keep the names it exports. With shadcn's button:
|
|
112
|
+
|
|
113
|
+
```tsx title="components/calendar/ui/button.tsx"
|
|
114
|
+
import type { ComponentProps } from "react";
|
|
115
|
+
|
|
116
|
+
import { Button as AppButton, buttonVariants } from "@/components/ui/button";
|
|
117
|
+
|
|
118
|
+
export type ButtonProps = ComponentProps<typeof AppButton>;
|
|
119
|
+
|
|
120
|
+
export function Button(props: ButtonProps) {
|
|
121
|
+
return <AppButton {...props} />;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { buttonVariants };
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Every view now renders your button, and no view's file changes.
|
|
128
|
+
[Use your own controls](./theming.md#use-your-own-controls) lists what the views import from each
|
|
129
|
+
file and the props they pass, and how to give a shadcn popover the handle that one popover for
|
|
130
|
+
many triggers needs.
|
|
131
|
+
|
|
132
|
+
This is an edit like any other, so `shadcn add` asks before it replaces the file. Swapping also
|
|
133
|
+
has [two costs of its own](#what-each-level-costs).
|
|
134
|
+
|
|
135
|
+
## Level 4: build your own UI
|
|
136
|
+
|
|
137
|
+
Your app adds nothing from the registry at this level. It installs the packages, writes its own
|
|
138
|
+
markup or uses any library's components, and connects them to the calendar through parts and
|
|
139
|
+
hooks:
|
|
140
|
+
|
|
141
|
+
- **Parts.** `Frame`, `Toolbar`, `Title`, `Viewport` and the previous, next and today triggers
|
|
142
|
+
each render one plain element with a `data-calendar-part` attribute. They take `className`,
|
|
143
|
+
`style`, `ref` and event handlers, and bring no class or style of their own.
|
|
144
|
+
[Components](./api/components.md#components) lists them.
|
|
145
|
+
- **Hooks.** `useCalendarActions()` returns `navigateNext`, `setView`, `proposeEventChange` and
|
|
146
|
+
the other [actions](./api/components.md#actions), for controls of your own.
|
|
147
|
+
`useCalendarSelector` and the other [hooks](./api/components.md#hooks) read the state.
|
|
148
|
+
- **Views.** A [custom view](./views/custom-views.md) is a strategy, which picks the dates and
|
|
149
|
+
the events, and a `Renderer`, which is your component.
|
|
150
|
+
|
|
151
|
+
This calendar uses plain elements and class names from the app's own CSS:
|
|
152
|
+
|
|
153
|
+
```tsx title="meeting-calendar.tsx"
|
|
154
|
+
// The strategy picks the dates and the meetings. The Renderer is your markup.
|
|
155
|
+
const weekView = defineCalendarView({
|
|
156
|
+
name: "week",
|
|
157
|
+
strategy: {
|
|
158
|
+
getRange: (anchor) => plainDateInterval(anchor, anchor.add({ days: 7 })),
|
|
159
|
+
navigate: (anchor, delta) => anchor.add({ weeks: delta }),
|
|
160
|
+
getTitle: (range, { locale }) => range.start.toLocaleString(locale, { dateStyle: "medium" }),
|
|
161
|
+
project: ({ snapshot, instantRange }: CalendarViewProjectionInput<undefined, Meeting>) =>
|
|
162
|
+
snapshot.queryTimed(instantRange),
|
|
163
|
+
},
|
|
164
|
+
Renderer: ({ projection, environment }) => (
|
|
165
|
+
<ul className="meeting-list">
|
|
166
|
+
{projection.map(({ event }) => (
|
|
167
|
+
<li key={event.id}>
|
|
168
|
+
<time dateTime={event.start.toString()}>
|
|
169
|
+
{event.start.toLocaleString(environment.locale, {
|
|
170
|
+
dateStyle: "medium",
|
|
171
|
+
timeStyle: "short",
|
|
172
|
+
timeZone: environment.timeZone,
|
|
173
|
+
})}
|
|
174
|
+
</time>{" "}
|
|
175
|
+
{event.title}
|
|
176
|
+
</li>
|
|
177
|
+
))}
|
|
178
|
+
</ul>
|
|
179
|
+
),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export const Calendar = createCalendar<Meeting>()({ eventAdapter, views: [weekView] });
|
|
183
|
+
|
|
184
|
+
function Toolbar() {
|
|
185
|
+
const { navigateToday } = Calendar.useCalendarActions();
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<Calendar.Toolbar className="toolbar">
|
|
189
|
+
{/* A control of your own calls an action. */}
|
|
190
|
+
<button
|
|
191
|
+
className="button"
|
|
192
|
+
type="button"
|
|
193
|
+
onClick={(event) => navigateToday({ event: event.nativeEvent })}
|
|
194
|
+
>
|
|
195
|
+
Today
|
|
196
|
+
</button>
|
|
197
|
+
{/* The calendar's triggers are plain buttons that take your classes. */}
|
|
198
|
+
<Calendar.PreviousTrigger className="button">Previous</Calendar.PreviousTrigger>
|
|
199
|
+
<Calendar.NextTrigger className="button">Next</Calendar.NextTrigger>
|
|
200
|
+
<Calendar.Title className="title" />
|
|
201
|
+
</Calendar.Toolbar>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function MeetingCalendar({ meetings }: { readonly meetings: readonly Meeting[] }) {
|
|
206
|
+
return (
|
|
207
|
+
<Calendar.Root
|
|
208
|
+
events={meetings}
|
|
209
|
+
defaultAnchorDate={Temporal.PlainDate.from("2026-10-05")}
|
|
210
|
+
defaultTimeZone="Europe/Berlin"
|
|
211
|
+
label="Team meetings"
|
|
212
|
+
locale="en-US"
|
|
213
|
+
weekRules={{ firstDay: 1, minimalDays: 4, weekend: [6, 7] }}
|
|
214
|
+
>
|
|
215
|
+
<Calendar.Frame className="calendar">
|
|
216
|
+
<Toolbar />
|
|
217
|
+
<Calendar.Viewport>
|
|
218
|
+
<Calendar.ActiveView />
|
|
219
|
+
</Calendar.Viewport>
|
|
220
|
+
</Calendar.Frame>
|
|
221
|
+
</Calendar.Root>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
A library's components go where the plain elements are. The Today button can be your library's
|
|
227
|
+
`Button` with the same `onClick`. Pass the click's native event as `event`, so a
|
|
228
|
+
[state handler](./concepts/state.md#what-a-handler-hears) hears how the person caused the
|
|
229
|
+
change. A button that can render another element in its place can render one of the
|
|
230
|
+
calendar's triggers instead, as the registry's toolbar does with
|
|
231
|
+
`<Button render={<TodayTrigger aria-label="Today" />}>`.
|
|
232
|
+
|
|
233
|
+
`@ui-sdk/core` and `@ui-sdk/react` are peer dependencies since 2.0. The calendar's state, its actions and what an agent reads are written on ui-sdk, and ui-sdk's
|
|
234
|
+
parts are unstyled too. Installing them adds no look to your page and doesn't decide which
|
|
235
|
+
components you use.
|
|
236
|
+
|
|
237
|
+
You keep the engine, the state, [saving changes](./interactions.md#saving-changes) with policies
|
|
238
|
+
and pending state, and the actions an agent calls: an [agent bridge](./agents/connect.md) lists a
|
|
239
|
+
calendar that renders `Frame`, whatever draws its views. You write the rest:
|
|
240
|
+
|
|
241
|
+
- **The views.** The registry's views get their layouts from functions the packages export, such
|
|
242
|
+
as `projectMonth` and `projectList`. Your view's `project` can call the same ones, and your
|
|
243
|
+
`Renderer` draws the result.
|
|
244
|
+
- **Dragging.** [`useCalendarPointer`](./interactions.md#in-your-own-views) turns drags in your
|
|
245
|
+
markup into changes, from a few `data-*` attributes.
|
|
246
|
+
- **Keyboard support and announcements.**
|
|
247
|
+
[In your own views](./accessibility.md#in-your-own-views) has the hooks, and
|
|
248
|
+
`Calendar.Announcer` speaks the changes.
|
|
249
|
+
|
|
250
|
+
A Solid app can start at any level: the Solid registry has every view, and the
|
|
251
|
+
[Solid quick start](https://time.molten.sh/docs/solid/quick-start.md) builds a calendar at this one.
|
|
252
|
+
|
|
253
|
+
## What each level costs
|
|
254
|
+
|
|
255
|
+
- **An edited file takes a merge.** From level 2 on, `shadcn add` no longer updates a file you
|
|
256
|
+
changed without asking. You bring the registry's fixes into that file yourself, as
|
|
257
|
+
[Updates](#updates) describes.
|
|
258
|
+
- **An agent sees less of a control that isn't built on ui-sdk.** An
|
|
259
|
+
[agent bridge](./agents/connect.md) lists ui-sdk's components. The kit's buttons and view
|
|
260
|
+
select are entries in that list. A control of your own is there only as far as your component
|
|
261
|
+
tells the bridge, and a control from a library that isn't built on ui-sdk, such as stock shadcn
|
|
262
|
+
or MUI, tells it nothing. The calendar stays on the bridge at every level, so an agent still
|
|
263
|
+
navigates and changes the view with the calendar's own actions.
|
|
264
|
+
- **A React control needs a Solid twin.** ui-sdk has the same components in React and Solid, so a
|
|
265
|
+
control built on it behaves alike in both. A control built on a React library exists in React
|
|
266
|
+
only, so a Solid app needs its own version of it. The Solid registry's views use its own
|
|
267
|
+
kit, so that matters only for a control of yours.
|
|
268
|
+
- **At level 4, the views are yours to write and test.** That includes laying out overlapping
|
|
269
|
+
events, keyboard navigation, dragging and screen reader announcements. The packages give you the
|
|
270
|
+
functions and hooks for each, and the registry's views are source you can read while you write
|
|
271
|
+
yours.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# React and Solid
|
|
2
|
+
|
|
3
|
+
What the React and SolidJS 2 integrations share, what each one has, and what Solid doesn't have.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/frameworks
|
|
6
|
+
|
|
7
|
+
Time's engine is in packages that import no UI framework. An integration package renders it in
|
|
8
|
+
one framework. There are two integrations, and each has its own docs: the select at the top of the
|
|
9
|
+
sidebar switches between them and keeps you on the same page where both have it. React's
|
|
10
|
+
integration and SolidJS 2's have the same parts and hooks, and the registry has every view for
|
|
11
|
+
both, in StyleX for React alone.
|
|
12
|
+
|
|
13
|
+
## The layers
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
views React or Solid source from the registry, or components you write
|
|
17
|
+
integration @moltenship/calendar (React) @moltenship/calendar-solid (Solid)
|
|
18
|
+
calendar @moltenship/calendar-primitives state, actions, what an agent can call
|
|
19
|
+
engine @moltenship/calendar-core events, time zones, layout, changes, policies
|
|
20
|
+
@moltenship/calendar-temporal
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The engine and the calendar layer import neither React nor Solid. Each integration is a thin
|
|
24
|
+
package over them. It renders the parts and binds state to its framework's reactivity. The React
|
|
25
|
+
and Solid integrations don't import each other.
|
|
26
|
+
|
|
27
|
+
The calendar layer also holds the logic for keyboard navigation, roving focus, gesture drafts and
|
|
28
|
+
undo history, and `@moltenship/calendar-dnd`, the pointer layer, imports no framework. Both
|
|
29
|
+
integrations bind all of them, so a key or a drag does the same thing in both.
|
|
30
|
+
|
|
31
|
+
## What is the same
|
|
32
|
+
|
|
33
|
+
These work the same in both frameworks, because they run below the integration:
|
|
34
|
+
|
|
35
|
+
| Topic | What both frameworks share | Read |
|
|
36
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
37
|
+
| Events | `defineEventAdapter`, validation, snapshots and queries | [Events and adapters](./concepts/events.md) |
|
|
38
|
+
| Time | `Temporal` values, timed, all-day and floating events, time zones and daylight saving time | [Time and time zones](./concepts/time.md) |
|
|
39
|
+
| State | The six state values, controlled and uncontrolled props, change handlers, and `createCalendarStore` | [State](./concepts/state.md) |
|
|
40
|
+
| Recurrence | `@moltenship/calendar-recurrence` turns series into ordinary events before the calendar sees them | [Series and occurrences](./recurrence/model.md) |
|
|
41
|
+
| Changes | Proposals, `onEventChange`, `onEventChangeResult`, policies and pending changes | [Interactions](./interactions.md#saving-changes) |
|
|
42
|
+
| Undo history | `createEventHistory` records results, and `useCalendarHistory` takes them back | [Undo and redo](./undo-redo.md) |
|
|
43
|
+
| Keyboard | The keys, roving focus and keyboard move, resize and create, through `useCalendarKeyboard` | [Keyboard](./accessibility.md#keyboard) |
|
|
44
|
+
| Pointer gestures | Drag, resize and create with a mouse, a pen or touch, through `useCalendarPointer` | [Pointer layer](./api/changes.md#pointer-layer) |
|
|
45
|
+
| Announcements | `Announcer` and the messages a screen reader hears | [Announcements](./accessibility.md#announcements) |
|
|
46
|
+
| Agents | The actions an agent can call, with the same names, inputs, results and errors | [Agents in your app](./agents.md) |
|
|
47
|
+
| `Root` | Its props have the same names, types and defaults | [`Root`](./api/components.md#root) |
|
|
48
|
+
| A view's strategy | `getRange`, `navigate`, `getTitle` and `project`, and the engine's projections, such as `projectMonth` | [Custom views](./views/custom-views.md#strategy) |
|
|
49
|
+
| CSS hooks | Each part renders the same `data-calendar-part` attribute, so a selector written for one matches the other | [Components](./api/components.md#components) |
|
|
50
|
+
|
|
51
|
+
## What differs
|
|
52
|
+
|
|
53
|
+
| | React | Solid |
|
|
54
|
+
| ----------------------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
55
|
+
| Framework version | React 19 | SolidJS 2.0 |
|
|
56
|
+
| Packages you install | `@moltenship/calendar`, `@ui-sdk/core`, `@ui-sdk/react` | `@moltenship/calendar-solid`, `@ui-sdk/core`, `@ui-sdk/solid` |
|
|
57
|
+
| Parts | `Root`, the structural parts, `Event` and `Announcer` | The same parts |
|
|
58
|
+
| Hooks | Every hook, returning values | The same hooks: accessors for state, refs from `useCalendarKeyboard` and `useCalendarPointer` |
|
|
59
|
+
| Ready-made views | The registry's views, in shadcn/ui with Tailwind CSS or in StyleX | The registry's views, in Tailwind CSS; none in StyleX |
|
|
60
|
+
| Keyboard navigation in a view | Yes | Yes |
|
|
61
|
+
| Drag, resize and create | Yes, with a mouse, a pen or touch | Yes, with a mouse, a pen or touch |
|
|
62
|
+
| Undo and redo | `useCalendarHistory`, its shortcuts and the registry's toast | The same, with the registry's toast |
|
|
63
|
+
| Screen reader announcements | `Calendar.Announcer` | `Calendar.Announcer` |
|
|
64
|
+
| Server rendering | Yes | Yes, with `renderToString` and `hydrate` |
|
|
65
|
+
| Testing package | `@moltenship/calendar-testing` | None. That package has React as a peer dependency |
|
|
66
|
+
| Agent bridge | `@ui-sdk/react/agent` | `@ui-sdk/solid/agent` |
|
|
67
|
+
|
|
68
|
+
## What Solid doesn't have
|
|
69
|
+
|
|
70
|
+
| Missing | In React it's |
|
|
71
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
72
|
+
| StyleX views | The registry's `stylex-` items, which are React source |
|
|
73
|
+
| A testing package | `@moltenship/calendar-testing`, which is React only |
|
|
74
|
+
| A dnd-kit adapter | `@moltenship/calendar-dnd-kit`, which has React as a peer dependency |
|
|
75
|
+
|
|
76
|
+
The registry's Solid items install with the same `shadcn add` command as React's, from the Solid
|
|
77
|
+
registry, and `calendar-full` installs all of them. [Issue #279](https://github.com/Moltenship/time/issues/279)
|
|
78
|
+
tracked the steps. StyleX views for Solid are out of scope for 2.0, and the testing package and
|
|
79
|
+
the dnd-kit adapter have no Solid plan yet.
|
|
80
|
+
|
|
81
|
+
For a view the registry doesn't have, you write its `Renderer` with the package's hooks, as
|
|
82
|
+
[Custom views](https://time.molten.sh/docs/solid/views/custom-views.md) does. The
|
|
83
|
+
[Solid demo](https://moltenship-time-demo.vercel.app/solid/) is the React demo's app in Solid, on
|
|
84
|
+
the registry's views, with keyboard navigation, dragging and undo. Its source is the repository's
|
|
85
|
+
[`apps/demo-solid`](https://github.com/Moltenship/time/tree/main/apps/demo-solid).
|
|
86
|
+
|
|
87
|
+
The Solid docs have no page on something Solid lacks, so they have none on StyleX, testing or the
|
|
88
|
+
dnd-kit adapter.
|
|
89
|
+
|
|
90
|
+
## From React to Solid
|
|
91
|
+
|
|
92
|
+
The same calendar reads differently in the two frameworks in these places:
|
|
93
|
+
|
|
94
|
+
| In React | In Solid |
|
|
95
|
+
| -------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| Hooks return values | Hooks that read state return accessors: `state().view`, not `state.view` |
|
|
97
|
+
| `useCalendar()` returns plain objects | `meta` and `state` are getters. Read them in JSX, a memo or an effect, and don't destructure them |
|
|
98
|
+
| A `Renderer` gets props you can destructure | A `Renderer`'s props are getters: `props.projection`, read where it's used |
|
|
99
|
+
| `meta.refs` holds React refs | `meta.refs` holds accessors: `meta().refs.viewport()` |
|
|
100
|
+
| `useCalendarKeyboard()` returns handlers | It returns a ref, which binds `keydown` and `focusout` on the element itself |
|
|
101
|
+
| A cell's `onKeyDown` runs before the view's | It runs after, since Solid delegates it. Listen natively from a ref to take a key first |
|
|
102
|
+
| `useRovingFocus` listens for `focusin` | It listens for `focus`, so a focus handler of yours hears `"focus"` |
|
|
103
|
+
| `Calendar.Event`'s children get a value | They get an accessor, and stay rendered while the event changes |
|
|
104
|
+
| A state change is visible on the next render | An accessor has the new value once Solid flushes: a microtask later, or after `flush()` |
|
|
105
|
+
| `@moltenship/calendar` is the one package | `@moltenship/calendar-solid` is the one package too: it re-exports the engine |
|
|
106
|
+
| The bridge is `@ui-sdk/react/agent` | The bridge is `@ui-sdk/solid/agent` |
|
|
107
|
+
|
|
108
|
+
The state model, controlled and uncontrolled props, change handlers, `onEventChange` and
|
|
109
|
+
`onEventChangeResult`, policies, pending changes and every agent action are the same.
|
|
110
|
+
|
|
111
|
+
## Other frameworks
|
|
112
|
+
|
|
113
|
+
Time has no integration for Vue, Svelte, Angular or any framework other than these two. You'd write
|
|
114
|
+
one on `@moltenship/calendar-primitives`, and its API can still change.
|
|
115
|
+
|
|
116
|
+
See [Primitives](./api/primitives.md).
|