@klinking/colander 3.1.0-alpha.7 → 3.1.0-alpha.9

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 (72) hide show
  1. package/dist/formats/date.cjs +2 -3
  2. package/dist/formats/date.d.cts +10 -14
  3. package/dist/formats/date.d.mts +10 -14
  4. package/dist/formats/date.mjs +2 -3
  5. package/dist/formats/object.cjs +2 -3
  6. package/dist/formats/object.d.cts +10 -14
  7. package/dist/formats/object.d.mts +10 -14
  8. package/dist/formats/object.mjs +2 -3
  9. package/dist/formats/plain-date-time.cjs +2 -3
  10. package/dist/formats/plain-date-time.d.cts +10 -14
  11. package/dist/formats/plain-date-time.d.mts +10 -14
  12. package/dist/formats/plain-date-time.mjs +2 -3
  13. package/dist/formats/plain-date.cjs +2 -3
  14. package/dist/formats/plain-date.d.cts +10 -14
  15. package/dist/formats/plain-date.d.mts +10 -14
  16. package/dist/formats/plain-date.mjs +2 -3
  17. package/dist/formats/plain-month-day.cjs +2 -3
  18. package/dist/formats/plain-month-day.d.cts +10 -14
  19. package/dist/formats/plain-month-day.d.mts +10 -14
  20. package/dist/formats/plain-month-day.mjs +2 -3
  21. package/dist/formats/plain-year-month.cjs +2 -3
  22. package/dist/formats/plain-year-month.d.cts +10 -14
  23. package/dist/formats/plain-year-month.d.mts +10 -14
  24. package/dist/formats/plain-year-month.mjs +2 -3
  25. package/dist/formats/zoned-date-time.cjs +2 -3
  26. package/dist/formats/zoned-date-time.d.cts +10 -14
  27. package/dist/formats/zoned-date-time.d.mts +10 -14
  28. package/dist/formats/zoned-date-time.mjs +2 -3
  29. package/dist/{weeks-view-context-BTojXkys.d.cts → index-B5VJ_WF2.d.mts} +91 -114
  30. package/dist/{weeks-view-context-CFXV8orh.d.mts → index-BMsxaq1s.d.cts} +91 -114
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +1 -10
  33. package/dist/index.d.mts +1 -10
  34. package/dist/index.mjs +1 -2
  35. package/dist/{weeks-navigation-CPevz3Xg.cjs → weeks-navigation-CUQApLMk.cjs} +531 -400
  36. package/dist/{weeks-navigation-BSKwFvdP.mjs → weeks-navigation-CWNpF_6M.mjs} +531 -399
  37. package/package.json +21 -18
  38. package/src/calendar-provider.test.tsx +1 -1
  39. package/src/calendar-provider.tsx +8 -2
  40. package/src/compute-weeks-in-window.test.ts +1 -1
  41. package/src/day-cell-state.test.ts +1 -1
  42. package/src/day-cell-state.ts +0 -70
  43. package/src/day-cell-store.test.tsx +273 -0
  44. package/src/day-cell-store.tsx +204 -0
  45. package/src/day-cell.test.tsx +73 -90
  46. package/src/day-cell.tsx +93 -78
  47. package/src/formats/formats.test.ts +1 -1
  48. package/src/grid.event-perf.test.tsx +7 -1
  49. package/src/grid.perf.test.tsx +7 -1
  50. package/src/grid.tsx +17 -15
  51. package/src/keyboard.test.ts +1 -1
  52. package/src/month-separator.test.tsx +1 -1
  53. package/src/month-view.bounds.test.tsx +1 -1
  54. package/src/month-view.test.tsx +89 -1
  55. package/src/month-view.tsx +17 -7
  56. package/src/month-window.test.ts +1 -1
  57. package/src/out-of-range.test.ts +1 -1
  58. package/src/range-preview.test.ts +1 -1
  59. package/src/resolve-first-week.test.ts +1 -1
  60. package/src/store.ts +72 -0
  61. package/src/today.test.tsx +8 -1
  62. package/src/utils.bench.ts +158 -106
  63. package/src/utils.test.ts +1 -1
  64. package/src/view-context.test.tsx +1 -1
  65. package/src/view-context.ts +2 -0
  66. package/src/weeks-grid.tsx +20 -10
  67. package/src/weeks-keyboard.test.ts +1 -1
  68. package/src/weeks-view-state.ts +1 -1
  69. package/src/weeks-view.bounds.test.tsx +1 -1
  70. package/src/weeks-view.test.tsx +1 -1
  71. package/src/weeks-view.tsx +2 -1
  72. package/src/weeks-window.test.ts +1 -1
@@ -241,6 +241,22 @@ export function WeeksGrid(props: {
241
241
  return map;
242
242
  }, [monthBoundaries]);
