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

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 (61) 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-BqzrxYgn.d.cts} +89 -106
  30. package/dist/{weeks-view-context-CFXV8orh.d.mts → index-CkhYFmf4.d.mts} +89 -106
  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-BSKwFvdP.mjs → weeks-navigation-BWB5OvqW.mjs} +95 -111
  36. package/dist/{weeks-navigation-CPevz3Xg.cjs → weeks-navigation-CatYJIKb.cjs} +97 -114
  37. package/package.json +17 -18
  38. package/src/calendar-provider.test.tsx +1 -1
  39. package/src/compute-weeks-in-window.test.ts +1 -1
  40. package/src/day-cell-state.test.ts +1 -1
  41. package/src/day-cell.test.tsx +1 -1
  42. package/src/formats/formats.test.ts +1 -1
  43. package/src/grid.event-perf.test.tsx +7 -1
  44. package/src/grid.perf.test.tsx +7 -1
  45. package/src/keyboard.test.ts +1 -1
  46. package/src/month-separator.test.tsx +1 -1
  47. package/src/month-view.bounds.test.tsx +1 -1
  48. package/src/month-view.test.tsx +89 -1
  49. package/src/month-view.tsx +14 -5
  50. package/src/month-window.test.ts +1 -1
  51. package/src/out-of-range.test.ts +1 -1
  52. package/src/range-preview.test.ts +1 -1
  53. package/src/resolve-first-week.test.ts +1 -1
  54. package/src/today.test.tsx +8 -1
  55. package/src/utils.bench.ts +158 -106
  56. package/src/utils.test.ts +1 -1
  57. package/src/view-context.test.tsx +1 -1
  58. package/src/weeks-keyboard.test.ts +1 -1
  59. package/src/weeks-view.bounds.test.tsx +1 -1
  60. package/src/weeks-view.test.tsx +1 -1
  61. package/src/weeks-window.test.ts +1 -1
