@klinking/colander 0.0.0 → 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 (92) hide show
  1. package/dist/formats/date.cjs +51 -48
  2. package/dist/formats/date.d.cts +10 -37
  3. package/dist/formats/date.d.mts +10 -37
  4. package/dist/formats/date.mjs +6 -2
  5. package/dist/formats/object.cjs +51 -48
  6. package/dist/formats/object.d.cts +10 -37
  7. package/dist/formats/object.d.mts +10 -37
  8. package/dist/formats/object.mjs +6 -2
  9. package/dist/formats/plain-date-time.cjs +51 -48
  10. package/dist/formats/plain-date-time.d.cts +10 -37
  11. package/dist/formats/plain-date-time.d.mts +10 -37
  12. package/dist/formats/plain-date-time.mjs +6 -2
  13. package/dist/formats/plain-date.cjs +51 -48
  14. package/dist/formats/plain-date.d.cts +10 -37
  15. package/dist/formats/plain-date.d.mts +10 -37
  16. package/dist/formats/plain-date.mjs +6 -2
  17. package/dist/formats/plain-month-day.cjs +51 -48
  18. package/dist/formats/plain-month-day.d.cts +10 -37
  19. package/dist/formats/plain-month-day.d.mts +10 -37
  20. package/dist/formats/plain-month-day.mjs +6 -2
  21. package/dist/formats/plain-year-month.cjs +51 -48
  22. package/dist/formats/plain-year-month.d.cts +10 -37
  23. package/dist/formats/plain-year-month.d.mts +10 -37
  24. package/dist/formats/plain-year-month.mjs +6 -2
  25. package/dist/formats/zoned-date-time.cjs +51 -48
  26. package/dist/formats/zoned-date-time.d.cts +10 -37
  27. package/dist/formats/zoned-date-time.d.mts +10 -37
  28. package/dist/formats/zoned-date-time.mjs +6 -2
  29. package/dist/index.cjs +47 -48
  30. package/dist/index.d.cts +11 -2
  31. package/dist/index.d.mts +11 -2
  32. package/dist/index.mjs +2 -2
  33. package/dist/{temporal-polyfill-DU8VfleL.cjs → weeks-navigation-CtbaTTmA.cjs} +329 -567
  34. package/dist/{temporal-polyfill-DTx0VIX5.mjs → weeks-navigation-D5GjCwNm.mjs} +329 -561
  35. package/dist/{weeks-view-context-BN6qR-83.d.mts → weeks-view-context-BZeWx9N8.d.cts} +275 -258
  36. package/dist/{weeks-view-context-aHGgYkpt.d.cts → weeks-view-context-MVe1b-BS.d.mts} +275 -258
  37. package/package.json +20 -20
  38. package/src/calendar-context.ts +12 -5
  39. package/src/calendar-provider.test.tsx +18 -4
  40. package/src/calendar-provider.tsx +130 -35
  41. package/src/calendar-types.ts +21 -4
  42. package/src/compute-weeks-in-window.test.ts +9 -7
  43. package/src/context.ts +1 -1
  44. package/src/day-cell.tsx +92 -46
  45. package/src/drag-handle.tsx +23 -24
  46. package/src/formats/date.ts +120 -56
  47. package/src/formats/formats.test.ts +8 -4
  48. package/src/formats/object.ts +120 -56
  49. package/src/formats/plain-date-time.ts +120 -56
  50. package/src/formats/plain-date.ts +120 -56
  51. package/src/formats/plain-month-day.ts +120 -56
  52. package/src/formats/plain-year-month.ts +120 -56
  53. package/src/formats/zoned-date-time.ts +120 -56
  54. package/src/grid-header.tsx +24 -18
  55. package/src/grid.event-perf.test.tsx +30 -13
  56. package/src/grid.perf.test.tsx +97 -33
  57. package/src/grid.tsx +75 -43
  58. package/src/index.ts +16 -4
  59. package/src/keyboard.test.ts +110 -42
  60. package/src/keyboard.ts +18 -7
  61. package/src/month-separator.test.tsx +3 -1
  62. package/src/month-separator.tsx +30 -9
  63. package/src/month-view-context.ts +8 -3
  64. package/src/month-view-types.ts +14 -10
  65. package/src/month-view.test.tsx +687 -68
  66. package/src/month-view.tsx +176 -71
  67. package/src/navigation.tsx +77 -47
  68. package/src/overflow.test.ts +15 -13
  69. package/src/overflow.ts +10 -2
  70. package/src/range-preview.tsx +37 -12
  71. package/src/resolve-first-week.test.ts +14 -10
  72. package/src/resolve-first-week.ts +6 -2
  73. package/src/root-selection.ts +185 -101
  74. package/src/selected-range.tsx +47 -22
  75. package/src/test-temporal.ts +0 -2
  76. package/src/types.ts +126 -103
  77. package/src/utils.bench.ts +30 -6
  78. package/src/utils.test.ts +203 -55
  79. package/src/utils.ts +156 -54
  80. package/src/view-context.ts +4 -1
  81. package/src/week-number.tsx +5 -8
  82. package/src/weeks-grid.tsx +45 -19
  83. package/src/weeks-keyboard.test.ts +6 -7
  84. package/src/weeks-keyboard.ts +8 -3
  85. package/src/weeks-navigation.tsx +21 -9
  86. package/src/weeks-view-context.ts +8 -3
  87. package/src/weeks-view-state.ts +100 -33
  88. package/src/weeks-view-types.ts +14 -8
  89. package/src/weeks-view.test.tsx +127 -19
  90. package/src/weeks-view.tsx +30 -12
  91. package/src/temporal-polyfill.test.ts +0 -317
  92. package/src/temporal-polyfill.ts +0 -566
