@urbicon-ui/blocks 6.19.0 → 6.19.1

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 (59) hide show
  1. package/README.md +5 -5
  2. package/dist/components/AreaChart/AreaChart.svelte +7 -3
  3. package/dist/components/BarChart/BarChart.svelte +7 -3
  4. package/dist/components/Calendar/Calendar.svelte +46 -29
  5. package/dist/components/Calendar/CalendarAgendaView.svelte +1 -1
  6. package/dist/components/Calendar/CalendarDayView.svelte +19 -39
  7. package/dist/components/Calendar/CalendarDayView.svelte.d.ts +1 -3
  8. package/dist/components/Calendar/CalendarEventItem.svelte +0 -1
  9. package/dist/components/Calendar/CalendarGrid.svelte +12 -8
  10. package/dist/components/Calendar/CalendarHeader.svelte +2 -2
  11. package/dist/components/Calendar/CalendarMiniMonth.svelte +0 -2
  12. package/dist/components/Calendar/CalendarTimeEvent.svelte +1 -1
  13. package/dist/components/Calendar/CalendarTimeGrid.svelte +0 -3
  14. package/dist/components/Calendar/CalendarWeekGrid.svelte +1 -1
  15. package/dist/components/Calendar/calendar.context.d.ts +1 -0
  16. package/dist/components/Calendar/calendar.types.d.ts +2 -0
  17. package/dist/components/Calendar/calendar.variants.d.ts +0 -12
  18. package/dist/components/Calendar/calendar.variants.js +0 -4
  19. package/dist/components/Calendar/index.d.ts +6 -2
  20. package/dist/components/CompositionBar/CompositionBar.svelte +1 -1
  21. package/dist/components/CompositionBar/composition-bar.variants.d.ts +15 -16
  22. package/dist/components/CompositionBar/composition-bar.variants.js +4 -2
  23. package/dist/components/CompositionBar/index.d.ts +1 -1
  24. package/dist/components/DatePicker/DatePicker.svelte +5 -3
  25. package/dist/components/DatePicker/DateRangePicker.svelte +3 -3
  26. package/dist/components/DatePicker/datepicker.engine.d.ts +6 -6
  27. package/dist/components/DatePicker/datepicker.engine.js +13 -13
  28. package/dist/components/DonutChart/DonutChart.svelte +5 -3
  29. package/dist/components/LineChart/LineChart.svelte +7 -3
  30. package/dist/components/Planner/Planner.svelte +7 -3
  31. package/dist/components/Planner/PlannerHeader.svelte +1 -1
  32. package/dist/components/Planner/planner.types.d.ts +3 -0
  33. package/dist/date/compare.d.ts +8 -0
  34. package/dist/date/compare.js +15 -0
  35. package/dist/date/index.d.ts +1 -1
  36. package/dist/date/index.js +1 -1
  37. package/dist/i18n/index.d.ts +24 -378
  38. package/dist/internal/date-grid/date-grid.svelte.d.ts +18 -3
  39. package/dist/internal/date-grid/date-grid.svelte.js +60 -19
  40. package/dist/internal/date-grid/index.d.ts +2 -2
  41. package/dist/internal/date-grid/index.js +2 -2
  42. package/dist/mint/README.md +12 -9
  43. package/dist/mint/registry.js +12 -0
  44. package/dist/primitives/Badge/badge.variants.d.ts +0 -1
  45. package/dist/primitives/Badge/badge.variants.js +1 -2
  46. package/dist/primitives/Breadcrumb/Breadcrumb.svelte +1 -2
  47. package/dist/primitives/ButtonGroup/ButtonGroup.svelte +1 -1
  48. package/dist/primitives/Combobox/Combobox.svelte +1 -0
  49. package/dist/primitives/Menu/Menu.svelte +2 -2
  50. package/dist/primitives/Pagination/Pagination.svelte +10 -2
  51. package/dist/primitives/Pagination/PaginationItem.svelte +0 -2
  52. package/dist/primitives/Stepper/StepperStep.svelte +3 -1
  53. package/dist/translations/de.d.ts +11 -7
  54. package/dist/translations/de.js +12 -8
  55. package/dist/translations/en.d.ts +11 -7
  56. package/dist/translations/en.js +12 -8
  57. package/dist/utils/date.d.ts +5 -0
  58. package/dist/utils/date.js +34 -24
  59. package/package.json +3 -3