@@ -2,7 +2,7 @@ import { Children, createContext, forwardRef, isValidElement, memo, useCallback,
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { mergeProps } from "@base-ui/react/merge-props";
4
4
  import { useRender } from "@base-ui/react/use-render";
5
- //#region src/calendar-context.ts
5
+ // src/calendar-context.ts
6
6
  /** @internal React context carrying stable CalendarProvider values (callbacks, config). */
7
7
  const CalendarStableContext = createContext(null);
8
8
  /** @internal React context carrying volatile CalendarProvider state. */
@@ -19,8 +19,7 @@ function useCalendarState() {
19
19
  if (!ctx) throw new Error("useCalendarState must be used within CalendarProvider");
20
20
  return ctx;
21
21
  }
22
- //#endregion
23
- //#region src/utils.ts
22
+ // src/utils.ts
24
23
  /**
25
24
  * Resolves a {@link TemporalNamespace} instance.
26
25
  *
@@ -466,8 +465,7 @@ function getISOWeekNumber(date, T) {
466
465
  const daysDiff = thursday.since(jan4Thursday, { largestUnit: "days" }).days;
467
466
  return Math.round(daysDiff / 7) + 1;
468
467
  }
469
- //#endregion
470
- //#region src/root-selection.ts
468
+ // src/root-selection.ts
471
469
  /** Construct a DateRange (workaround for TS generic conditional type widening). */
472
470
  function mkRange(start, end) {
473
471
  return {
@@ -832,8 +830,7 @@ function computePreviewRange(hoveredDate, currentRange, rangeMode, preventRangeR
832
830
  });
833
831
  return preview ? mkRange(preview[0], preview[1]) : null;
834
832
  }
835
- //#endregion
836
- //#region src/calendar-provider.tsx
833
+ // src/calendar-provider.tsx
837
834
  /**
838
835
  * Provides shared calendar state (selection, config, range preview) to all
839
836
  * descendant view components. Does NOT manage focus, navigation, or grid data.
@@ -951,7 +948,7 @@ function CalendarProvider(props) {
951
948
  isRange,
952
949
  isMultiple
953
950
  ]);
954
- const [internalDates, setInternalDates] = useState(useMemo(() => {
951
+ const defaultDates = useMemo(() => {
955
952
  if (isMultiple) {
956
953
  if (multipleDefault) return sortDates(multipleDefault.map(rawToPlain));
957
954
  return [];
@@ -966,7 +963,8 @@ function CalendarProvider(props) {
966
963
  singleDefault,
967
964
  rawToPlain,
968
965
  sortDates
969
- ]));
966
+ ]);
967
+ const [internalDates, setInternalDates] = useState(defaultDates);
970
968
  const isControlled = controlledDates !== void 0;
971
969
  const committedDates = isControlled ? controlledDates : internalDates;
972
970
  const rangeStart = !isMultiple && committedDates.length > 0 ? committedDates[0] ?? void 0 : void 0;
@@ -1277,8 +1275,7 @@ function CalendarProvider(props) {
1277
1275
  })
1278
1276
  });
1279
1277
  }
1280
- //#endregion
1281
- //#region src/month-view-context.ts
1278
+ // src/month-view-context.ts
1282
1279
  /** @internal React context for MonthView stable values (config + callbacks). */
1283
1280
  const MonthViewStableContext = createContext(null);
1284
1281
  /** @internal React context for MonthView volatile state. */
@@ -1295,8 +1292,7 @@ function useMonthViewState() {
1295
1292
  if (!ctx) throw new Error("useMonthViewState must be used within MonthView.Root");
1296
1293
  return ctx;
1297
1294
  }
1298
- //#endregion
1299
- //#region src/month-view-navigation.ts
1295
+ // src/month-view-navigation.ts
1300
1296
  /**
1301
1297
  * Owns which month the view shows, in both controlled and uncontrolled mode:
1302
1298
  * the month state, the Prev/Next steps, and syncing the window with focus.
@@ -1415,8 +1411,7 @@ function useMonthNavigation(input) {
1415
1411
  goPrevMonth: useCallback(() => go("prev"), [go])
1416
1412
  };
1417
1413
  }
1418
- //#endregion
1419
- //#region src/month-window.ts
1414
+ // src/month-window.ts
1420
1415
  const monthIndex = (m) => m.year * 12 + (m.month - 1);
1421
1416
  /**
1422
1417
  * Builds the policy for a MonthView window of `numberOfMonths` months.
@@ -1466,8 +1461,7 @@ function monthAt(start, offset) {
1466
1461
  month: index % 12 + 1
1467
1462
  };
1468
1463
  }
1469
- //#endregion
1470
- //#region src/view-context.ts
1464
+ // src/view-context.ts
1471
1465
  /** @internal React context for the active view (MonthView or WeeksView). */
1472
1466
  const ViewContext = createContext(null);
1473
1467
  /** Returns the nearest view context (MonthView or WeeksView). */
@@ -1492,8 +1486,7 @@ function useViewState() {
1492
1486
  if (!ctx) throw new Error("useViewState must be used within MonthView or WeeksView");
1493
1487
  return ctx;
1494
1488
  }
1495
- //#endregion
1496
- //#region src/month-view.tsx
1489
+ // src/month-view.tsx
1497
1490
  function MonthViewRoot(props) {
1498
1491
  const { numberOfMonths: numberOfMonthsProp, fixedWeeks: fixedWeeksProp, outsideDays: outsideDaysProp, outOfRangeBehavior: outOfRangeBehaviorProp, month: monthProp, defaultMonth: defaultMonthProp, onMonthChange, children } = props;
1499
1492
  const numberOfMonths = Math.max(1, Math.min(numberOfMonthsProp ?? 1, 12));
@@ -1504,7 +1497,6 @@ function MonthViewRoot(props) {
1504
1497
  const calState = useCalendarState();
1505
1498
  const T = calStable.temporal;
1506
1499
  const { timeZone, today, weekStartDay, isDateDisabled } = calStable;
1507
- const [focusedDate, setFocusedDate] = useState(() => resolveInitialAnchor(calState.selected, today, timeZone, T));
1508
1500
  const [gridHasFocus, setGridHasFocus] = useState(false);
1509
1501
  const gridFocusedRef = useRef(false);
1510
1502
  const { minValue, maxValue } = calStable;
@@ -1521,6 +1513,16 @@ function MonthViewRoot(props) {
1521
1513
  maxValue,
1522
1514
  T
1523
1515
  ]);
1516
+ const [focusedDate, setFocusedDate] = useState(() => {
1517
+ const anchor = resolveInitialAnchor(calState.selected, today, timeZone, T);
1518
+ const opening = monthProp ?? defaultMonthProp;
1519
+ if (!opening || windowPolicy.isVisible(opening, anchor)) return anchor;
1520
+ return T.PlainDate.from({
1521
+ year: opening.year,
1522
+ month: opening.month,
1523
+ day: 1
1524
+ });
1525
+ });
1524
1526
  const { currentMonth, viewingYearMonth, goNextMonth, goPrevMonth } = useMonthNavigation({
1525
1527
  month: monthProp,
1526
1528
  defaultMonth: defaultMonthProp,
@@ -1709,8 +1711,7 @@ function MonthView(props) {
1709
1711
  });
1710
1712
  }
1711
1713
  MonthView.Root = MonthViewRoot;
1712
- //#endregion
1713
- //#region src/context.ts
1714
+ // src/context.ts
1714
1715
  /** @internal Provides the days and index of the current week row to child components. */
1715
1716
  const WeekDataContext = createContext(null);
1716
1717
  /** @internal Provides the resolved grid orientation to descendant cells. */
@@ -1719,8 +1720,7 @@ const GridContext = createContext({ orientation: "horizontal" });
1719
1720
  const DayCellDataContext = createContext(null);
1720
1721
  /** @internal Provides per-grid month data to WeekTemplate and DayCellTemplate. */
1721
1722
  const GridMonthContext = createContext(null);
1722
- //#endregion
1723
- //#region src/grid-header.tsx
1723
+ // src/grid-header.tsx
1724
1724
  function useGridHeaderCellState(index) {
1725
1725
  const { locale, temporal: T, weekStartDay } = useCalendarStable();
1726
1726
  const { rootState } = useViewState();
@@ -1812,8 +1812,7 @@ function GridHeaderFn(props, ref) {
1812
1812
  }
1813
1813
  /** Table header section (`<thead>`) wrapping a row of {@link GridHeaderCell}s. */
1814
1814
  const GridHeader = forwardRef(GridHeaderFn);
1815
- //#endregion
1816
- //#region src/keyboard.ts
1815
+ // src/keyboard.ts
1817
1816
  /**
1818
1817
  * Computes the target date when jumping by `months` from `focusedDate`.
1819
1818
  *
@@ -1886,8 +1885,7 @@ function computeNextFocusDate(input) {
1886
1885
  if (nextDate) return clampToBounds(nextDate, focusedDate, minValue, maxValue, T);
1887
1886
  return { action: "none" };
1888
1887
  }
1889
- //#endregion
1890
- //#region src/month-separator.tsx
1888
+ // src/month-separator.tsx
1891
1889
  /** Context providing MonthSeparator data to child components. */
1892
1890
  const MonthSeparatorDataContext = createContext(null);
1893
1891
  function useMonthSeparatorData() {
@@ -2017,8 +2015,7 @@ function MonthSeparatorFn(props, ref) {
2017
2015
  * Default children: `<Month /> <Year />`.
2018
2016
  */
2019
2017
  const MonthSeparator = forwardRef(MonthSeparatorFn);
2020
- //#endregion
2021
- //#region src/weeks-view-context.ts
2018
+ // src/weeks-view-context.ts
2022
2019
  /** @internal React context for WeeksView stable values (config + callbacks). */
2023
2020
  const WeeksViewStableContext = createContext(null);
2024
2021
  /** @internal React context for WeeksView volatile state. */
@@ -2035,8 +2032,7 @@ function useWeeksViewState() {
2035
2032
  if (!ctx) throw new Error("useWeeksViewState must be used within WeeksView.Root");
2036
2033
  return ctx;
2037
2034
  }
2038
- //#endregion
2039
- //#region src/weeks-grid.tsx
2035
+ // src/weeks-grid.tsx
2040
2036
  /**
2041
2037
  * @internal WeeksGrid — renders continuous week rows for WeeksView.
2042
2038
  * Not exported from the public API.
@@ -2202,8 +2198,7 @@ function WeeksGrid(props) {
2202
2198
  children: rows
2203
2199
  });
2204
2200
  }
2205
- //#endregion
2206
- //#region src/weeks-keyboard.ts
2201
+ // src/weeks-keyboard.ts
2207
2202
  const NONE = {
2208
2203
  action: "none",
2209
2204
  windowShift: 0,
@@ -2277,8 +2272,7 @@ function computeWeeksKeyNav(input) {
2277
2272
  default: return NONE;
2278
2273
  }
2279
2274
  }
2280
- //#endregion
2281
- //#region src/day-cell-state.ts
2275
+ // src/day-cell-state.ts
2282
2276
  const NO_RANGE = {
2283
2277
  rangeStart: false,
2284
2278
  rangeEnd: false,
@@ -2450,8 +2444,7 @@ function useDayCellDeriver() {
2450
2444
  }, inputs);
2451
2445
  };
2452
2446
  }
2453
- //#endregion
2454
- //#region src/day-cell.tsx
2447
+ // src/day-cell.tsx
2455
2448
  const dayStateAttributesMapping = {
2456
2449
  root: () => null,
2457
2450
  date: (v) => v ? { "data-date": v.toString() } : null,
@@ -2483,22 +2476,23 @@ const dayStateAttributesMapping = {
2483
2476
  function DayCellInstanceFn(props) {
2484
2477
  const { render, date, columnIndex, children, _derivedState, ...otherProps } = props;
2485
2478
  const state = _derivedState;
2479
+ const defaultProps = state.hidden ? {
2480
+ role: "gridcell",
2481
+ "aria-hidden": true,
2482
+ children: null
2483
+ } : {
2484
+ role: "gridcell",
2485
+ "aria-selected": state.selected || void 0,
2486
+ "aria-disabled": state.disabled || void 0,
2487
+ children: children ?? /* @__PURE__ */ jsx(DayButton, { _derivedState })
2488
+ };
2486
2489
  const cell = useRender({
2487
2490
  defaultTagName: "td",
2488
2491
  render,
2489
2492
  ref: [],
2490
2493
  state,
2491
2494
  stateAttributesMapping: dayStateAttributesMapping,
2492
- props: mergeProps(state.hidden ? {
2493
- role: "gridcell",
2494
- "aria-hidden": true,
2495
- children: null
2496
- } : {
2497
- role: "gridcell",
2498
- "aria-selected": state.selected || void 0,
2499
- "aria-disabled": state.disabled || void 0,
2500
- children: children ?? /* @__PURE__ */ jsx(DayButton, { _derivedState })
2501
- }, otherProps)
2495
+ props: mergeProps(defaultProps, otherProps)
2502
2496
  });
2503
2497
  const outsideDisabled = state.hidden || state.outsideMonth && state.disabled;
2504
2498
  return /* @__PURE__ */ jsx(DayCellDataContext.Provider, {
@@ -2523,14 +2517,14 @@ function passThroughPropsEqual(prev, next, handledKeys) {
2523
2517
  for (const key of prevKeys) if (prev[key] !== next[key]) return false;
2524
2518
  return true;
2525
2519
  }
2526
- const DAY_CELL_HANDLED_KEYS = new Set([
2520
+ const DAY_CELL_HANDLED_KEYS = /* @__PURE__ */ new Set([
2527
2521
  "render",
2528
2522
  "date",
2529
2523
  "columnIndex",
2530
2524
  "children",
2531
2525
  "_derivedState"
2532
2526
  ]);
2533
- const DAY_BUTTON_HANDLED_KEYS = new Set([
2527
+ const DAY_BUTTON_HANDLED_KEYS = /* @__PURE__ */ new Set([
2534
2528
  "render",
2535
2529
  "date",
2536
2530
  "children",
@@ -2659,8 +2653,7 @@ function DayButtonFallbackFn(props, ref) {
2659
2653
  });
2660
2654
  }
2661
2655
  const DayButtonFallback = forwardRef(DayButtonFallbackFn);
2662
- //#endregion
2663
- //#region src/grid.tsx
2656
+ // src/grid.tsx
2664
2657
  function useGridKeyboard() {
2665
2658
  const { onSelect, disabled, readOnly, isDateDisabled, minValue, maxValue, temporal: T, weekStartDay } = useCalendarStable();
2666
2659
  const { focusedDate, setFocusedDate } = useViewContext();
@@ -2994,19 +2987,20 @@ function WeekInstance(props) {
2994
2987
  const { render, ...otherProps } = props;
2995
2988
  const weekData = useContext(WeekDataContext);
2996
2989
  const { rootState } = useViewState();
2990
+ const state = useMemo(() => ({
2991
+ root: rootState,
2992
+ weekIndex: weekData.weekIndex,
2993
+ gridRowIndex: weekData.gridRowIndex
2994
+ }), [
2995
+ rootState,
2996
+ weekData.weekIndex,
2997
+ weekData.gridRowIndex
2998
+ ]);
2997
2999
  return useRender({
2998
3000
  defaultTagName: "tr",
2999
3001
  render,
3000
3002
  ref: [],
3001
- state: useMemo(() => ({
3002
- root: rootState,
3003
- weekIndex: weekData.weekIndex,
3004
- gridRowIndex: weekData.gridRowIndex
3005
- }), [
3006
- rootState,
3007
- weekData.weekIndex,
3008
- weekData.gridRowIndex
3009
- ]),
3003
+ state,
3010
3004
  stateAttributesMapping: weekInstanceStateAttributesMapping,
3011
3005
  props: mergeProps({}, otherProps)
3012
3006
  });
@@ -3039,8 +3033,7 @@ function WeekTemplate(props) {
3039
3033
  }, firstDay.toString());
3040
3034
  }) });
3041
3035
  }
3042
- //#endregion
3043
- //#region src/navigation.tsx
3036
+ // src/navigation.tsx
3044
3037
  const dateStringStateAttributesMapping = {
3045
3038
  root: () => null,
3046
3039
  month: () => null,
@@ -3276,8 +3269,7 @@ function NextMonthButtonFn(props, ref) {
3276
3269
  * when the next month falls after `max`. Exposes `data-direction="next"`.
3277
3270
  */
3278
3271
  const NextMonthButton = forwardRef(NextMonthButtonFn);
3279
- //#endregion
3280
- //#region src/selected-range.tsx
3272
+ // src/selected-range.tsx
3281
3273
  const rangeOverlayStateAttributesMapping = {
3282
3274
  root: () => null,
3283
3275
  active: (v) => v ? { "data-active": "" } : null,
@@ -3397,8 +3389,7 @@ function RangeSelectedInnerFn(props, ref) {
3397
3389
  });
3398
3390
  }
3399
3391
  const RangeSelectedInner = forwardRef(RangeSelectedInnerFn);
3400
- //#endregion
3401
- //#region src/range-preview.tsx
3392
+ // src/range-preview.tsx
3402
3393
  function RangePreviewFn(props, ref) {
3403
3394
  const { selectionMode } = useCalendarStable();
3404
3395
  if (selectionMode !== "range") return null;
@@ -3471,8 +3462,7 @@ function RangePreviewInnerFn(props, ref) {
3471
3462
  });
3472
3463
  }
3473
3464
  const RangePreviewInner = forwardRef(RangePreviewInnerFn);
3474
- //#endregion
3475
- //#region src/drag-handle.tsx
3465
+ // src/drag-handle.tsx
3476
3466
  const dragHandleStateAttributesMapping = {
3477
3467
  root: () => null,
3478
3468
  active: (v) => v ? { "data-active": "" } : null,
@@ -3491,32 +3481,34 @@ function useDragHandle(edge, { dragging: draggingProp }) {
3491
3481
  const isActive = readOnly || disabled || outsideDisabled ? false : edge === "start" ? !!(date && rangeStart && T.PlainDate.compare(date, rangeStart) === 0) : !!(date && rangeEnd && T.PlainDate.compare(date, rangeEnd) === 0);
3492
3482
  const isDragging = !!draggingProp && isActive;
3493
3483
  const handleRef = useRef(null);
3484
+ const state = useMemo(() => ({
3485
+ root: rootState,
3486
+ active: isActive,
3487
+ dragging: isDragging,
3488
+ edge,
3489
+ orientation
3490
+ }), [
3491
+ rootState,
3492
+ isActive,
3493
+ isDragging,
3494
+ edge,
3495
+ orientation
3496
+ ]);
3497
+ const defaultProps = {
3498
+ role: "slider",
3499
+ "aria-roledescription": "drag handle",
3500
+ "aria-label": edge === "start" ? "Range start date" : "Range end date",
3501
+ "aria-valuetext": date?.toString(),
3502
+ "aria-grabbed": isActive ? isDragging : void 0,
3503
+ "aria-hidden": isActive ? void 0 : true,
3504
+ onPointerEnter: () => {
3505
+ if (date && !outsideDisabled) setHoveredDate(date);
3506
+ }
3507
+ };
3494
3508
  return {
3495
- state: useMemo(() => ({
3496
- root: rootState,
3497
- active: isActive,
3498
- dragging: isDragging,
3499
- edge,
3500
- orientation
3501
- }), [
3502
- rootState,
3503
- isActive,
3504
- isDragging,
3505
- edge,
3506
- orientation
3507
- ]),
3509
+ state,
3508
3510
  stateAttributesMapping: dragHandleStateAttributesMapping,
3509
- defaultProps: {
3510
- role: "slider",
3511
- "aria-roledescription": "drag handle",
3512
- "aria-label": edge === "start" ? "Range start date" : "Range end date",
3513
- "aria-valuetext": date?.toString(),
3514
- "aria-grabbed": isActive ? isDragging : void 0,
3515
- "aria-hidden": isActive ? void 0 : true,
3516
- onPointerEnter: () => {
3517
- if (date && !outsideDisabled) setHoveredDate(date);
3518
- }
3519
- },
3511
+ defaultProps,
3520
3512
  handleRef
3521
3513
  };
3522
3514
  }
@@ -3557,8 +3549,7 @@ function RangeEndDragHandleFn(props, ref) {
3557
3549
  }
3558
3550
  /** Convenience wrapper for {@link RangeDragHandle} with `edge="end"`. */
3559
3551
  const RangeEndDragHandle = forwardRef(RangeEndDragHandleFn);
3560
- //#endregion
3561
- //#region src/week-number.tsx
3552
+ // src/week-number.tsx
3562
3553
  const weekNumberCellStateAttributesMapping = {
3563
3554
  root: () => null,
3564
3555
  weekNumber: (v) => ({ "data-week-number": String(v) })
@@ -3623,8 +3614,7 @@ function WeekNumberHeaderFn(props, ref) {
3623
3614
  * Column header for the week number column. Renders a `<th scope="col">`.
3624
3615
  */
3625
3616
  const WeekNumberHeader = forwardRef(WeekNumberHeaderFn);
3626
- //#endregion
3627
- //#region src/compute-weeks-in-window.ts
3617
+ // src/compute-weeks-in-window.ts
3628
3618
  /**
3629
3619
  * Computes an array of week descriptors for a continuous window.
3630
3620
  * `firstWeek` is snapped back to the nearest `weekStartDay`.
@@ -3646,8 +3636,7 @@ function computeWeeksInWindow(firstWeek, weekCount, weekStartDay, _T) {
3646
3636
  }
3647
3637
  return weeks;
3648
3638
  }
3649
- //#endregion
3650
- //#region src/resolve-first-week.ts
3639
+ // src/resolve-first-week.ts
3651
3640
  /** Snaps `date` back to the start of its containing week (determined by `weekStartDay`). */
3652
3641
  function snapToWeekStart(date, weekStartDay) {
3653
3642
  const offset = (date.dayOfWeek % 7 - weekStartDay + 7) % 7;
@@ -3738,8 +3727,7 @@ function resolveFirstWeek(currentFirstWeek, weekCount, target, options) {
3738
3727
  }
3739
3728
  }
3740
3729
  }
3741
- //#endregion
3742
- //#region src/out-of-range.ts
3730
+ // src/out-of-range.ts
3743
3731
  /** Returns true if any day in the 7-day span starting at weekStart falls within [min, max]. */
3744
3732
  function weekHasValidDay(weekStart, min, max, T) {
3745
3733
  const weekEnd = weekStart.add({ days: 6 });
@@ -3808,8 +3796,7 @@ function applyOutOfRange({ targetFirstWeek, weekCount, behavior, min, max, weekS
3808
3796
  weekCount
3809
3797
  };
3810
3798
  }
3811
- //#endregion
3812
- //#region src/weeks-window.ts
3799
+ // src/weeks-window.ts
3813
3800
  function createWeekWindowPolicy({ weekCount, behavior, min, max, weekStartDay, T }) {
3814
3801
  const bounds = {
3815
3802
  weekCount,
@@ -3834,15 +3821,15 @@ function createWeekWindowPolicy({ weekCount, behavior, min, max, weekStartDay, T
3834
3821
  moveTo,
3835
3822
  shift: (current, direction, shiftBy) => {
3836
3823
  const by = shiftBy ?? current.weekCount;
3837
- const next = moveTo(current.firstWeek.add({ weeks: direction * by }));
3824
+ const target = current.firstWeek.add({ weeks: direction * by });
3825
+ const next = moveTo(target);
3838
3826
  if (next === null) return null;
3839
3827
  if ((behavior === "snap" || behavior === "snap-shrink") && isBounded && T.PlainDate.compare(next.firstWeek, current.firstWeek) === 0) return null;
3840
3828
  return next;
3841
3829
  }
3842
3830
  };
3843
3831
  }
3844
- //#endregion
3845
- //#region src/weeks-view-state.ts
3832
+ // src/weeks-view-state.ts
3846
3833
  /**
3847
3834
  * Core state management hook for WeeksView.Root.
3848
3835
  * Reads calendar-level context and manages weeks-specific state.
@@ -4176,8 +4163,7 @@ function useWeeksViewRootState(props) {
4176
4163
  scrollToWeek
4177
4164
  };
4178
4165
  }
4179
- //#endregion
4180
- //#region src/weeks-view.tsx
4166
+ // src/weeks-view.tsx
4181
4167
  function WeeksViewRootFn(props, ref) {
4182
4168
  const { children } = props;
4183
4169
  const { stableCtx, stateCtx, viewCtx, viewStableCtx, viewStateCtx, scrollToWeek } = useWeeksViewRootState(props);
@@ -4219,8 +4205,7 @@ function WeeksViewFn(props, ref) {
4219
4205
  }
4220
4206
  const WeeksView = forwardRef(WeeksViewFn);
4221
4207
  WeeksView.Root = WeeksViewRoot;
4222
- //#endregion
4223
- //#region src/weeks-navigation.tsx
4208
+ // src/weeks-navigation.tsx
4224
4209
  const weeksNavButtonStateAttributesMapping = {
4225
4210
  root: () => null,
4226
4211
  direction: (v) => ({ "data-direction": v }),
@@ -4329,5 +4314,4 @@ function WeekCountFn(props, ref) {
4329
4314
  * out-of-range modes where the actual count may be less than the `weekCount` prop.
4330
4315
  */
4331
4316
  const WeekCount = forwardRef(WeekCountFn);
4332
- //#endregion
4333
4317
  export { MonthSeparatorRow as A, useViewContext as B, DayButton as C, MonthSeparator as D, useWeeksViewState as E, DayCellDataContext as F, useCalendarStable as G, useMonthViewState as H, GridContext as I, useCalendarState as K, WeekDataContext as L, MonthSeparatorYear as M, GridHeader as N, MonthSeparatorCell as O, GridHeaderCell as P, MonthView as R, WeekTemplate as S, useWeeksViewStable as T, CalendarProvider as U, useMonthViewStable as V, computePreviewRange as W, NextMonthButton as _, WeeksViewRoot as a, Grid as b, computeWeeksInWindow as c, RangeEndDragHandle as d, RangeStartDragHandle as f, MonthYearString as g, DateString as h, WeeksView as i, MonthSeparatorWeekCount as j, MonthSeparatorMonth as k, WeekNumberCell as l, RangeSelected as m, PrevWeeksButton as n, resolveFirstWeek as o, RangePreview as p, WeekCount as r, resolveFirstWeekSpec as s, NextWeeksButton as t, WeekNumberHeader as u, PrevMonthButton as v, DayCellTemplate as w, GridBody as x, TimeString as y, MonthViewRoot as z };