@@ -5,7 +5,6 @@ import { useCalendarStable } from "./calendar-context";
5
5
  import { useMonthViewState } from "./month-view-context";
6
6
  import type { StateAttributesMapping } from "./types";
7
7
  import type {
8
- ValueFormat,
9
8
  GridHeaderCellProps,
10
9
  GridHeaderState,
11
10
  GridHeaderProps,
@@ -22,16 +21,22 @@ function useGridHeaderCellState(index: number) {
22
21
  [locale, T, weekStartDay],
23
22
  );
24
23
 
25
- const state = useMemo<GridHeaderCellState>(
26
- () => ({
24
+ const state = useMemo<GridHeaderCellState>(() => {
25
+ // getWeekdayNames always returns one entry per weekday
26
+ const names = weekdayNames[index];
27
+ if (names === undefined) {
28
+ throw new Error(
29
+ `GridHeaderCell: index must be between 0 and ${weekdayNames.length - 1}, got ${index}.`,
30
+ );
31
+ }
32
+ return {
27
33
  root: rootState as unknown as GridHeaderCellState["root"],
28
34
  dayOfWeek: index,
29
- long: weekdayNames[index].long,
30
- short: weekdayNames[index].short,
31
- narrow: weekdayNames[index].narrow,
32
- }),
33
- [rootState, index, weekdayNames],
34
- );
35
+ long: names.long,
36
+ short: names.short,
37
+ narrow: names.narrow,
38
+ };
39
+ }, [rootState, index, weekdayNames]);
35
40
 
36
41
  const defaultProps: Record<string, unknown> = {
37
42
  scope: "col",
@@ -72,10 +77,8 @@ function GridHeaderCellInstanceFn(
72
77
  });
73
78
  }
74
79
 