@@ -52,6 +52,8 @@ declare const blocksTranslations: {
52
52
  readonly last: "Last";
53
53
  readonly page: "Page";
54
54
  readonly previous: "Previous";
55
+ readonly pageInfo: "{{label}} {{current}} of {{total}}";
56
+ readonly rangeInfo: "{{start}}–{{end}} of {{total}}";
55
57
  };
56
58
  readonly calendar: {
57
59
  readonly recurring: "Recurring event";
@@ -73,8 +75,6 @@ declare const blocksTranslations: {
73
75
  readonly legend: "Legend";
74
76
  readonly yearView: "Year overview";
75
77
  readonly weekView: "Week view";
76
- readonly dayView: "Day view";
77
- readonly monthView: "Month view";
78
78
  readonly viewMonth: "Month";
79
79
  readonly viewYear: "Year";
80
80
  readonly viewWeek: "Week";
@@ -93,7 +93,6 @@ declare const blocksTranslations: {
93
93
  readonly nextRange: "Next range";
94
94
  readonly today: "Today";
95
95
  readonly grid: "Planner";
96
- readonly weekNumber: "Week number";
97
96
  readonly itemCount: "{{count}} items";
98
97
  };
99
98
  readonly commandPalette: {
@@ -145,7 +144,6 @@ declare const blocksTranslations: {
145
144
  readonly datepicker: {
146
145
  readonly placeholder: "Select a date...";
147
146
  readonly rangePlaceholder: "Select a date range...";
148
- readonly clear: "Clear selection";
149
147
  readonly openCalendar: "Open calendar";
150
148
  readonly invalidDate: "Invalid date";
151
149
  readonly outOfRange: "Date is outside the allowed range";
@@ -177,9 +175,15 @@ declare const blocksTranslations: {
177
175
  readonly darkMode: "Dark mode";
178
176
  readonly systemTheme: "System theme";
179
177
  };
180
- readonly time: {
181
- readonly ago: "{{value}} {{unit}} ago";
182
- readonly now: "now";
178
+ readonly chart: {
179
+ readonly category: "Category";
180
+ readonly series: "Series {{index}}";
181
+ readonly segment: "Segment";
182
+ readonly value: "Value";
183
+ readonly share: "Share";
184
+ };
185
+ readonly stepper: {
186
+ readonly optional: "Optional";
183
187
  };
184
188
  };
185
189
  de: {
@@ -234,6 +238,8 @@ declare const blocksTranslations: {
234
238
  readonly last: "Letzte";
235
239
  readonly page: "Seite";
236
240
  readonly previous: "Vorherige";
241
+ readonly pageInfo: "{{label}} {{current}} von {{total}}";
242
+ readonly rangeInfo: "{{start}}–{{end}} von {{total}}";
237
243
  };
238
244
  readonly calendar: {
239
245
  readonly recurring: "Wiederkehrender Termin";
@@ -255,8 +261,6 @@ declare const blocksTranslations: {
255
261
  readonly legend: "Legende";
256
262
  readonly yearView: "Jahresübersicht";
257
263
  readonly weekView: "Wochenansicht";
258
- readonly dayView: "Tagesansicht";
259
- readonly monthView: "Monatsansicht";
260
264
  readonly viewMonth: "Monat";
261
265
  readonly viewYear: "Jahr";
262
266
  readonly viewWeek: "Woche";
@@ -275,7 +279,6 @@ declare const blocksTranslations: {
275
279
  readonly nextRange: "Nächster Zeitraum";
276
280
  readonly today: "Heute";
277
281
  readonly grid: "Planer";
278
- readonly weekNumber: "Kalenderwoche";
279
282
  readonly itemCount: "{{count}} Einträge";
280
283
  };
281
284
  readonly commandPalette: {
@@ -327,7 +330,6 @@ declare const blocksTranslations: {
327
330
  readonly datepicker: {
328
331
  readonly placeholder: "Datum wählen...";
329
332
  readonly rangePlaceholder: "Zeitraum wählen...";
330
- readonly clear: "Auswahl löschen";
331
333
  readonly openCalendar: "Kalender öffnen";
332
334
  readonly invalidDate: "Ungültiges Datum";
333
335
  readonly outOfRange: "Datum liegt außerhalb des zulässigen Bereichs";
@@ -359,194 +361,19 @@ declare const blocksTranslations: {
359
361
  readonly darkMode: "Dunkler Modus";
360
362
  readonly systemTheme: "Systemdesign";
361
363
  };
362
- readonly time: {
363
- readonly ago: "vor {{value}} {{unit}}";
364
- readonly now: "jetzt";
365
- };
366
- };
367
- };
368
- export declare const blocksI18n: import("@urbicon-ui/i18n").PackageI18n<{
369
- readonly accessibility: {
370
- readonly avatar: "Avatar";
371
- readonly clearInput: "Clear input";
372
- readonly clearSearch: "Clear search";
373
- readonly clearSelection: "Clear selection";
374
- readonly closeDialog: "Close dialog";
375
- readonly closeDrawer: "Close drawer";
376
- readonly dismiss: "Dismiss";
377
- readonly fileUpload: "File upload";
378
- readonly loading: "Loading";
379
- readonly maximum: "Maximum";
380
- readonly minimum: "Minimum";
381
- readonly pagination: "Page navigation";
382
- readonly progress: "Progress";
383
- readonly slider: "Slider";
384
- readonly toggle: "Toggle";
385
- readonly toggleOptions: "Toggle options";
386
- readonly removableBadge: "Removable badge";
387
- readonly removeBadge: "Remove badge";
388
- readonly removeFile: "Remove {{name}}";
389
- };
390
- readonly button: {
391
- readonly close: "Close";
392
- readonly apply: "Apply";
393
- readonly cancel: "Cancel";
394
- readonly confirm: "Confirm";
395
- };
396
- readonly menu: {
397
- readonly placeholder: "Select an option...";
398
- };
399
- readonly common: {
400
- readonly loading: "Loading...";
401
- };
402
- readonly languages: {
403
- readonly de: "Deutsch";
404
- readonly en: "English";
405
- readonly es: "Español";
406
- readonly fr: "Français";
407
- readonly it: "Italiano";
408
- readonly nl: "Nederlands";
409
- };
410
- readonly localeSwitcher: {
411
- readonly ariaLabel: "Language selection";
412
- readonly placeholder: "Select language...";
413
- };
414
- readonly pagination: {
415
- readonly next: "Next";
416
- readonly first: "First";
417
- readonly last: "Last";
418
- readonly page: "Page";
419
- readonly previous: "Previous";
420
- };
421
- readonly calendar: {
422
- readonly recurring: "Recurring event";
423
- readonly previousMonth: "Previous month";
424
- readonly nextMonth: "Next month";
425
- readonly previousWeek: "Previous week";
426
- readonly nextWeek: "Next week";
427
- readonly previousDay: "Previous day";
428
- readonly nextDay: "Next day";
429
- readonly previousYear: "Previous year";
430
- readonly nextYear: "Next year";
431
- readonly today: "Today";
432
- readonly calendarGrid: "Calendar";
433
- readonly weekdays: "Weekdays";
434
- readonly weekNumber: "Week number";
435
- readonly events: "Events";
436
- readonly noEvents: "No events";
437
- readonly showMore: "{{count}} more";
438
- readonly legend: "Legend";
439
- readonly yearView: "Year overview";
440
- readonly weekView: "Week view";
441
- readonly dayView: "Day view";
442
- readonly monthView: "Month view";
443
- readonly viewMonth: "Month";
444
- readonly viewYear: "Year";
445
- readonly viewWeek: "Week";
446
- readonly viewDay: "Day";
447
- readonly multiDayLabel: "Day {{current}} of {{total}}";
448
- readonly agendaView: "Agenda view";
449
- readonly viewAgenda: "Agenda";
450
- readonly viewSwitcher: "View mode";
451
- };
452
- readonly planner: {
453
- readonly previousWeek: "Previous week";
454
- readonly nextWeek: "Next week";
455
- readonly previousMonth: "Previous month";
456
- readonly nextMonth: "Next month";
457
- readonly previousRange: "Previous range";
458
- readonly nextRange: "Next range";
459
- readonly today: "Today";
460
- readonly grid: "Planner";
461
- readonly weekNumber: "Week number";
462
- readonly itemCount: "{{count}} items";
463
- };
464
- readonly commandPalette: {
465
- readonly noResults: "No results found.";
466
- readonly search: "Search...";
467
- readonly hints: {
468
- readonly navigate: "Navigate";
469
- readonly select: "Select";
470
- readonly close: "Close";
471
- };
472
- };
473
- readonly compositionBar: {
474
- readonly total: "Total";
475
- readonly summary: "Composition: {{total}} ({{count}} shares) — {{parts}}";
476
- readonly share: "Share";
477
- readonly value: "Value";
478
- readonly percent: "Percent";
479
- readonly remaining: "remaining";
480
- };
481
- readonly guide: {
482
- readonly next: "Next";
483
- readonly previous: "Back";
484
- readonly skip: "Skip tour";
485
- readonly done: "Done";
486
- readonly step: "Step {{current}} of {{total}}";
487
- readonly tour: "Guided tour";
488
- readonly close: "Close";
489
- readonly openHelp: "Help";
490
- readonly backToList: "All topics";
491
- readonly info: "More information";
492
- readonly infoAbout: "More information about {{label}}";
493
- readonly dismiss: "Dismiss hint";
494
- readonly startTour: "Start the guided tour";
495
- readonly actionRequired: "Complete the highlighted action to continue";
496
- readonly filterPlaceholder: "Filter topics…";
497
- readonly noResults: "No matching topics";
498
- };
499
- readonly journeyTimeline: {
500
- readonly label: "Journey";
501
- readonly status: {
502
- readonly complete: "Completed";
503
- readonly active: "In progress";
504
- readonly pending: "Pending";
505
- readonly attention: "Needs attention";
506
- readonly blocked: "Blocked";
507
- readonly skipped: "Skipped";
364
+ readonly chart: {
365
+ readonly category: "Kategorie";
366
+ readonly series: "Datenreihe {{index}}";
367
+ readonly segment: "Segment";
368
+ readonly value: "Wert";
369
+ readonly share: "Anteil";
508
370
  };
509
- };
510
- readonly datepicker: {
511
- readonly placeholder: "Select a date...";
512
- readonly rangePlaceholder: "Select a date range...";
513
- readonly clear: "Clear selection";
514
- readonly openCalendar: "Open calendar";
515
- readonly invalidDate: "Invalid date";
516
- readonly outOfRange: "Date is outside the allowed range";
517
- readonly invalidRange: "Invalid date range";
518
- };
519
- readonly fileUpload: {
520
- readonly exists: "File already added";
521
- readonly invalidType: "File type {{type}} is not allowed";
522
- readonly tooLarge: "File exceeds {{size}} limit";
523
- readonly tooMany: "Maximum {{count}} files allowed";
524
- readonly tooSmall: "File must be at least {{size}}";
525
- };
526
- readonly sankey: {
527
- readonly summary: "Sankey diagram: {{nodes}} nodes, {{links}} links — {{flows}}";
528
- readonly source: "Source";
529
- readonly target: "Target";
530
- readonly value: "Value";
531
- };
532
- readonly slider: {
533
- readonly rangeStatus: {
534
- readonly insideRecommended: "In recommended range";
535
- readonly insideValid: "In valid range";
536
- readonly insideValidOnly: "Outside recommended range, but valid";
537
- readonly outsideValid: "Outside valid range";
371
+ readonly stepper: {
372
+ readonly optional: "Optional";
538
373
  };
539
374
  };
540
- readonly themeSwitcher: {
541
- readonly lightMode: "Light mode";
542
- readonly darkMode: "Dark mode";
543
- readonly systemTheme: "System theme";
544
- };
545
- readonly time: {
546
- readonly ago: "{{value}} {{unit}} ago";
547
- readonly now: "now";
548
- };
549
- }>;
375
+ };
376
+ export declare const blocksI18n: import("@urbicon-ui/i18n").PackageI18n<import("@urbicon-ui/i18n").Translations>;
550
377
  /**
551
378
  * Context-scoped translation hook for the blocks package. Call during component
552
379
  * initialisation, then use the returned `t` (conventionally aliased `bt`):
@@ -559,188 +386,7 @@ export declare const blocksI18n: import("@urbicon-ui/i18n").PackageI18n<{
559
386
  * Resolves against the nearest `<I18nProvider>`'s locale (or the base locale
560
387
  * when none is mounted) and re-renders reactively on locale change.
561
388
  */
562
- export declare const useBlocksI18n: () => import("@urbicon-ui/i18n").TypedTranslationFunction<{
563
- readonly accessibility: {
564
- readonly avatar: "Avatar";
565
- readonly clearInput: "Clear input";
566
- readonly clearSearch: "Clear search";
567
- readonly clearSelection: "Clear selection";
568
- readonly closeDialog: "Close dialog";
569
- readonly closeDrawer: "Close drawer";
570
- readonly dismiss: "Dismiss";
571
- readonly fileUpload: "File upload";
572
- readonly loading: "Loading";
573
- readonly maximum: "Maximum";
574
- readonly minimum: "Minimum";
575
- readonly pagination: "Page navigation";
576
- readonly progress: "Progress";
577
- readonly slider: "Slider";
578
- readonly toggle: "Toggle";
579
- readonly toggleOptions: "Toggle options";
580
- readonly removableBadge: "Removable badge";
581
- readonly removeBadge: "Remove badge";
582
- readonly removeFile: "Remove {{name}}";
583
- };
584
- readonly button: {
585
- readonly close: "Close";
586
- readonly apply: "Apply";
587
- readonly cancel: "Cancel";
588
- readonly confirm: "Confirm";
589
- };
590
- readonly menu: {
591
- readonly placeholder: "Select an option...";
592
- };
593
- readonly common: {
594
- readonly loading: "Loading...";
595
- };
596
- readonly languages: {
597
- readonly de: "Deutsch";
598
- readonly en: "English";
599
- readonly es: "Español";
600
- readonly fr: "Français";
601
- readonly it: "Italiano";
602
- readonly nl: "Nederlands";
603
- };
604
- readonly localeSwitcher: {
605
- readonly ariaLabel: "Language selection";
606
- readonly placeholder: "Select language...";
607
- };
608
- readonly pagination: {
609
- readonly next: "Next";
610
- readonly first: "First";
611
- readonly last: "Last";
612
- readonly page: "Page";
613
- readonly previous: "Previous";
614
- };
615
- readonly calendar: {
616
- readonly recurring: "Recurring event";
617
- readonly previousMonth: "Previous month";
618
- readonly nextMonth: "Next month";
619
- readonly previousWeek: "Previous week";
620
- readonly nextWeek: "Next week";
621
- readonly previousDay: "Previous day";
622
- readonly nextDay: "Next day";
623
- readonly previousYear: "Previous year";
624
- readonly nextYear: "Next year";
625
- readonly today: "Today";
626
- readonly calendarGrid: "Calendar";
627
- readonly weekdays: "Weekdays";
628
- readonly weekNumber: "Week number";
629
- readonly events: "Events";
630
- readonly noEvents: "No events";
631
- readonly showMore: "{{count}} more";
632
- readonly legend: "Legend";
633
- readonly yearView: "Year overview";
634
- readonly weekView: "Week view";
635
- readonly dayView: "Day view";
636
- readonly monthView: "Month view";
637
- readonly viewMonth: "Month";
638
- readonly viewYear: "Year";
639
- readonly viewWeek: "Week";
640
- readonly viewDay: "Day";
641
- readonly multiDayLabel: "Day {{current}} of {{total}}";
642
- readonly agendaView: "Agenda view";
643
- readonly viewAgenda: "Agenda";
644
- readonly viewSwitcher: "View mode";
645
- };
646
- readonly planner: {
647
- readonly previousWeek: "Previous week";
648
- readonly nextWeek: "Next week";
649
- readonly previousMonth: "Previous month";
650
- readonly nextMonth: "Next month";
651
- readonly previousRange: "Previous range";
652
- readonly nextRange: "Next range";
653
- readonly today: "Today";
654
- readonly grid: "Planner";
655
- readonly weekNumber: "Week number";
656
- readonly itemCount: "{{count}} items";
657
- };
658
- readonly commandPalette: {
659
- readonly noResults: "No results found.";
660
- readonly search: "Search...";
661
- readonly hints: {
662
- readonly navigate: "Navigate";
663
- readonly select: "Select";
664
- readonly close: "Close";
665
- };
666
- };
667
- readonly compositionBar: {
668
- readonly total: "Total";
669
- readonly summary: "Composition: {{total}} ({{count}} shares) — {{parts}}";
670
- readonly share: "Share";
671
- readonly value: "Value";
672
- readonly percent: "Percent";
673
- readonly remaining: "remaining";
674
- };
675
- readonly guide: {
676
- readonly next: "Next";
677
- readonly previous: "Back";
678
- readonly skip: "Skip tour";
679
- readonly done: "Done";
680
- readonly step: "Step {{current}} of {{total}}";
681
- readonly tour: "Guided tour";
682
- readonly close: "Close";
683
- readonly openHelp: "Help";
684
- readonly backToList: "All topics";
685
- readonly info: "More information";
686
- readonly infoAbout: "More information about {{label}}";
687
- readonly dismiss: "Dismiss hint";
688
- readonly startTour: "Start the guided tour";
689
- readonly actionRequired: "Complete the highlighted action to continue";
690
- readonly filterPlaceholder: "Filter topics…";
691
- readonly noResults: "No matching topics";
692
- };
693
- readonly journeyTimeline: {
694
- readonly label: "Journey";
695
- readonly status: {
696
- readonly complete: "Completed";
697
- readonly active: "In progress";
698
- readonly pending: "Pending";
699
- readonly attention: "Needs attention";
700
- readonly blocked: "Blocked";
701
- readonly skipped: "Skipped";
702
- };
703
- };
704
- readonly datepicker: {
705
- readonly placeholder: "Select a date...";
706
- readonly rangePlaceholder: "Select a date range...";
707
- readonly clear: "Clear selection";
708
- readonly openCalendar: "Open calendar";
709
- readonly invalidDate: "Invalid date";
710
- readonly outOfRange: "Date is outside the allowed range";
711
- readonly invalidRange: "Invalid date range";
712
- };
713
- readonly fileUpload: {
714
- readonly exists: "File already added";
715
- readonly invalidType: "File type {{type}} is not allowed";
716
- readonly tooLarge: "File exceeds {{size}} limit";
717
- readonly tooMany: "Maximum {{count}} files allowed";
718
- readonly tooSmall: "File must be at least {{size}}";
719
- };
720
- readonly sankey: {
721
- readonly summary: "Sankey diagram: {{nodes}} nodes, {{links}} links — {{flows}}";
722
- readonly source: "Source";
723
- readonly target: "Target";
724
- readonly value: "Value";
725
- };
726
- readonly slider: {
727
- readonly rangeStatus: {
728
- readonly insideRecommended: "In recommended range";
729
- readonly insideValid: "In valid range";
730
- readonly insideValidOnly: "Outside recommended range, but valid";
731
- readonly outsideValid: "Outside valid range";
732
- };
733
- };
734
- readonly themeSwitcher: {
735
- readonly lightMode: "Light mode";
736
- readonly darkMode: "Dark mode";
737
- readonly systemTheme: "System theme";
738
- };
739
- readonly time: {
740
- readonly ago: "{{value}} {{unit}} ago";
741
- readonly now: "now";
742
- };
743
- }>;
389
+ export declare const useBlocksI18n: any;
744
390
  export declare const hasBlocksTranslation: (key: string) => boolean, getBlocksLocales: () => import("@urbicon-ui/i18n").Locale[];
745
391
  export type BlocksTranslationKey = keyof typeof enTranslations;
746
392
  export { blocksTranslations };
@@ -86,6 +86,12 @@ export declare class DateGridController {
86
86
  get title(): string;
87
87
  get canGoBack(): boolean;
88
88
  get canGoForward(): boolean;
89
+ /** Whether today lies within `[minDate, maxDate]` and can be navigated to. Drives
90
+ * the header Today button's disabled state (mirrors the arrow buttons gating on
91
+ * canGoBack/canGoForward). Day-granular: the button jumps to today's *day*, so a
92
+ * maxDate earlier this month still disables it once today passes the bound. Reads
93
+ * the reactive `today`, so it re-evaluates after the midnight refresh. */
94
+ get canGoToToday(): boolean;
89
95
  weekNumberFor(date: Date): number;
90
96
  isToday(date: Date): boolean;
91
97
  isWeekend(date: Date): boolean;
@@ -103,11 +109,20 @@ export declare class DateGridController {
103
109
  /** Step the view by `delta` units (months / weeks / days; range shifts by its
104
110
  * own span in weeks). Emits the next reference date and visible range. */
105
111
  navigate(delta: number): void;
106
- /** Jump to today and focus it. */
112
+ /** Jump to today and focus it. Clamped to `[minDate, maxDate]`: the header Today
113
+ * button gates itself on {@link canGoToToday} (a clamped "today" is not today, so
114
+ * it disables rather than mislead), but a programmatic call still must not seat the
115
+ * reference on an all-disabled month/week/day past the boundary. Uses `today` — the
116
+ * controller's source of truth for "today" — so it lands where `isToday` marks. */
107
117
  goToToday(): void;
108
- /** Jump the reference date to a specific date. */
118
+ /** Jump the reference date to a specific date, clamped to `[minDate, maxDate]`. */
109
119
  goTo(date: Date): void;
110
- /** Set the roving focus, navigating the view if the date left the visible window. */
120
+ /** Set the roving focus, navigating the view if the date left the visible window.
121
+ * The target is clamped to `[minDate, maxDate]` — arrow/Home/End/Page keys are not
122
+ * gated by canGoBack/canGoForward, so an unclamped focus could cross the boundary
123
+ * and drag the view onto an all-disabled window (the same escape the stepping paths
124
+ * close). Only the hard outer bounds clamp; custom `isDateDisabled` holes *inside*
125
+ * the range stay focusable, per the ARIA grid pattern. */
111
126
  setFocusedDate(date: Date): void;
112
127
  /** Move the roving focus by `deltaDays` (keyboard arrows / page keys). */
113
128
  moveFocus(deltaDays: number): void;
@@ -13,7 +13,7 @@
13
13
  * the source of truth (`bind:value`). Only `focusedDate`, `hoveredDate` and
14
14
  * `navDirection` are controller-owned `$state`.
15
15
  */
16
- import { addDays, clampMonth, daysBetween, daysInMonth, endOfWeek, formatDateRange, formatDayTitle, formatMonthYear, formatWeekTitle, getMonthGrid, getWeekDates, getWeekdayNames, getWeekNumber, isInMonth, isInRange, isSameDay, isWeekend, startOfWeek, stripTime, toIso } from '../../date/index.js';
16
+ import { addDays, clampDate, clampMonth, daysBetween, daysInMonth, endOfWeek, formatDateRange, formatDayTitle, formatMonthYear, formatWeekTitle, getMonthGrid, getWeekDates, getWeekdayNames, getWeekNumber, isInMonth, isInRange, isSameDay, isWeekend, startOfWeek, stripTime, toIso } from '../../date/index.js';
17
17
  export class DateGridController {
18
18
  #opts;
19
19
  /** The roving keyboard focus target (local midnight). Controller-owned. */
@@ -27,6 +27,21 @@ export class DateGridController {
27
27
  constructor(opts) {
28
28
  this.#opts = opts;
29
29
  this.focusedDate = stripTime(opts.referenceDate);
30
+ // Dev-only: surface inverted bounds (a caller passing minDate after
31
+ // maxDate). `clampDate` resolves every date to minDate in that case, so
32
+ // navigation gating and today/disabled logic become deterministic-but-
33
+ // meaningless rather than failing. Checked once at construction — the
34
+ // realistic mistake is statically swapped props; mirrors the Select/Guide
35
+ // `import.meta.env?.DEV && console.warn` precedent (no throw: a degraded
36
+ // grid still renders, and the library never crashes on caller garbage-in).
37
+ if (import.meta.env?.DEV) {
38
+ const { minDate, maxDate } = opts;
39
+ if (minDate && maxDate && stripTime(minDate) > stripTime(maxDate)) {
40
+ console.warn(`[DateGrid] minDate (${minDate.toLocaleDateString()}) is after maxDate ` +
41
+ `(${maxDate.toLocaleDateString()}) — bounds are inverted; every date ` +
42
+ `clamps to minDate and navigation is meaningless. Swap the two.`);
43
+ }
44
+ }
30
45
  }
31
46
  // ─── Reflected inputs ────────────────────────────────────────────────────
32
47
  get view() {
@@ -112,6 +127,20 @@ export class DateGridController {
112
127
  get canGoForward() {
113
128
  return this.#navBounds.canGoForward;
114
129
  }
130
+ /** Whether today lies within `[minDate, maxDate]` and can be navigated to. Drives
131
+ * the header Today button's disabled state (mirrors the arrow buttons gating on
132
+ * canGoBack/canGoForward). Day-granular: the button jumps to today's *day*, so a
133
+ * maxDate earlier this month still disables it once today passes the bound. Reads
134
+ * the reactive `today`, so it re-evaluates after the midnight refresh. */
135
+ get canGoToToday() {
136
+ const { minDate, maxDate } = this.#opts;
137
+ const t = this.today;
138
+ if (minDate && t < stripTime(minDate))
139
+ return false;
140
+ if (maxDate && t > stripTime(maxDate))
141
+ return false;
142
+ return true;
143
+ }
115
144
  // ─── Per-day queries ─────────────────────────────────────────────────────
116
145
  weekNumberFor(date) {
117
146
  return getWeekNumber(date);
@@ -235,39 +264,51 @@ export class DateGridController {
235
264
  // month (1 Mar 2026 is a Sunday → its Monday-week is 23 Feb–1 Mar). Matches
236
265
  // the keyboard PageUp/PageDown month step, which already clamps the day.
237
266
  const day = Math.min(referenceDate.getDate(), daysInMonth(clamped.year, clamped.month));
238
- next = new Date(clamped.year, clamped.month, day);
239
- // clampMonth bounds the month; clamp the preserved day too so it never lands
240
- // before minDate / after maxDate within that boundary month (a week view
241
- // would otherwise open on an all-disabled week just outside the range).
242
- if (minDate && next < stripTime(minDate))
243
- next = stripTime(minDate);
244
- if (maxDate && next > stripTime(maxDate))
245
- next = stripTime(maxDate);
267
+ // clampMonth bounds the month; clampDate clamps the preserved day too so it
268
+ // never lands before minDate / after maxDate within that boundary month (a
269
+ // week view would otherwise open on an all-disabled week just outside range).
270
+ next = clampDate(new Date(clamped.year, clamped.month, day), minDate, maxDate);
246
271
  break;
247
272
  }
273
+ // Week/day steps carry no month bounds of their own, so clamp the shifted
274
+ // reference to [minDate, maxDate] too — otherwise a swipe or a day-view arrow
275
+ // key (neither gated by canGoBack/canGoForward the way the header arrows are)
276
+ // could step the anchor onto an all-disabled week/day past the boundary.
248
277
  case 'week':
249
- next = addDays(referenceDate, delta * 7);
278
+ next = clampDate(addDays(referenceDate, delta * 7), minDate, maxDate);
250
279
  break;
251
280
  case 'day':
252
- next = addDays(referenceDate, delta);
281
+ next = clampDate(addDays(referenceDate, delta), minDate, maxDate);
253
282
  break;
254
283
  }
255
284
  this.#emitNavigate(next);
256
285
  }
257
- /** Jump to today and focus it. */
286
+ /** Jump to today and focus it. Clamped to `[minDate, maxDate]`: the header Today
287
+ * button gates itself on {@link canGoToToday} (a clamped "today" is not today, so
288
+ * it disables rather than mislead), but a programmatic call still must not seat the
289
+ * reference on an all-disabled month/week/day past the boundary. Uses `today` — the
290
+ * controller's source of truth for "today" — so it lands where `isToday` marks. */
258
291
  goToToday() {
259
- const now = stripTime(new Date());
292
+ const { minDate, maxDate } = this.#opts;
293
+ const now = clampDate(this.today, minDate, maxDate);
260
294
  this.focusedDate = now;
261
295
  this.#emitNavigate(now);
262
296
  }
263
- /** Jump the reference date to a specific date. */
297
+ /** Jump the reference date to a specific date, clamped to `[minDate, maxDate]`. */
264
298
  goTo(date) {
265
- this.#emitNavigate(stripTime(date));
266
- }
267
- /** Set the roving focus, navigating the view if the date left the visible window. */
299
+ const { minDate, maxDate } = this.#opts;
300
+ this.#emitNavigate(clampDate(stripTime(date), minDate, maxDate));
301
+ }
302
+ /** Set the roving focus, navigating the view if the date left the visible window.
303
+ * The target is clamped to `[minDate, maxDate]` — arrow/Home/End/Page keys are not
304
+ * gated by canGoBack/canGoForward, so an unclamped focus could cross the boundary
305
+ * and drag the view onto an all-disabled window (the same escape the stepping paths
306
+ * close). Only the hard outer bounds clamp; custom `isDateDisabled` holes *inside*
307
+ * the range stay focusable, per the ARIA grid pattern. */
268
308
  setFocusedDate(date) {
269
- const d = stripTime(date);
270
- const reference = stripTime(this.#opts.referenceDate);
309
+ const { minDate, maxDate, referenceDate } = this.#opts;
310
+ const d = clampDate(stripTime(date), minDate, maxDate);
311
+ const reference = stripTime(referenceDate);
271
312
  this.focusedDate = d;
272
313
  if (this.#needsNavigationToFocus(d)) {
273
314
  this.navDirection = d.getTime() >= reference.getTime() ? 'forward' : 'backward';
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Shared mechanics for cell-based date views: the `DateGridController` state
5
5
  * class, its context, the keyboard handler and the `DateGridScaffold` chrome.
6
- * Consumed by Calendar and Planner; see docs/DATEGRID-PLANNER-PLAN.md (D6) for
7
- * why it stays internal for now.
6
+ * Consumed by Calendar and Planner; see docs/ARCHITECTURE.md "Date & Planning
7
+ * Infrastructure" for why it stays internal for now.
8
8
  */
9
9
  export { default as DateGridScaffold } from './DateGridScaffold.svelte';
10
10
  export { getDateGridContext, setDateGridContext } from './date-grid.context.js';
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Shared mechanics for cell-based date views: the `DateGridController` state
5
5
  * class, its context, the keyboard handler and the `DateGridScaffold` chrome.
6
- * Consumed by Calendar and Planner; see docs/DATEGRID-PLANNER-PLAN.md (D6) for
7
- * why it stays internal for now.
6
+ * Consumed by Calendar and Planner; see docs/ARCHITECTURE.md "Date & Planning
7
+ * Infrastructure" for why it stays internal for now.
8
8
  */
9
9
  export { default as DateGridScaffold } from './DateGridScaffold.svelte';
10
10
  export { getDateGridContext, setDateGridContext } from './date-grid.context.js';