243
243
 
244
+ // Per-row context values, built once per set of weeks so a focus or
245
+ // selection change leaves the day cells' context untouched.
246
+ const rowValues = useMemo(
247
+ () =>
248
+ weeks.map((week, i) => {
249
+ const days = weekDaysArrays[i] ?? [];
250
+ return {
251
+ // gridRowIndex: 1-based row index in the CSS grid (header is row 1,
252
+ // weeks start at row 2).
253
+ weekData: { days, weekIndex: week.weekIndex, gridRowIndex: i + 2 },
254
+ gridMonth: { weeks: [days], year: week.year, month: week.month },
255
+ };
256
+ }),
257
+ [weeks, weekDaysArrays],
258
+ );
259
+
244
260
  const rows: React.ReactNode[] = [];
245
261
 
246
262
  for (const [i, week] of weeks.entries()) {
@@ -263,20 +279,14 @@ export function WeeksGrid(props: {
263
279
  }
264
280
 
265
281
  // Provide WeekDataContext so DayCellTemplate and children work.
266
- // gridRowIndex: 1-based row index in the CSS grid (header is row 1, weeks start at row 2).
267
- const weekGridRow = i + 2; // +1 for 1-based, +1 for header
282
+ const rowValue = rowValues[i];
283
+ if (rowValue === undefined) continue;
268
284
  rows.push(
269
285
  <WeekDataContext.Provider
270
286
  key={week.startDate.toString()}
271
- value={{ days, weekIndex: week.weekIndex, gridRowIndex: weekGridRow }}
287
+ value={rowValue.weekData}
272
288
  >
273
- <GridMonthContext.Provider
274
- value={{
275
- weeks: [days],
276
- year: week.year,
277
- month: week.month,
278
- }}
279
- >
289
+ <GridMonthContext.Provider value={rowValue.gridMonth}>
280
290
  {weekRowChildren}
281
291
  </GridMonthContext.Provider>
282
292
  </WeekDataContext.Provider>,
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
- import { describe, it, expect } from "vitest";
2
+ import { describe, it, expect } from "vite-plus/test";
3
3
  import { computeWeeksKeyNav, type WeeksKeyNavInput } from "./weeks-keyboard";
4
4
 
5
5
  const T = Temporal;
@@ -441,7 +441,7 @@ export function useWeeksViewRootState(props: WeeksViewRootProps) {
441
441
  );
442
442
 
443
443
  const viewStableCtx = useMemo<ViewStableContextValue>(
444
- () => ({ gridFocusedRef, outsideDays: "enabled" }),
444
+ () => ({ gridFocusedRef, outsideDays: "enabled", setFocusedDate }),
445
445
  [],
446
446
  );
447
447
 
@@ -7,7 +7,7 @@ import {
7
7
  fireEvent,
8
8
  } from "@testing-library/react";
9
9
  import { createRef } from "react";
10
- import { describe, it, expect, afterEach } from "vitest";
10
+ import { describe, it, expect, afterEach } from "vite-plus/test";
11
11
  import {
12
12
  Grid,
13
13
  GridBody,
@@ -7,7 +7,7 @@ import {
7
7
  fireEvent,
8
8
  within,
9
9
  } from "@testing-library/react";
10
- import { describe, it, expect, vi, afterEach } from "vitest";
10
+ import { describe, it, expect, vi, afterEach } from "vite-plus/test";
11
11
  import {
12
12
  Grid,
13
13
  GridBody,
@@ -1,6 +1,7 @@
1
1
  import React, { forwardRef, useImperativeHandle } from "react";
2
2
  import { CalendarProvider } from "./calendar-provider";
3
3
  import type { CalendarProviderProps } from "./calendar-types";
4
+ import { DayCellStoreProvider } from "./day-cell-store";
4
5
  import type { FirstWeekSpec, ScrollToWeekSnap } from "./resolve-first-week";
5
6
  import type { ValueFormat } from "./types";
6
7
  import {
@@ -49,7 +50,7 @@ function WeeksViewRootFn(
49
50
  <ViewStableContext.Provider value={viewStableCtx}>
50
51
  <ViewStateContext.Provider value={viewStateCtx}>
51
52
  <ViewContext.Provider value={viewCtx}>
52
- {children}
53
+ <DayCellStoreProvider>{children}</DayCellStoreProvider>
53
54
  </ViewContext.Provider>
54
55
  </ViewStateContext.Provider>
55
56
  </ViewStableContext.Provider>
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
- import { describe, it, expect } from "vitest";
2
+ import { describe, it, expect } from "vite-plus/test";
3
3
  import type { OutOfRangeBehavior } from "./out-of-range";
4
4
  import { createWeekWindowPolicy } from "./weeks-window";
5
5