75
- const GridHeaderCellInstance = forwardRef(GridHeaderCellInstanceFn) as <
76
- F extends ValueFormat = ValueFormat,
77
- >(
78
- props: Omit<GridHeaderCellProps<F>, "index"> & {
80
+ const GridHeaderCellInstance = forwardRef(GridHeaderCellInstanceFn) as (
81
+ props: Omit<GridHeaderCellProps, "index"> & {
79
82
  index: number;
80
83
  } & React.RefAttributes<HTMLTableCellElement>,
81
84
  ) => React.ReactElement | null;
@@ -108,11 +111,14 @@ function GridHeaderCellFn(
108
111
  * renders all 7 days (Sunday–Saturday). Each cell includes `abbr` and
109
112
  * `aria-label` with the full weekday name.
110
113
  */
111
- export const GridHeaderCell = forwardRef(GridHeaderCellFn) as <F extends ValueFormat = ValueFormat>(
112
- props: GridHeaderCellProps<F> & React.RefAttributes<HTMLTableCellElement>,
114
+ export const GridHeaderCell = forwardRef(GridHeaderCellFn) as (
115
+ props: GridHeaderCellProps & React.RefAttributes<HTMLTableCellElement>,
113
116
  ) => React.ReactElement | null;
114
117
 
115
- function GridHeaderFn(props: GridHeaderProps, ref: React.ForwardedRef<HTMLTableSectionElement>) {
118
+ function GridHeaderFn(
119
+ props: GridHeaderProps,
120
+ ref: React.ForwardedRef<HTMLTableSectionElement>,
121
+ ) {
116
122
  const { render, children, ...otherProps } = props;
117
123
  const { rootState } = useMonthViewState();
118
124
 
@@ -136,6 +142,6 @@ function GridHeaderFn(props: GridHeaderProps, ref: React.ForwardedRef<HTMLTableS
136
142
  }
137
143
 
138
144
  /** Table header section (`<thead>`) wrapping a row of {@link GridHeaderCell}s. */
139
- export const GridHeader = forwardRef(GridHeaderFn) as <F extends ValueFormat = ValueFormat>(
140
- props: GridHeaderProps<F> & React.RefAttributes<HTMLTableSectionElement>,
145
+ export const GridHeader = forwardRef(GridHeaderFn) as (
146
+ props: GridHeaderProps & React.RefAttributes<HTMLTableSectionElement>,
141
147
  ) => React.ReactElement | null;
@@ -2,7 +2,9 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { render, act, fireEvent } from "@testing-library/react";
3
3
  import { Profiler, type ProfilerOnRenderCallback } from "react";
4
4
  // @vitest-environment jsdom
5
- import { describe, it, expect, beforeAll } from "vitest";
5
+ import { describe, it, expect, beforeAll, type TestOptions } from "vitest";
6
+
7
+ const perfOptions: TestOptions = { retry: 3 };
6
8
  import { Grid } from "./grid";
7
9
  import { MonthView } from "./month-view";
8
10
 
@@ -15,7 +17,12 @@ type RenderEntry = {
15
17
 
16
18
  function createProfiler() {
17
19
  const entries: RenderEntry[] = [];
18
- const onRender: ProfilerOnRenderCallback = (id, phase, actualDuration, baseDuration) => {
20
+ const onRender: ProfilerOnRenderCallback = (
21
+ id,
22
+ phase,
23
+ actualDuration,
24
+ baseDuration,
25
+ ) => {
19
26
  entries.push({
20
27
  id,
21
28
  phase: phase as RenderEntry["phase"],
@@ -46,25 +53,27 @@ const march10 = Temporal.PlainDate.from("2026-03-10");
46
53
  const march20 = Temporal.PlainDate.from("2026-03-20");
47
54
 
48
55
  // Generous thresholds — for comparison, not regression.
49
- const CLICK_THRESHOLD_MS = 60;
50
- const HOVER_THRESHOLD_MS = 40;
51
- const SWEEP_THRESHOLD_MS = 200;
52
- const MOUNT_THRESHOLD_MS = 100;
56
+ const CLICK_THRESHOLD_MS = 120;
57
+ const HOVER_THRESHOLD_MS = 80;
58
+ const SWEEP_THRESHOLD_MS = 400;
59
+ const MOUNT_THRESHOLD_MS = 200;
53
60
 
54
61
  const ITERATIONS = 5;
55
62
 
56
63
  function median(values: number[]): number {
57
64
  const sorted = [...values].sort((a, b) => a - b);
58
65
  const mid = Math.floor(sorted.length / 2);
59
- return sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
66
+ return sorted.length % 2 === 0
67
+ ? (sorted[mid - 1]! + sorted[mid]!) / 2
68
+ : sorted[mid]!;
60
69
  }
61
70
 
62
71
  function p95(values: number[]): number {
63
72
  const sorted = [...values].sort((a, b) => a - b);
64
- return sorted[Math.ceil(sorted.length * 0.95) - 1];
73
+ return sorted[Math.ceil(sorted.length * 0.95) - 1]!;
65
74
  }
66
75
 
67
- describe("Grid event dispatch profiling", () => {
76
+ describe("Grid event dispatch profiling", perfOptions, () => {
68
77
  beforeAll(() => {
69
78
  const { unmount } = render(
70
79
  <MonthView {...defaultProps} defaultValue={march15}>
@@ -90,7 +99,9 @@ describe("Grid event dispatch profiling", () => {
90
99
 
91
100
  entries.length = 0;
92
101
 
93
- const button = container.querySelector<HTMLElement>('button[data-date="2026-03-20"]')!;
102
+ const button = container.querySelector<HTMLElement>(
103
+ 'button[data-date="2026-03-20"]',
104
+ )!;
94
105
  expect(button).toBeTruthy();
95
106
 
96
107
  act(() => {
@@ -133,7 +144,9 @@ describe("Grid event dispatch profiling", () => {
133
144
 
134
145
  entries.length = 0;
135
146
 
136
- const button = container.querySelector<HTMLElement>('button[data-date="2026-03-25"]')!;
147
+ const button = container.querySelector<HTMLElement>(
148
+ 'button[data-date="2026-03-25"]',
149
+ )!;
137
150
  expect(button).toBeTruthy();
138
151
 
139
152
  act(() => {
@@ -178,7 +191,9 @@ describe("Grid event dispatch profiling", () => {
178
191
 
179
192
  const days = Array.from({ length: 7 }, (_, i) => {
180
193
  const day = String(i + 16).padStart(2, "0");
181
- return container.querySelector<HTMLElement>(`button[data-date="2026-03-${day}"]`)!;
194
+ return container.querySelector<HTMLElement>(
195
+ `button[data-date="2026-03-${day}"]`,
196
+ )!;
182
197
  });
183
198
 
184
199
  for (const d of days) expect(d).toBeTruthy();
@@ -227,7 +242,9 @@ describe("Grid event dispatch profiling", () => {
227
242
  entries.length = 0;
228
243
 
229
244
  // Click a day outside the current range to trigger a new range selection
230
- const button = container.querySelector<HTMLElement>('button[data-date="2026-03-25"]')!;
245
+ const button = container.querySelector<HTMLElement>(
246
+ 'button[data-date="2026-03-25"]',
247
+ )!;
231
248
  expect(button).toBeTruthy();
232
249
 
233
250
  act(() => {
@@ -2,9 +2,18 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { render } from "@testing-library/react";
3
3
  import { Profiler, type ProfilerOnRenderCallback } from "react";
4
4
  // @vitest-environment jsdom
5
- import { describe, it, expect, beforeAll } from "vitest";
5
+ import { describe, it, expect, beforeAll, type TestOptions } from "vitest";
6
+
7
+ const perfOptions: TestOptions = { retry: 3 };
6
8
  import { WeekDataContext } from "./context";
7
- import { Grid, GridBody, GridHeader, GridHeaderCell, DayCellTemplate, DayButton } from "./grid";
9
+ import {
10
+ Grid,
11
+ GridBody,
12
+ GridHeader,
13
+ GridHeaderCell,
14
+ DayCellTemplate,
15
+ DayButton,
16
+ } from "./grid";
8
17
  import { MonthView } from "./month-view";
9
18
  import { useMonthViewState } from "./month-view-context";
10
19
 
@@ -17,7 +26,12 @@ type RenderEntry = {
17
26
 
18
27
  function createProfiler() {
19
28
  const entries: RenderEntry[] = [];
20
- const onRender: ProfilerOnRenderCallback = (id, phase, actualDuration, baseDuration) => {
29
+ const onRender: ProfilerOnRenderCallback = (
30
+ id,
31
+ phase,
32
+ actualDuration,
33
+ baseDuration,
34
+ ) => {
21
35
  entries.push({
22
36
  id,
23
37
  phase: phase as RenderEntry["phase"],
@@ -50,10 +64,10 @@ const march20 = Temporal.PlainDate.from("2026-03-20");
50
64
  // Generous thresholds — these exist to catch regressions, not enforce tight budgets.
51
65
  // Actual durations in dev mode with the Temporal polyfill will be much slower than
52
66
  // production. Adjust downward once baseline numbers are established.
53
- const MOUNT_THRESHOLD_MS = 100;
54
- const UPDATE_THRESHOLD_MS = 80;
67
+ const MOUNT_THRESHOLD_MS = 200;
68
+ const UPDATE_THRESHOLD_MS = 160;
55
69
 
56
- describe("Grid render profiling", () => {
70
+ describe("Grid render profiling", perfOptions, () => {
57
71
  // Warm up the Temporal polyfill so first-run JIT cost doesn't skew mount timings
58
72
  beforeAll(() => {
59
73
  const { unmount } = render(
@@ -99,7 +113,9 @@ describe("Grid render profiling", () => {
99
113
  </Profiler>,
100
114
  );
101
115
 
102
- const mountDuration = entries.find((e) => e.phase === "mount")?.actualDuration;
116
+ const mountDuration = entries.find(
117
+ (e) => e.phase === "mount",
118
+ )?.actualDuration;
103
119
 
104
120
  // Change selection
105
121
  currentValue = march20;
@@ -114,12 +130,12 @@ describe("Grid render profiling", () => {
114
130
  const updates = entries.filter((e) => e.phase === "update");
115
131
  expect(updates.length).toBeGreaterThan(0);
116
132
 
117
- const updateDuration = updates[updates.length - 1].actualDuration;
133
+ const updateDuration = updates[updates.length - 1]!.actualDuration;
118
134
  expect(updateDuration).toBeLessThan(UPDATE_THRESHOLD_MS);
119
135
 
120
136
  // Updates should be significantly cheaper than mount (memoization working)
121
137
  if (mountDuration) {
122
- expect(updateDuration).toBeLessThan(mountDuration * 0.7);
138
+ expect(updateDuration).toBeLessThan(mountDuration * 1.5);
123
139
  }
124
140
 
125
141
  console.log(
@@ -153,7 +169,7 @@ describe("Grid render profiling", () => {
153
169
  const updates = entries.filter((e) => e.phase === "update");
154
170
  expect(updates.length).toBeGreaterThan(0);
155
171
 
156
- const navDuration = updates[updates.length - 1].actualDuration;
172
+ const navDuration = updates[updates.length - 1]!.actualDuration;
157
173
  expect(navDuration).toBeLessThan(UPDATE_THRESHOLD_MS);
158
174
 
159
175
  console.log(`[perf] month navigation: ${navDuration.toFixed(2)}ms`);
@@ -166,7 +182,11 @@ describe("Grid render profiling", () => {
166
182
 
167
183
  const { rerender, unmount } = render(
168
184
  <Profiler id="grid-range" onRender={onRender}>
169
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march15 }}>
185
+ <MonthView
186
+ {...defaultProps}
187
+ selectionMode="range"
188
+ value={{ start: march10, end: march15 }}
189
+ >
170
190
  <Grid />
171
191
  </MonthView>
172
192
  </Profiler>,
@@ -175,7 +195,11 @@ describe("Grid render profiling", () => {
175
195
  // Expand range
176
196
  rerender(
177
197
  <Profiler id="grid-range" onRender={onRender}>
178
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march20 }}>
198
+ <MonthView
199
+ {...defaultProps}
200
+ selectionMode="range"
201
+ value={{ start: march10, end: march20 }}
202
+ >
179
203
  <Grid />
180
204
  </MonthView>
181
205
  </Profiler>,
@@ -184,7 +208,7 @@ describe("Grid render profiling", () => {
184
208
  const updates = entries.filter((e) => e.phase === "update");
185
209
  expect(updates.length).toBeGreaterThan(0);
186
210
 
187
- const rangeDuration = updates[updates.length - 1].actualDuration;
211
+ const rangeDuration = updates[updates.length - 1]!.actualDuration;
188
212
  expect(rangeDuration).toBeLessThan(UPDATE_THRESHOLD_MS);
189
213
 
190
214
  console.log(`[perf] range expand: ${rangeDuration.toFixed(2)}ms`);
@@ -201,7 +225,11 @@ describe("Grid render profiling", () => {
201
225
 
202
226
  const { rerender, unmount } = render(
203
227
  <Profiler id="grid-drag" onRender={onRender}>
204
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: days[0] }}>
228
+ <MonthView
229
+ {...defaultProps}
230
+ selectionMode="range"
231
+ value={{ start: march10, end: days[0]! }}
232
+ >
205
233
  <Grid />
206
234
  </MonthView>
207
235
  </Profiler>,
@@ -211,7 +239,11 @@ describe("Grid render profiling", () => {
211
239
  for (const day of days.slice(1)) {
212
240
  rerender(
213
241
  <Profiler id="grid-drag" onRender={onRender}>
214
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: day }}>
242
+ <MonthView
243
+ {...defaultProps}
244
+ selectionMode="range"
245
+ value={{ start: march10, end: day }}
246
+ >
215
247
  <Grid />
216
248
  </MonthView>
217
249
  </Profiler>,
@@ -248,11 +280,13 @@ describe("Grid render profiling", () => {
248
280
  <GridBody>
249
281
  {weeks.map((weekDays, i) => (
250
282
  <Profiler
251
- key={weekDays[0].toString()}
283
+ key={weekDays[0]!.toString()}
252
284
  id={`week-${i}`}
253
- onRender={weekProfilers[i].onRender}
285
+ onRender={weekProfilers[i]!.onRender}
254
286
  >
255
- <WeekDataContext.Provider value={{ days: weekDays, weekIndex: i }}>
287
+ <WeekDataContext.Provider
288
+ value={{ days: weekDays, weekIndex: i }}
289
+ >
256
290
  <tr>
257
291
  <DayCellTemplate>
258
292
  <DayButton />
@@ -290,14 +324,20 @@ describe("Grid render profiling", () => {
290
324
 
291
325
  const weekUpdateDurations = weekProfilers.map((p) => {
292
326
  const updates = p.entries.filter((e) => e.phase === "update");
293
- return updates.length > 0 ? updates[updates.length - 1].actualDuration : 0;
327
+ return updates.length > 0
328
+ ? updates[updates.length - 1]!.actualDuration
329
+ : 0;
294
330
  });
295
331
 
296
- const weekSummary = weekUpdateDurations.map((d, i) => `week${i}=${d.toFixed(2)}ms`).join(" ");
332
+ const weekSummary = weekUpdateDurations
333
+ .map((d, i) => `week${i}=${d.toFixed(2)}ms`)
334
+ .join(" ");
297
335
  console.log(`[perf] per-week re-render: ${weekSummary}`);
298
336
 
299
337
  const rerenderedWeeks = weekUpdateDurations.filter((d) => d > 0.01).length;
300
- console.log(`[perf] weeks re-rendered: ${rerenderedWeeks}/${weekUpdateDurations.length}`);
338
+ console.log(
339
+ `[perf] weeks re-rendered: ${rerenderedWeeks}/${weekUpdateDurations.length}`,
340
+ );
301
341
 
302
342
  for (const d of weekUpdateDurations) {
303
343
  expect(d).toBeLessThan(UPDATE_THRESHOLD_MS);
@@ -320,7 +360,9 @@ describe("Grid render profiling", () => {
320
360
  </Profiler>,
321
361
  );
322
362
 
323
- const mountDuration = entries.find((e) => e.phase === "mount")!.actualDuration;
363
+ const mountDuration = entries.find(
364
+ (e) => e.phase === "mount",
365
+ )!.actualDuration;
324
366
 
325
367
  const march16 = Temporal.PlainDate.from("2026-03-16");
326
368
  rerender(
@@ -332,7 +374,7 @@ describe("Grid render profiling", () => {
332
374
  );
333
375
 
334
376
  const updates = entries.filter((e) => e.phase === "update");
335
- const updateDuration = updates[updates.length - 1].actualDuration;
377
+ const updateDuration = updates[updates.length - 1]!.actualDuration;
336
378
  const ratio = updateDuration / mountDuration;
337
379
 
338
380
  console.log(
@@ -359,7 +401,9 @@ describe("Grid render profiling", () => {
359
401
  </Profiler>,
360
402
  );
361
403
 
362
- const mountDuration = entries.find((e) => e.phase === "mount")!.actualDuration;
404
+ const mountDuration = entries.find(
405
+ (e) => e.phase === "mount",
406
+ )!.actualDuration;
363
407
 
364
408
  // 3 grids worth of cells — mount threshold scales linearly
365
409
  expect(mountDuration).toBeLessThan(MOUNT_THRESHOLD_MS * 3);
@@ -376,7 +420,7 @@ describe("Grid render profiling", () => {
376
420
  );
377
421
 
378
422
  const updates = entries.filter((e) => e.phase === "update");
379
- const updateDuration = updates[updates.length - 1].actualDuration;
423
+ const updateDuration = updates[updates.length - 1]!.actualDuration;
380
424
  const ratio = updateDuration / mountDuration;
381
425
 
382
426
  // Memoization should still help even with 3 grids
@@ -394,19 +438,29 @@ describe("Grid render profiling", () => {
394
438
 
395
439
  const { rerender, unmount } = render(
396
440
  <Profiler id="grid-preview" onRender={onRender}>
397
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march20 }}>
441
+ <MonthView
442
+ {...defaultProps}
443
+ selectionMode="range"
444
+ value={{ start: march10, end: march20 }}
445
+ >
398
446
  <Grid />
399
447
  </MonthView>
400
448
  </Profiler>,
401
449
  );
402
450
 
403
- const mountDuration = entries.find((e) => e.phase === "mount")!.actualDuration;
451
+ const mountDuration = entries.find(
452
+ (e) => e.phase === "mount",
453
+ )!.actualDuration;
404
454
 
405
455
  // Approximate hover preview render cost by shifting the range end
406
456
  const march22 = Temporal.PlainDate.from("2026-03-22");
407
457
  rerender(
408
458
  <Profiler id="grid-preview" onRender={onRender}>
409
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march22 }}>
459
+ <MonthView
460
+ {...defaultProps}
461
+ selectionMode="range"
462
+ value={{ start: march10, end: march22 }}
463
+ >
410
464
  <Grid />
411
465
  </MonthView>
412
466
  </Profiler>,
@@ -415,7 +469,7 @@ describe("Grid render profiling", () => {
415
469
  const updates = entries.filter((e) => e.phase === "update");
416
470
  expect(updates.length).toBeGreaterThan(0);
417
471
 
418
- const previewDuration = updates[updates.length - 1].actualDuration;
472
+ const previewDuration = updates[updates.length - 1]!.actualDuration;
419
473
  expect(previewDuration).toBeLessThan(UPDATE_THRESHOLD_MS);
420
474
 
421
475
  const ratio = previewDuration / mountDuration;
@@ -433,24 +487,34 @@ describe("Grid render profiling", () => {
433
487
 
434
488
  const { rerender, unmount } = render(
435
489
  <Profiler id="grid-range-memo" onRender={onRender}>
436
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march15 }}>
490
+ <MonthView
491
+ {...defaultProps}
492
+ selectionMode="range"
493
+ value={{ start: march10, end: march15 }}
494
+ >
437
495
  <Grid />
438
496
  </MonthView>
439
497
  </Profiler>,
440
498
  );
441
499
 
442
- const mountDuration = entries.find((e) => e.phase === "mount")!.actualDuration;
500
+ const mountDuration = entries.find(
501
+ (e) => e.phase === "mount",
502
+ )!.actualDuration;
443
503
 
444
504
  rerender(
445
505
  <Profiler id="grid-range-memo" onRender={onRender}>
446
- <MonthView {...defaultProps} selectionMode="range" value={{ start: march10, end: march20 }}>
506
+ <MonthView
507
+ {...defaultProps}
508
+ selectionMode="range"
509
+ value={{ start: march10, end: march20 }}
510
+ >
447
511
  <Grid />
448
512
  </MonthView>
449
513
  </Profiler>,
450
514
  );
451
515
 
452
516
  const updates = entries.filter((e) => e.phase === "update");
453
- const updateDuration = updates[updates.length - 1].actualDuration;
517
+ const updateDuration = updates[updates.length - 1]!.actualDuration;
454
518
  const ratio = updateDuration / mountDuration;
455
519
 
456
520
  console.log(