react-native-agenda-kit 0.1.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/LICENSE +21 -0
- package/README.md +364 -0
- package/lib/commonjs/agenda/AgendaBackdrop.js +68 -0
- package/lib/commonjs/agenda/AgendaBackdrop.js.map +1 -0
- package/lib/commonjs/agenda/AgendaList.js +354 -0
- package/lib/commonjs/agenda/AgendaList.js.map +1 -0
- package/lib/commonjs/agenda/AgendaSlot.js +88 -0
- package/lib/commonjs/agenda/AgendaSlot.js.map +1 -0
- package/lib/commonjs/agenda/AgendaWindow.js +171 -0
- package/lib/commonjs/agenda/AgendaWindow.js.map +1 -0
- package/lib/commonjs/agenda/StickyHeaderOverlay.js +125 -0
- package/lib/commonjs/agenda/StickyHeaderOverlay.js.map +1 -0
- package/lib/commonjs/agenda/buildAgendaLayout.js +100 -0
- package/lib/commonjs/agenda/buildAgendaLayout.js.map +1 -0
- package/lib/commonjs/agenda/constants.js +29 -0
- package/lib/commonjs/agenda/constants.js.map +1 -0
- package/lib/commonjs/agenda/heights.js +49 -0
- package/lib/commonjs/agenda/heights.js.map +1 -0
- package/lib/commonjs/agenda/useAgendaScrollSync.js +204 -0
- package/lib/commonjs/agenda/useAgendaScrollSync.js.map +1 -0
- package/lib/commonjs/core/ArrowGlyph.js +65 -0
- package/lib/commonjs/core/ArrowGlyph.js.map +1 -0
- package/lib/commonjs/core/CalendarContext.js +32 -0
- package/lib/commonjs/core/CalendarContext.js.map +1 -0
- package/lib/commonjs/core/CalendarProvider.js +141 -0
- package/lib/commonjs/core/CalendarProvider.js.map +1 -0
- package/lib/commonjs/core/CalendarStore.js +70 -0
- package/lib/commonjs/core/CalendarStore.js.map +1 -0
- package/lib/commonjs/core/KitText.js +23 -0
- package/lib/commonjs/core/KitText.js.map +1 -0
- package/lib/commonjs/core/TodayButton.js +136 -0
- package/lib/commonjs/core/TodayButton.js.map +1 -0
- package/lib/commonjs/core/civil.js +101 -0
- package/lib/commonjs/core/civil.js.map +1 -0
- package/lib/commonjs/core/dateKey.js +56 -0
- package/lib/commonjs/core/dateKey.js.map +1 -0
- package/lib/commonjs/core/motion.js +56 -0
- package/lib/commonjs/core/motion.js.map +1 -0
- package/lib/commonjs/core/worklets.js +44 -0
- package/lib/commonjs/core/worklets.js.map +1 -0
- package/lib/commonjs/expandable/DayCell.js +120 -0
- package/lib/commonjs/expandable/DayCell.js.map +1 -0
- package/lib/commonjs/expandable/ExpandableCalendar.js +280 -0
- package/lib/commonjs/expandable/ExpandableCalendar.js.map +1 -0
- package/lib/commonjs/expandable/Knob.js +72 -0
- package/lib/commonjs/expandable/Knob.js.map +1 -0
- package/lib/commonjs/expandable/MonthPager.js +180 -0
- package/lib/commonjs/expandable/MonthPager.js.map +1 -0
- package/lib/commonjs/expandable/WeekStrip.js +451 -0
- package/lib/commonjs/expandable/WeekStrip.js.map +1 -0
- package/lib/commonjs/expandable/calendarCells.js +152 -0
- package/lib/commonjs/expandable/calendarCells.js.map +1 -0
- package/lib/commonjs/expandable/geometry.js +62 -0
- package/lib/commonjs/expandable/geometry.js.map +1 -0
- package/lib/commonjs/expandable/useExpandGesture.js +124 -0
- package/lib/commonjs/expandable/useExpandGesture.js.map +1 -0
- package/lib/commonjs/expandable/useHorizontalPager.js +97 -0
- package/lib/commonjs/expandable/useHorizontalPager.js.map +1 -0
- package/lib/commonjs/index.js +167 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +73 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/index.js +75 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/theme.js +79 -0
- package/lib/commonjs/theme/theme.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +54 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/timeline/DayColumn.js +95 -0
- package/lib/commonjs/timeline/DayColumn.js.map +1 -0
- package/lib/commonjs/timeline/DayPager.js +250 -0
- package/lib/commonjs/timeline/DayPager.js.map +1 -0
- package/lib/commonjs/timeline/EventBlock.js +91 -0
- package/lib/commonjs/timeline/EventBlock.js.map +1 -0
- package/lib/commonjs/timeline/GridLines.js +47 -0
- package/lib/commonjs/timeline/GridLines.js.map +1 -0
- package/lib/commonjs/timeline/HourGrid.js +96 -0
- package/lib/commonjs/timeline/HourGrid.js.map +1 -0
- package/lib/commonjs/timeline/NowIndicator.js +132 -0
- package/lib/commonjs/timeline/NowIndicator.js.map +1 -0
- package/lib/commonjs/timeline/TimelineDay.js +126 -0
- package/lib/commonjs/timeline/TimelineDay.js.map +1 -0
- package/lib/commonjs/timeline/packEvents.js +102 -0
- package/lib/commonjs/timeline/packEvents.js.map +1 -0
- package/lib/commonjs/timeline/timelineGeometry.js +27 -0
- package/lib/commonjs/timeline/timelineGeometry.js.map +1 -0
- package/lib/commonjs/timeline/timelineMath.js +82 -0
- package/lib/commonjs/timeline/timelineMath.js.map +1 -0
- package/lib/commonjs/types.js +71 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/agenda/AgendaBackdrop.js +63 -0
- package/lib/module/agenda/AgendaBackdrop.js.map +1 -0
- package/lib/module/agenda/AgendaList.js +349 -0
- package/lib/module/agenda/AgendaList.js.map +1 -0
- package/lib/module/agenda/AgendaSlot.js +84 -0
- package/lib/module/agenda/AgendaSlot.js.map +1 -0
- package/lib/module/agenda/AgendaWindow.js +167 -0
- package/lib/module/agenda/AgendaWindow.js.map +1 -0
- package/lib/module/agenda/StickyHeaderOverlay.js +120 -0
- package/lib/module/agenda/StickyHeaderOverlay.js.map +1 -0
- package/lib/module/agenda/buildAgendaLayout.js +95 -0
- package/lib/module/agenda/buildAgendaLayout.js.map +1 -0
- package/lib/module/agenda/constants.js +25 -0
- package/lib/module/agenda/constants.js.map +1 -0
- package/lib/module/agenda/heights.js +42 -0
- package/lib/module/agenda/heights.js.map +1 -0
- package/lib/module/agenda/useAgendaScrollSync.js +200 -0
- package/lib/module/agenda/useAgendaScrollSync.js.map +1 -0
- package/lib/module/core/ArrowGlyph.js +60 -0
- package/lib/module/core/ArrowGlyph.js.map +1 -0
- package/lib/module/core/CalendarContext.js +26 -0
- package/lib/module/core/CalendarContext.js.map +1 -0
- package/lib/module/core/CalendarProvider.js +136 -0
- package/lib/module/core/CalendarProvider.js.map +1 -0
- package/lib/module/core/CalendarStore.js +66 -0
- package/lib/module/core/CalendarStore.js.map +1 -0
- package/lib/module/core/KitText.js +19 -0
- package/lib/module/core/KitText.js.map +1 -0
- package/lib/module/core/TodayButton.js +133 -0
- package/lib/module/core/TodayButton.js.map +1 -0
- package/lib/module/core/civil.js +88 -0
- package/lib/module/core/civil.js.map +1 -0
- package/lib/module/core/dateKey.js +47 -0
- package/lib/module/core/dateKey.js.map +1 -0
- package/lib/module/core/motion.js +49 -0
- package/lib/module/core/motion.js.map +1 -0
- package/lib/module/core/worklets.js +38 -0
- package/lib/module/core/worklets.js.map +1 -0
- package/lib/module/expandable/DayCell.js +116 -0
- package/lib/module/expandable/DayCell.js.map +1 -0
- package/lib/module/expandable/ExpandableCalendar.js +275 -0
- package/lib/module/expandable/ExpandableCalendar.js.map +1 -0
- package/lib/module/expandable/Knob.js +67 -0
- package/lib/module/expandable/Knob.js.map +1 -0
- package/lib/module/expandable/MonthPager.js +175 -0
- package/lib/module/expandable/MonthPager.js.map +1 -0
- package/lib/module/expandable/WeekStrip.js +446 -0
- package/lib/module/expandable/WeekStrip.js.map +1 -0
- package/lib/module/expandable/calendarCells.js +142 -0
- package/lib/module/expandable/calendarCells.js.map +1 -0
- package/lib/module/expandable/geometry.js +58 -0
- package/lib/module/expandable/geometry.js.map +1 -0
- package/lib/module/expandable/useExpandGesture.js +118 -0
- package/lib/module/expandable/useExpandGesture.js.map +1 -0
- package/lib/module/expandable/useHorizontalPager.js +92 -0
- package/lib/module/expandable/useHorizontalPager.js.map +1 -0
- package/lib/module/index.js +35 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme/ThemeProvider.js +65 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/index.js +6 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/theme.js +74 -0
- package/lib/module/theme/theme.js.map +1 -0
- package/lib/module/theme/tokens.js +50 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/timeline/DayColumn.js +91 -0
- package/lib/module/timeline/DayColumn.js.map +1 -0
- package/lib/module/timeline/DayPager.js +245 -0
- package/lib/module/timeline/DayPager.js.map +1 -0
- package/lib/module/timeline/EventBlock.js +87 -0
- package/lib/module/timeline/EventBlock.js.map +1 -0
- package/lib/module/timeline/GridLines.js +43 -0
- package/lib/module/timeline/GridLines.js.map +1 -0
- package/lib/module/timeline/HourGrid.js +94 -0
- package/lib/module/timeline/HourGrid.js.map +1 -0
- package/lib/module/timeline/NowIndicator.js +126 -0
- package/lib/module/timeline/NowIndicator.js.map +1 -0
- package/lib/module/timeline/TimelineDay.js +122 -0
- package/lib/module/timeline/TimelineDay.js.map +1 -0
- package/lib/module/timeline/packEvents.js +97 -0
- package/lib/module/timeline/packEvents.js.map +1 -0
- package/lib/module/timeline/timelineGeometry.js +22 -0
- package/lib/module/timeline/timelineGeometry.js.map +1 -0
- package/lib/module/timeline/timelineMath.js +75 -0
- package/lib/module/timeline/timelineMath.js.map +1 -0
- package/lib/module/types.js +67 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts +20 -0
- package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaList.d.ts +12 -0
- package/lib/typescript/commonjs/agenda/AgendaList.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts +45 -0
- package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts +49 -0
- package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts +39 -0
- package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts +57 -0
- package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/constants.d.ts +19 -0
- package/lib/typescript/commonjs/agenda/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/heights.d.ts +20 -0
- package/lib/typescript/commonjs/agenda/heights.d.ts.map +1 -0
- package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts +44 -0
- package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/ArrowGlyph.d.ts +14 -0
- package/lib/typescript/commonjs/core/ArrowGlyph.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarContext.d.ts +35 -0
- package/lib/typescript/commonjs/core/CalendarContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarProvider.d.ts +41 -0
- package/lib/typescript/commonjs/core/CalendarProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/CalendarStore.d.ts +28 -0
- package/lib/typescript/commonjs/core/CalendarStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/KitText.d.ts +10 -0
- package/lib/typescript/commonjs/core/KitText.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/TodayButton.d.ts +18 -0
- package/lib/typescript/commonjs/core/TodayButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/civil.d.ts +26 -0
- package/lib/typescript/commonjs/core/civil.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/dateKey.d.ts +21 -0
- package/lib/typescript/commonjs/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/motion.d.ts +18 -0
- package/lib/typescript/commonjs/core/motion.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/worklets.d.ts +12 -0
- package/lib/typescript/commonjs/core/worklets.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/DayCell.d.ts +22 -0
- package/lib/typescript/commonjs/expandable/DayCell.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts +40 -0
- package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/Knob.d.ts +19 -0
- package/lib/typescript/commonjs/expandable/Knob.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/MonthPager.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/MonthPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/WeekStrip.d.ts +34 -0
- package/lib/typescript/commonjs/expandable/WeekStrip.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/calendarCells.d.ts +52 -0
- package/lib/typescript/commonjs/expandable/calendarCells.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/geometry.d.ts +43 -0
- package/lib/typescript/commonjs/expandable/geometry.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts.map +1 -0
- package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts +35 -0
- package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +26 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts +27 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +4 -0
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/theme.d.ts +62 -0
- package/lib/typescript/commonjs/theme/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts +46 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/DayColumn.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/DayColumn.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/DayPager.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/DayPager.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/EventBlock.d.ts +17 -0
- package/lib/typescript/commonjs/timeline/EventBlock.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/GridLines.d.ts +5 -0
- package/lib/typescript/commonjs/timeline/GridLines.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/HourGrid.d.ts +12 -0
- package/lib/typescript/commonjs/timeline/HourGrid.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/NowIndicator.d.ts +28 -0
- package/lib/typescript/commonjs/timeline/NowIndicator.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/TimelineDay.d.ts +14 -0
- package/lib/typescript/commonjs/timeline/TimelineDay.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/packEvents.d.ts +25 -0
- package/lib/typescript/commonjs/timeline/packEvents.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts +14 -0
- package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts.map +1 -0
- package/lib/typescript/commonjs/timeline/timelineMath.d.ts +32 -0
- package/lib/typescript/commonjs/timeline/timelineMath.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +237 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaBackdrop.d.ts +20 -0
- package/lib/typescript/module/agenda/AgendaBackdrop.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaList.d.ts +12 -0
- package/lib/typescript/module/agenda/AgendaList.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaSlot.d.ts +45 -0
- package/lib/typescript/module/agenda/AgendaSlot.d.ts.map +1 -0
- package/lib/typescript/module/agenda/AgendaWindow.d.ts +49 -0
- package/lib/typescript/module/agenda/AgendaWindow.d.ts.map +1 -0
- package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts +39 -0
- package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts.map +1 -0
- package/lib/typescript/module/agenda/buildAgendaLayout.d.ts +57 -0
- package/lib/typescript/module/agenda/buildAgendaLayout.d.ts.map +1 -0
- package/lib/typescript/module/agenda/constants.d.ts +19 -0
- package/lib/typescript/module/agenda/constants.d.ts.map +1 -0
- package/lib/typescript/module/agenda/heights.d.ts +20 -0
- package/lib/typescript/module/agenda/heights.d.ts.map +1 -0
- package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts +44 -0
- package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts.map +1 -0
- package/lib/typescript/module/core/ArrowGlyph.d.ts +14 -0
- package/lib/typescript/module/core/ArrowGlyph.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarContext.d.ts +35 -0
- package/lib/typescript/module/core/CalendarContext.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarProvider.d.ts +41 -0
- package/lib/typescript/module/core/CalendarProvider.d.ts.map +1 -0
- package/lib/typescript/module/core/CalendarStore.d.ts +28 -0
- package/lib/typescript/module/core/CalendarStore.d.ts.map +1 -0
- package/lib/typescript/module/core/KitText.d.ts +10 -0
- package/lib/typescript/module/core/KitText.d.ts.map +1 -0
- package/lib/typescript/module/core/TodayButton.d.ts +18 -0
- package/lib/typescript/module/core/TodayButton.d.ts.map +1 -0
- package/lib/typescript/module/core/civil.d.ts +26 -0
- package/lib/typescript/module/core/civil.d.ts.map +1 -0
- package/lib/typescript/module/core/dateKey.d.ts +21 -0
- package/lib/typescript/module/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/module/core/motion.d.ts +18 -0
- package/lib/typescript/module/core/motion.d.ts.map +1 -0
- package/lib/typescript/module/core/worklets.d.ts +12 -0
- package/lib/typescript/module/core/worklets.d.ts.map +1 -0
- package/lib/typescript/module/expandable/DayCell.d.ts +22 -0
- package/lib/typescript/module/expandable/DayCell.d.ts.map +1 -0
- package/lib/typescript/module/expandable/ExpandableCalendar.d.ts +40 -0
- package/lib/typescript/module/expandable/ExpandableCalendar.d.ts.map +1 -0
- package/lib/typescript/module/expandable/Knob.d.ts +19 -0
- package/lib/typescript/module/expandable/Knob.d.ts.map +1 -0
- package/lib/typescript/module/expandable/MonthPager.d.ts +35 -0
- package/lib/typescript/module/expandable/MonthPager.d.ts.map +1 -0
- package/lib/typescript/module/expandable/WeekStrip.d.ts +34 -0
- package/lib/typescript/module/expandable/WeekStrip.d.ts.map +1 -0
- package/lib/typescript/module/expandable/calendarCells.d.ts +52 -0
- package/lib/typescript/module/expandable/calendarCells.d.ts.map +1 -0
- package/lib/typescript/module/expandable/geometry.d.ts +43 -0
- package/lib/typescript/module/expandable/geometry.d.ts.map +1 -0
- package/lib/typescript/module/expandable/useExpandGesture.d.ts +35 -0
- package/lib/typescript/module/expandable/useExpandGesture.d.ts.map +1 -0
- package/lib/typescript/module/expandable/useHorizontalPager.d.ts +35 -0
- package/lib/typescript/module/expandable/useHorizontalPager.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +26 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts +27 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +4 -0
- package/lib/typescript/module/theme/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/theme.d.ts +62 -0
- package/lib/typescript/module/theme/theme.d.ts.map +1 -0
- package/lib/typescript/module/theme/tokens.d.ts +46 -0
- package/lib/typescript/module/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/module/timeline/DayColumn.d.ts +32 -0
- package/lib/typescript/module/timeline/DayColumn.d.ts.map +1 -0
- package/lib/typescript/module/timeline/DayPager.d.ts +32 -0
- package/lib/typescript/module/timeline/DayPager.d.ts.map +1 -0
- package/lib/typescript/module/timeline/EventBlock.d.ts +17 -0
- package/lib/typescript/module/timeline/EventBlock.d.ts.map +1 -0
- package/lib/typescript/module/timeline/GridLines.d.ts +5 -0
- package/lib/typescript/module/timeline/GridLines.d.ts.map +1 -0
- package/lib/typescript/module/timeline/HourGrid.d.ts +12 -0
- package/lib/typescript/module/timeline/HourGrid.d.ts.map +1 -0
- package/lib/typescript/module/timeline/NowIndicator.d.ts +28 -0
- package/lib/typescript/module/timeline/NowIndicator.d.ts.map +1 -0
- package/lib/typescript/module/timeline/TimelineDay.d.ts +14 -0
- package/lib/typescript/module/timeline/TimelineDay.d.ts.map +1 -0
- package/lib/typescript/module/timeline/packEvents.d.ts +25 -0
- package/lib/typescript/module/timeline/packEvents.d.ts.map +1 -0
- package/lib/typescript/module/timeline/timelineGeometry.d.ts +14 -0
- package/lib/typescript/module/timeline/timelineGeometry.d.ts.map +1 -0
- package/lib/typescript/module/timeline/timelineMath.d.ts +32 -0
- package/lib/typescript/module/timeline/timelineMath.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +237 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/package.json +105 -0
- package/src/agenda/AgendaBackdrop.tsx +55 -0
- package/src/agenda/AgendaList.tsx +370 -0
- package/src/agenda/AgendaSlot.tsx +88 -0
- package/src/agenda/AgendaWindow.tsx +183 -0
- package/src/agenda/StickyHeaderOverlay.tsx +126 -0
- package/src/agenda/buildAgendaLayout.ts +110 -0
- package/src/agenda/constants.ts +22 -0
- package/src/agenda/heights.ts +44 -0
- package/src/agenda/useAgendaScrollSync.ts +251 -0
- package/src/core/ArrowGlyph.tsx +53 -0
- package/src/core/CalendarContext.ts +47 -0
- package/src/core/CalendarProvider.tsx +165 -0
- package/src/core/CalendarStore.ts +64 -0
- package/src/core/KitText.tsx +10 -0
- package/src/core/TodayButton.tsx +121 -0
- package/src/core/civil.ts +92 -0
- package/src/core/dateKey.ts +52 -0
- package/src/core/motion.ts +51 -0
- package/src/core/worklets.ts +37 -0
- package/src/expandable/DayCell.tsx +97 -0
- package/src/expandable/ExpandableCalendar.tsx +278 -0
- package/src/expandable/Knob.tsx +67 -0
- package/src/expandable/MonthPager.tsx +208 -0
- package/src/expandable/WeekStrip.tsx +439 -0
- package/src/expandable/calendarCells.ts +155 -0
- package/src/expandable/geometry.ts +51 -0
- package/src/expandable/useExpandGesture.ts +147 -0
- package/src/expandable/useHorizontalPager.ts +116 -0
- package/src/index.ts +62 -0
- package/src/theme/ThemeProvider.tsx +85 -0
- package/src/theme/index.ts +18 -0
- package/src/theme/theme.ts +110 -0
- package/src/theme/tokens.ts +50 -0
- package/src/timeline/DayColumn.tsx +84 -0
- package/src/timeline/DayPager.tsx +295 -0
- package/src/timeline/EventBlock.tsx +76 -0
- package/src/timeline/GridLines.tsx +36 -0
- package/src/timeline/HourGrid.tsx +90 -0
- package/src/timeline/NowIndicator.tsx +123 -0
- package/src/timeline/TimelineDay.tsx +112 -0
- package/src/timeline/packEvents.ts +118 -0
- package/src/timeline/timelineGeometry.ts +23 -0
- package/src/timeline/timelineMath.ts +86 -0
- package/src/types.ts +252 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCalendarDate = exports.useCalendarContext = exports.CalendarDateContext = exports.CalendarContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Two contexts, split by how often they change.
|
|
10
|
+
*
|
|
11
|
+
* `CalendarContext` is identity-stable for the life of the provider: every
|
|
12
|
+
* scroller reads it, and none of them may re-render because a date was committed.
|
|
13
|
+
* `CalendarDateContext` is the committed date alone — only surfaces that DRAW the
|
|
14
|
+
* committed date (the month grid's selection) subscribe to it. Surfaces that
|
|
15
|
+
* track the date at frame rate read `store.dayIndex` and subscribe to neither.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const CalendarContext = exports.CalendarContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
19
|
+
const CalendarDateContext = exports.CalendarDateContext = /*#__PURE__*/(0, _react.createContext)('');
|
|
20
|
+
const useCalendarContext = () => {
|
|
21
|
+
const ctx = (0, _react.useContext)(CalendarContext);
|
|
22
|
+
if (!ctx) {
|
|
23
|
+
throw new Error('[agenda-kit] useCalendarContext outside <CalendarProvider>. AgendaList, ' + 'ExpandableCalendar and TimelineList share one index space and must be inside it.');
|
|
24
|
+
}
|
|
25
|
+
return ctx;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** The committed date. Subscribing re-renders on every commit — use sparingly. */
|
|
29
|
+
exports.useCalendarContext = useCalendarContext;
|
|
30
|
+
const useCalendarDate = () => (0, _react.useContext)(CalendarDateContext);
|
|
31
|
+
exports.useCalendarDate = useCalendarDate;
|
|
32
|
+
//# sourceMappingURL=CalendarContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","CalendarContext","exports","createContext","CalendarDateContext","useCalendarContext","ctx","useContext","Error","useCalendarDate"],"sourceRoot":"../../../src","sources":["core/CalendarContext.ts"],"mappings":";;;;;;AAUA,IAAAA,MAAA,GAAAC,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuBO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,oBAAa,EAA8B,IAAI,CAAC;AACxE,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,gBAAG,IAAAD,oBAAa,EAAa,EAAE,CAAC;AAEzD,MAAME,kBAAkB,GAAGA,CAAA,KAA4B;EAC5D,MAAMC,GAAG,GAAG,IAAAC,iBAAU,EAACN,eAAe,CAAC;EACvC,IAAI,CAACK,GAAG,EAAE;IACR,MAAM,IAAIE,KAAK,CACb,0EAA0E,GACxE,kFACJ,CAAC;EACH;EACA,OAAOF,GAAG;AACZ,CAAC;;AAED;AAAAJ,OAAA,CAAAG,kBAAA,GAAAA,kBAAA;AACO,MAAMI,eAAe,GAAGA,CAAA,KAAkB,IAAAF,iBAAU,EAACH,mBAAmB,CAAC;AAACF,OAAA,CAAAO,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CalendarProvider = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _civil = require("./civil.js");
|
|
10
|
+
var _CalendarContext = require("./CalendarContext.js");
|
|
11
|
+
var _CalendarStore = require("./CalendarStore.js");
|
|
12
|
+
var _dateKey = require("./dateKey.js");
|
|
13
|
+
var _motion = require("./motion.js");
|
|
14
|
+
var _TodayButton = require("./TodayButton.js");
|
|
15
|
+
var _index = require("../theme/index.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* The date owner. Compat with `react-native-calendars`' `CalendarProvider`.
|
|
19
|
+
*
|
|
20
|
+
* Two cadences: `setDate` is synchronous (day tap, Today, page settle, the `date`
|
|
21
|
+
* prop) and writes `dayIndex`; `commitDate` is the scroll path, called from a
|
|
22
|
+
* worklet at settle and per month crossing, and leaves `dayIndex` to the
|
|
23
|
+
* scroller that already owns it. Both bump `move` so the OTHER surfaces follow.
|
|
24
|
+
*
|
|
25
|
+
* The prop echo: a controlled caller mirrors every `onDateChanged` back into
|
|
26
|
+
* `date`, and a `runOnJS` commit can land between a render's commit and its
|
|
27
|
+
* effects, so "prop equals current date" is not enough (M5: a fast fling was
|
|
28
|
+
* thrown back a month as `propUpdate`). The provider queues what it emitted; a
|
|
29
|
+
* prop matching a pending emission is an echo and consumes the queue up to it.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** Emissions a caller may leave unechoed before the oldest is forgotten. */
|
|
33
|
+
const MAX_PENDING_ECHOES = 8;
|
|
34
|
+
const CalendarProvider = ({
|
|
35
|
+
range,
|
|
36
|
+
date,
|
|
37
|
+
onDateChanged,
|
|
38
|
+
onMonthChange,
|
|
39
|
+
showTodayButton = false,
|
|
40
|
+
todayBottomMargin = 0,
|
|
41
|
+
todayLabel,
|
|
42
|
+
theme,
|
|
43
|
+
themeBase,
|
|
44
|
+
children
|
|
45
|
+
}) => {
|
|
46
|
+
const [initialIndex] = (0, _react.useState)(() => (0, _dateKey.dayIndexOf)(range, date));
|
|
47
|
+
const store = (0, _CalendarStore.useCreateCalendarStore)(range, initialIndex);
|
|
48
|
+
const dateRef = (0, _react.useRef)(date);
|
|
49
|
+
const pendingEchoesRef = (0, _react.useRef)([]);
|
|
50
|
+
const reduceMotion = (0, _motion.useReduceMotion)();
|
|
51
|
+
const [committed, setCommitted] = (0, _react.useState)(date);
|
|
52
|
+
|
|
53
|
+
// Read through a ref so a caller passing inline arrows, or the setting
|
|
54
|
+
// changing, cannot churn `setDate`'s identity — every scroller holds it.
|
|
55
|
+
const live = (0, _react.useRef)({
|
|
56
|
+
onDateChanged,
|
|
57
|
+
onMonthChange,
|
|
58
|
+
reduceMotion
|
|
59
|
+
});
|
|
60
|
+
live.current.onDateChanged = onDateChanged;
|
|
61
|
+
live.current.onMonthChange = onMonthChange;
|
|
62
|
+
live.current.reduceMotion = reduceMotion;
|
|
63
|
+
(0, _react.useEffect)(() => {
|
|
64
|
+
if (__DEV__ && showTodayButton && !todayLabel) {
|
|
65
|
+
console.warn('[agenda-kit] showTodayButton needs todayLabel; the button is not rendered.');
|
|
66
|
+
}
|
|
67
|
+
}, [showTodayButton, todayLabel]);
|
|
68
|
+
const commitCore = (0, _react.useCallback)((idx, source, writeDayIndex, origin, animated) => {
|
|
69
|
+
const ymd = (0, _dateKey.ymdAt)(range, idx);
|
|
70
|
+
const prev = dateRef.current;
|
|
71
|
+
dateRef.current = ymd;
|
|
72
|
+
const pending = pendingEchoesRef.current;
|
|
73
|
+
pending.push(ymd);
|
|
74
|
+
if (pending.length > MAX_PENDING_ECHOES) pending.shift();
|
|
75
|
+
setCommitted(ymd);
|
|
76
|
+
live.current.onDateChanged?.(ymd, source);
|
|
77
|
+
if ((0, _civil.monthOrdinalOfYmd)(prev) !== (0, _civil.monthOrdinalOfYmd)(ymd)) live.current.onMonthChange?.(ymd, source);
|
|
78
|
+
if (writeDayIndex) store.dayIndex.value = idx;
|
|
79
|
+
store.move.value = {
|
|
80
|
+
seq: store.move.value.seq + 1,
|
|
81
|
+
idx,
|
|
82
|
+
origin,
|
|
83
|
+
animated: animated && !live.current.reduceMotion
|
|
84
|
+
};
|
|
85
|
+
}, [range, store]);
|
|
86
|
+
const setDate = (0, _react.useCallback)((ymd, source, origin = 'external', animated = true) => {
|
|
87
|
+
if (ymd === dateRef.current) return;
|
|
88
|
+
const idx = (0, _dateKey.dayIndexOf)(range, ymd);
|
|
89
|
+
if (Number.isNaN(idx)) return;
|
|
90
|
+
commitCore((0, _dateKey.clampIndex)(range, idx), source, true, origin, animated);
|
|
91
|
+
}, [commitCore, range]);
|
|
92
|
+
const commitDate = (0, _react.useCallback)((idx, source, origin) => {
|
|
93
|
+
const clamped = (0, _dateKey.clampIndex)(range, idx);
|
|
94
|
+
if ((0, _dateKey.ymdAt)(range, clamped) === dateRef.current) return;
|
|
95
|
+
commitCore(clamped, source, false, origin, false);
|
|
96
|
+
}, [commitCore, range]);
|
|
97
|
+
|
|
98
|
+
// A layout effect runs inside the commit, which narrows the race; the queue is
|
|
99
|
+
// what makes it correct. `indexOf` consumes the EARLIEST matching emission.
|
|
100
|
+
(0, _react.useLayoutEffect)(() => {
|
|
101
|
+
const pending = pendingEchoesRef.current;
|
|
102
|
+
const at = pending.indexOf(date);
|
|
103
|
+
if (at >= 0) {
|
|
104
|
+
pending.splice(0, at + 1);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
setDate(date, 'propUpdate');
|
|
108
|
+
}, [date, setDate]);
|
|
109
|
+
const value = (0, _react.useMemo)(() => ({
|
|
110
|
+
range,
|
|
111
|
+
store,
|
|
112
|
+
dateRef,
|
|
113
|
+
setDate,
|
|
114
|
+
commitDate,
|
|
115
|
+
reduceMotion
|
|
116
|
+
}), [range, store, setDate, commitDate, reduceMotion]);
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.AgendaKitThemeProvider, {
|
|
118
|
+
theme: theme,
|
|
119
|
+
base: themeBase,
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContext.CalendarContext.Provider, {
|
|
121
|
+
value: value,
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContext.CalendarDateContext.Provider, {
|
|
123
|
+
value: committed,
|
|
124
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
125
|
+
style: styles.wrapper,
|
|
126
|
+
children: [children, showTodayButton && todayLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_TodayButton.TodayButton, {
|
|
127
|
+
label: todayLabel,
|
|
128
|
+
bottomMargin: todayBottomMargin
|
|
129
|
+
}) : null]
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
exports.CalendarProvider = CalendarProvider;
|
|
136
|
+
const styles = _reactNative.StyleSheet.create({
|
|
137
|
+
wrapper: {
|
|
138
|
+
flex: 1
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=CalendarProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_civil","_CalendarContext","_CalendarStore","_dateKey","_motion","_TodayButton","_index","_jsxRuntime","MAX_PENDING_ECHOES","CalendarProvider","range","date","onDateChanged","onMonthChange","showTodayButton","todayBottomMargin","todayLabel","theme","themeBase","children","initialIndex","useState","dayIndexOf","store","useCreateCalendarStore","dateRef","useRef","pendingEchoesRef","reduceMotion","useReduceMotion","committed","setCommitted","live","current","useEffect","__DEV__","console","warn","commitCore","useCallback","idx","source","writeDayIndex","origin","animated","ymd","ymdAt","prev","pending","push","length","shift","monthOrdinalOfYmd","dayIndex","value","move","seq","setDate","Number","isNaN","clampIndex","commitDate","clamped","useLayoutEffect","at","indexOf","splice","useMemo","jsx","AgendaKitThemeProvider","base","CalendarContext","Provider","CalendarDateContext","jsxs","View","style","styles","wrapper","TodayButton","label","bottomMargin","exports","StyleSheet","create","flex"],"sourceRoot":"../../../src","sources":["core/CalendarProvider.tsx"],"mappings":";;;;;;AAeA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAkD,IAAAS,WAAA,GAAAT,OAAA;AAvBlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA;AACA,MAAMU,kBAAkB,GAAG,CAAC;AAErB,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,KAAK;EACLC,IAAI;EACJC,aAAa;EACbC,aAAa;EACbC,eAAe,GAAG,KAAK;EACvBC,iBAAiB,GAAG,CAAC;EACrBC,UAAU;EACVC,KAAK;EACLC,SAAS;EACTC;AACqB,CAAC,KAAK;EAC3B,MAAM,CAACC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAC,MAAM,IAAAC,mBAAU,EAACZ,KAAK,EAAEC,IAAI,CAAC,CAAC;EAC9D,MAAMY,KAAK,GAAG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ACD,QAAQ;QAAClB,KAAK,EAAExB,SAAU;QAAAX,QAAA,eAC7C,IAAAZ,WAAA,CAAAmE,IAAA,EAAC3E,YAAA,CAAA4E,IAAI;UAACC,KAAK,EAAEC,MAAM,CAACC,OAAQ;UAAA3D,QAAA,GACzBA,QAAQ,EACRL,eAAe,IAAIE,UAAU,gBAC5B,IAAAT,WAAA,CAAA6D,GAAA,EAAC/D,YAAA,CAAA0E,WAAW;YAACC,KAAK,EAAEhE,UAAW;YAACiE,YAAY,EAAElE;UAAkB,CAAE,CAAC,GACjE,IAAI;QAAA,CACJ;MAAC,CACqB;IAAC,CACP;EAAC,CACL,CAAC;AAE7B,CAAC;AAACmE,OAAA,CAAAzE,gBAAA,GAAAA,gBAAA;AAEF,MAAMoE,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,OAAO,EAAE;IAAEO,IAAI,EAAE;EAAE;AACrB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCreateCalendarStore = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
10
|
+
var _dateKey = require("./dateKey.js");
|
|
11
|
+
/**
|
|
12
|
+
* The UI-thread half of the calendar: four shared values, created once.
|
|
13
|
+
*
|
|
14
|
+
* The scroll offset owns position and `dayIndex` is derived from it on the UI
|
|
15
|
+
* thread, so the week strip, the Today button and the sticky header track a
|
|
16
|
+
* fling frame-locked. `move` carries a programmatic move with its `origin`;
|
|
17
|
+
* each scroller ignores its own origin, so a `scrollTo` never echoes back.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SHARED VALUES ONLY. Worklets that read `store.x.value` capture `store`, and
|
|
22
|
+
* react-native-worklets freezes captured objects in `__DEV__`: a plain ref in
|
|
23
|
+
* here silently ignores every write (M2: the echo guard compared against a date
|
|
24
|
+
* frozen at mount). Anything else lives on the provider and the context.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const NO_MOVE = {
|
|
28
|
+
seq: 0,
|
|
29
|
+
idx: 0,
|
|
30
|
+
origin: 'external',
|
|
31
|
+
animated: false
|
|
32
|
+
};
|
|
33
|
+
const useCreateCalendarStore = (range, initialIndex) => {
|
|
34
|
+
const dayIndex = (0, _reactNativeReanimated.useSharedValue)(initialIndex);
|
|
35
|
+
const move = (0, _reactNativeReanimated.useSharedValue)(NO_MOVE);
|
|
36
|
+
const todayIndex = (0, _reactNativeReanimated.useSharedValue)(range.todayIndex);
|
|
37
|
+
const listDragSeq = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
38
|
+
const {
|
|
39
|
+
startEpochDay,
|
|
40
|
+
days
|
|
41
|
+
} = range;
|
|
42
|
+
(0, _react.useEffect)(() => {
|
|
43
|
+
let timer;
|
|
44
|
+
// One timer for the next local midnight, re-armed on foreground: a 24 h
|
|
45
|
+
// interval drifts and fires at the wrong instant after a suspend.
|
|
46
|
+
const refreshAndArm = () => {
|
|
47
|
+
todayIndex.value = (0, _dateKey.todayIndexOf)(startEpochDay, days);
|
|
48
|
+
if (timer) clearTimeout(timer);
|
|
49
|
+
const now = new Date();
|
|
50
|
+
const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 5);
|
|
51
|
+
timer = setTimeout(refreshAndArm, Math.max(1000, next.getTime() - now.getTime()));
|
|
52
|
+
};
|
|
53
|
+
refreshAndArm();
|
|
54
|
+
const sub = _reactNative.AppState.addEventListener('change', state => {
|
|
55
|
+
if (state === 'active') refreshAndArm();
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
if (timer) clearTimeout(timer);
|
|
59
|
+
sub.remove();
|
|
60
|
+
};
|
|
61
|
+
}, [days, startEpochDay, todayIndex]);
|
|
62
|
+
return (0, _react.useState)(() => ({
|
|
63
|
+
dayIndex,
|
|
64
|
+
move,
|
|
65
|
+
todayIndex,
|
|
66
|
+
listDragSeq
|
|
67
|
+
}))[0];
|
|
68
|
+
};
|
|
69
|
+
exports.useCreateCalendarStore = useCreateCalendarStore;
|
|
70
|
+
//# sourceMappingURL=CalendarStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_dateKey","NO_MOVE","seq","idx","origin","animated","useCreateCalendarStore","range","initialIndex","dayIndex","useSharedValue","move","todayIndex","listDragSeq","startEpochDay","days","useEffect","timer","refreshAndArm","value","todayIndexOf","clearTimeout","now","Date","next","getFullYear","getMonth","getDate","setTimeout","Math","max","getTime","sub","AppState","addEventListener","state","remove","useState","exports"],"sourceRoot":"../../../src","sources":["core/CalendarStore.ts"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAYA,MAAMI,OAAqB,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,GAAG,EAAE,CAAC;EAAEC,MAAM,EAAE,UAAU;EAAEC,QAAQ,EAAE;AAAM,CAAC;AAE9E,MAAMC,sBAAsB,GAAGA,CAACC,KAAoB,EAAEC,YAAoB,KAAoB;EACnG,MAAMC,QAAQ,GAAG,IAAAC,qCAAc,EAACF,YAAY,CAAC;EAC7C,MAAMG,IAAI,GAAG,IAAAD,qCAAc,EAAeT,OAAO,CAAC;EAClD,MAAMW,UAAU,GAAG,IAAAF,qCAAc,EAACH,KAAK,CAACK,UAAU,CAAC;EACnD,MAAMC,WAAW,GAAG,IAAAH,qCAAc,EAAC,CAAC,CAAC;EAErC,MAAM;IAAEI,a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A,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.KitText = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
/**
|
|
10
|
+
* Kit text with OS scaling pinned off: row heights are declared, so scaled text
|
|
11
|
+
* would clip in its slot. `Text.defaultProps` is a no-op under React 19.
|
|
12
|
+
*/
|
|
13
|
+
const KitText = ({
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
17
|
+
ref: ref,
|
|
18
|
+
allowFontScaling: false,
|
|
19
|
+
maxFontSizeMultiplier: 1,
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
exports.KitText = KitText;
|
|
23
|
+
//# sourceMappingURL=KitText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_jsxRuntime","KitText","ref","props","jsx","Text","allowFontScaling","maxFontSizeMultiplier","exports"],"sourceRoot":"../../../src","sources":["core/KitText.tsx"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAoD,IAAAC,WAAA,GAAAD,OAAA;AAEpD;AACA;AACA;AACA;AACO,MAAME,OAAO,GAAGA,CAAC;EAAEC,GAAG;EAAE,GAAGC;AAAuC,CAAC,kBACxE,IAAAH,WAAA,CAAAI,GAAA,EAACN,YAAA,CAAAO,IAAI;EAACH,GAAG,EAAEA,GAAI;EAACI,gBAAgB,EAAE,KAAM;EAACC,qBAAqB,EAAE,CAAE;EAAA,GAAKJ;AAAK,CAAG,CAChF;AAACK,OAAA,CAAAP,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TodayButton = void 0;
|
|
7
|
+
var _index = require("../theme/index.js");
|
|
8
|
+
var _tokens = require("../theme/tokens.js");
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
12
|
+
var _ArrowGlyph = require("./ArrowGlyph.js");
|
|
13
|
+
var _CalendarContext = require("./CalendarContext.js");
|
|
14
|
+
var _dateKey = require("./dateKey.js");
|
|
15
|
+
var _KitText = require("./KitText.js");
|
|
16
|
+
var _motion = require("./motion.js");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
/**
|
|
20
|
+
* The Today pill, visible whenever the calendar is not on today: centred, with an
|
|
21
|
+
* arrow pointing the way back to today (the owner's Teams reference, 2026-09-11).
|
|
22
|
+
*
|
|
23
|
+
* Visibility and the arrow's direction are derived on the UI thread from
|
|
24
|
+
* `dayIndex` and `todayIndex`, so the pill appears the frame a fling leaves today
|
|
25
|
+
* and the arrow flips with no React commit. The show/hide animation starts from a
|
|
26
|
+
* reaction that fires only when the boolean flips — `withTiming` returned from
|
|
27
|
+
* `useAnimatedStyle` would restart on every frame of a fling. Hidden means
|
|
28
|
+
* translated off the bottom edge: a transparent pill would still swallow taps.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** The library's non-tablet `todayButton.height`. */const BUTTON_HEIGHT = 28;
|
|
32
|
+
const ARROW_SIZE = 14;
|
|
33
|
+
const TodayButtonInner = ({
|
|
34
|
+
label,
|
|
35
|
+
bottomMargin = 0
|
|
36
|
+
}) => {
|
|
37
|
+
const styles = (0, _index.useKitStyles)(makeStyles);
|
|
38
|
+
const {
|
|
39
|
+
colors
|
|
40
|
+
} = (0, _index.useKitTheme)();
|
|
41
|
+
const {
|
|
42
|
+
range,
|
|
43
|
+
store,
|
|
44
|
+
dateRef,
|
|
45
|
+
setDate,
|
|
46
|
+
reduceMotion
|
|
47
|
+
} = (0, _CalendarContext.useCalendarContext)();
|
|
48
|
+
const duration = (0, _motion.kitDuration)(_tokens.ANIMATION.base, reduceMotion);
|
|
49
|
+
const hiddenOffset = bottomMargin + BUTTON_HEIGHT + _tokens.SPACING[5];
|
|
50
|
+
|
|
51
|
+
// Mount-time seed from plain values (reading a shared value in render is
|
|
52
|
+
// unsupported); the reaction owns every change after that.
|
|
53
|
+
const shown = (0, _reactNativeReanimated.useSharedValue)(range.todayIndex >= 0 && (0, _dateKey.dayIndexOf)(range, dateRef.current) !== range.todayIndex ? 1 : 0);
|
|
54
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => {
|
|
55
|
+
const today = store.todayIndex.value;
|
|
56
|
+
return today >= 0 && store.dayIndex.value !== today ? 1 : 0;
|
|
57
|
+
}, (next, prev) => {
|
|
58
|
+
if (next === prev) return;
|
|
59
|
+
shown.value = (0, _reactNativeReanimated.withTiming)(next, {
|
|
60
|
+
duration,
|
|
61
|
+
easing: _motion.KIT_EASING
|
|
62
|
+
});
|
|
63
|
+
}, [duration]);
|
|
64
|
+
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
65
|
+
opacity: shown.value,
|
|
66
|
+
transform: [{
|
|
67
|
+
translateY: (1 - shown.value) * hiddenOffset
|
|
68
|
+
}]
|
|
69
|
+
}));
|
|
70
|
+
// Up when today lies above the list's day, down when below.
|
|
71
|
+
const arrowStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
72
|
+
transform: [{
|
|
73
|
+
rotate: store.todayIndex.value < store.dayIndex.value ? '0deg' : '180deg'
|
|
74
|
+
}]
|
|
75
|
+
}));
|
|
76
|
+
const onPress = (0, _react.useCallback)(() => {
|
|
77
|
+
const today = store.todayIndex.value;
|
|
78
|
+
if (today >= 0) setDate((0, _dateKey.ymdAt)(range, today), 'todayPress');
|
|
79
|
+
}, [range, setDate, store]);
|
|
80
|
+
const containerStyle = (0, _react.useMemo)(() => [styles.container, {
|
|
81
|
+
bottom: bottomMargin
|
|
82
|
+
}, animatedStyle], [animatedStyle, bottomMargin, styles.container]);
|
|
83
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
84
|
+
pointerEvents: "box-none",
|
|
85
|
+
style: containerStyle,
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
87
|
+
style: styles.button,
|
|
88
|
+
onPress: onPress,
|
|
89
|
+
hitSlop: 8,
|
|
90
|
+
accessibilityRole: "button",
|
|
91
|
+
accessibilityLabel: label,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
93
|
+
style: arrowStyle,
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowGlyph.ArrowGlyph, {
|
|
95
|
+
size: ARROW_SIZE,
|
|
96
|
+
color: colors.accent
|
|
97
|
+
})
|
|
98
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KitText.KitText, {
|
|
99
|
+
style: styles.label,
|
|
100
|
+
numberOfLines: 1,
|
|
101
|
+
children: label
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const TodayButton = exports.TodayButton = /*#__PURE__*/(0, _react.memo)(TodayButtonInner);
|
|
107
|
+
TodayButton.displayName = 'TodayButton';
|
|
108
|
+
const makeStyles = ({
|
|
109
|
+
colors,
|
|
110
|
+
fonts
|
|
111
|
+
}) => _reactNative.StyleSheet.create({
|
|
112
|
+
container: {
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
left: 0,
|
|
115
|
+
right: 0,
|
|
116
|
+
alignItems: 'center'
|
|
117
|
+
},
|
|
118
|
+
button: {
|
|
119
|
+
height: BUTTON_HEIGHT,
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
gap: _tokens.SPACING[1],
|
|
123
|
+
paddingHorizontal: _tokens.SPACING[3],
|
|
124
|
+
borderRadius: _tokens.RADIUS.full,
|
|
125
|
+
borderWidth: 1,
|
|
126
|
+
borderColor: colors.border,
|
|
127
|
+
backgroundColor: colors.surface
|
|
128
|
+
},
|
|
129
|
+
// An action's label: accent INK, never a fill.
|
|
130
|
+
label: {
|
|
131
|
+
fontFamily: fonts.medium,
|
|
132
|
+
fontSize: _tokens.FONT_SIZE.sm,
|
|
133
|
+
color: colors.accent
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=TodayButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_tokens","_react","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_ArrowGlyph","_CalendarContext","_dateKey","_KitText","_motion","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","BUTTON_HEIGHT","ARROW_SIZE","TodayButtonInner","label","bottomMargin","styles","useKitStyles","makeStyles","colors","useKitTheme","range","store","dateRef","setDate","reduceMotion","useCalendarContext","duration","kitDuration","ANIMATION","base","hiddenOffset","SPACING","shown","useSharedValue","todayIndex","dayIndexOf","current","useAnimatedReaction","today","value","dayIndex","next","prev","withTiming","easing","KIT_EASING","animatedStyle","useAnimatedStyle","opacity","transform","translateY","arrowStyle","rotate","onPress","useCallback","ymdAt","containerStyle","useMemo","container","bottom","jsx","View","pointerEvents","style","children","jsxs","Pressable","button","hitSlop","accessibilityRole","accessibilityLabel","ArrowGlyph","size","color","accent","KitText","numberOfLines","TodayButton","exports","memo","displayName","fonts","StyleSheet","create","position","left","right","alignItems","height","flexDirection","gap","paddingHorizontal","borderRadius","RADIUS","full","borderWidth","borderColor","border","backgroundColor","surface","fontFamily","medium","fontSize","FONT_SIZE","sm"],"sourceRoot":"../../../src","sources":["core/TodayButton.tsx"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAC,uBAAA,CAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAK,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK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AI,EAACnE,gBAAgB,CAAC;AACjDiE,WAAW,CAACG,WAAW,GAAG,aAAa;AAEvC,MAAM/D,UAAU,GAAGA,CAAC;EAAEC,MAAM;EAAE+D;AAAoB,CAAC,KACjDC,uBAAU,CAACC,MAAM,CAAC;EAChBzB,SAAS,EAAE;IAAE0B,QAAQ,EAAE,UAAU;IAAEC,IAAI,EAAE,CAAC;IAAEC,KAAK,EAAE,CAAC;IAAEC,UAAU,EAAE;EAAS,CAAC;EAC5EpB,MAAM,EAAE;IACNqB,MAAM,EAAE9E,aAAa;IACrB+E,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,QAAQ;IACpBG,GAAG,EAAE3D,eAAO,CAAC,CAAC,CAAC;IACf4D,iBAAiB,EAAE5D,eAAO,CAAC,CAAC,CAAC;IAC7B6D,YAAY,EAAEC,cAAM,CAACC,IAAI;IACzBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE9E,MAAM,CAAC+E,MAAM;IAC1BC,eAAe,EAAEhF,MAAM,CAACiF;EAC1B,CAAC;EACD;EACAtF,KAAK,EAAE;IAAEuF,UAAU,EAAEnB,KAAK,CAACoB,MAAM;IAAEC,QAAQ,EAAEC,iBAAS,CAACC,EAAE;IAAE/B,KAAK,EAAEvD,MAAM,CAACwD;EAAO;AAClF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ymdOfEpochDay = exports.weekdayOf = exports.todayEpochDay = exports.monthOrdinalOfYmd = exports.epochDayOfYmd = exports.epochDayOfDate = exports.epochDayOf = exports.daysInMonth = exports.civilOf = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Integer civil-date arithmetic: no `Date`, no string splitting, no timezone.
|
|
9
|
+
*
|
|
10
|
+
* An epoch day is the count of days since 1970-01-01 in the proleptic Gregorian
|
|
11
|
+
* calendar. Calendar days are integers here, so a DST transition cannot make two
|
|
12
|
+
* days 23 or 25 hours apart — the bug a `(a - b) / 86400000` calendar has twice
|
|
13
|
+
* a year. Algorithms: H. Hinnant, "chrono-Compatible Low-Level Date Algorithms".
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Epoch day of a civil date. `m` is 1–12. */
|
|
17
|
+
const epochDayOf = (y, m, d) => {
|
|
18
|
+
const yy = m <= 2 ? y - 1 : y;
|
|
19
|
+
const era = Math.floor(yy / 400);
|
|
20
|
+
const yoe = yy - era * 400;
|
|
21
|
+
const doy = Math.floor((153 * ((m + 9) % 12) + 2) / 5) + d - 1;
|
|
22
|
+
const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
|
|
23
|
+
return era * 146097 + doe - 719468;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Civil date of an epoch day, packed as YYYYMMDD so nothing is allocated. */
|
|
27
|
+
exports.epochDayOf = epochDayOf;
|
|
28
|
+
const civilOf = z => {
|
|
29
|
+
const zz = z + 719468;
|
|
30
|
+
const era = Math.floor(zz / 146097);
|
|
31
|
+
const doe = zz - era * 146097;
|
|
32
|
+
const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);
|
|
33
|
+
const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));
|
|
34
|
+
const mp = Math.floor((5 * doy + 2) / 153);
|
|
35
|
+
const d = doy - Math.floor((153 * mp + 2) / 5) + 1;
|
|
36
|
+
const m = mp < 10 ? mp + 3 : mp - 9;
|
|
37
|
+
return (yoe + era * 400 + (m <= 2 ? 1 : 0)) * 10000 + m * 100 + d;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** 0 = Sunday … 6 = Saturday, as `Date#getDay`. 1970-01-01 was a Thursday. */
|
|
41
|
+
exports.civilOf = civilOf;
|
|
42
|
+
const weekdayOf = z => ((z + 4) % 7 + 7) % 7;
|
|
43
|
+
exports.weekdayOf = weekdayOf;
|
|
44
|
+
const isLeap = y => y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
|
|
45
|
+
const MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
46
|
+
const daysInMonth = (y, m) => m === 2 && isLeap(y) ? 29 : MONTH_DAYS[m - 1];
|
|
47
|
+
|
|
48
|
+
/** '00'…'31', so formatting never calls `padStart` or builds a template per part. */
|
|
49
|
+
exports.daysInMonth = daysInMonth;
|
|
50
|
+
const TWO_DIGIT = Array.from({
|
|
51
|
+
length: 32
|
|
52
|
+
}, (_, i) => i < 10 ? `0${i}` : `${i}`);
|
|
53
|
+
|
|
54
|
+
/** 'YYYY-MM-DD' of an epoch day. */
|
|
55
|
+
const ymdOfEpochDay = z => {
|
|
56
|
+
const c = civilOf(z);
|
|
57
|
+
const y = Math.floor(c / 10000);
|
|
58
|
+
return `${y}-${TWO_DIGIT[Math.floor(c / 100) % 100]}-${TWO_DIGIT[c % 100]}`;
|
|
59
|
+
};
|
|
60
|
+
exports.ymdOfEpochDay = ymdOfEpochDay;
|
|
61
|
+
const digit = (s, i) => {
|
|
62
|
+
const c = s.charCodeAt(i) - 48;
|
|
63
|
+
return c >= 0 && c <= 9 ? c : NaN;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Epoch day of 'YYYY-MM-DD' (anything after position 10 is ignored); NaN if malformed. */
|
|
67
|
+
const epochDayOfYmd = s => {
|
|
68
|
+
if (s.length < 10) return NaN;
|
|
69
|
+
const y = digit(s, 0) * 1000 + digit(s, 1) * 100 + digit(s, 2) * 10 + digit(s, 3);
|
|
70
|
+
const m = digit(s, 5) * 10 + digit(s, 6);
|
|
71
|
+
const d = digit(s, 8) * 10 + digit(s, 9);
|
|
72
|
+
return epochDayOf(y, m, d);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** y·12 + (m − 1) of 'YYYY-MM-DD' — a month ordinal that orders and subtracts. */
|
|
76
|
+
exports.epochDayOfYmd = epochDayOfYmd;
|
|
77
|
+
const monthOrdinalOfYmd = s => (digit(s, 0) * 1000 + digit(s, 1) * 100 + digit(s, 2) * 10 + digit(s, 3)) * 12 + digit(s, 5) * 10 + digit(s, 6) - 1;
|
|
78
|
+
|
|
79
|
+
/** Epoch day of a `Date`'s LOCAL calendar day. The one bridge from `Date`. */
|
|
80
|
+
exports.monthOrdinalOfYmd = monthOrdinalOfYmd;
|
|
81
|
+
const epochDayOfDate = d => epochDayOf(d.getFullYear(), d.getMonth() + 1, d.getDate());
|
|
82
|
+
exports.epochDayOfDate = epochDayOfDate;
|
|
83
|
+
let today = {
|
|
84
|
+
epochDay: 0,
|
|
85
|
+
validUntilMs: 0
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Today's epoch day. Cached until local midnight: a hot call is one `Date.now()`, no allocation. */
|
|
89
|
+
const todayEpochDay = () => {
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
if (now >= today.validUntilMs) {
|
|
92
|
+
const d = new Date(now);
|
|
93
|
+
today = {
|
|
94
|
+
epochDay: epochDayOfDate(d),
|
|
95
|
+
validUntilMs: new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1).getTime()
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return today.epochDay;
|
|
99
|
+
};
|
|
100
|
+
exports.todayEpochDay = todayEpochDay;
|
|
101
|
+
//# sourceMappingURL=civil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["epochDayOf","y","m","d","yy","era","Math","floor","yoe","doy","doe","exports","civilOf","z","zz","mp","weekdayOf","isLeap","MONTH_DAYS","daysInMonth","TWO_DIGIT","Array","from","length","_","i","ymdOfEpochDay","c","digit","s","charCodeAt","NaN","epochDayOfYmd","monthOrdinalOfYmd","epochDayOfDate","getFullYear","getMonth","getDate","today","epochDay","validUntilMs","todayEpochDay","now","Date","getTime"],"sourceRo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AAY,EAAE;AAAE,CAAC;;AAE5C;AACO,MAAMC,aAAa,GAAGA,CAAA,KAAc;EACzC,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC;EACtB,IAAIA,GAAG,IAAIJ,KAAK,CAACE,YAAY,EAAE;IAC7B,MAAMrC,CAAC,GAAG,IAAIwC,IAAI,CAACD,GAAG,CAAC;IACvBJ,KAAK,GAAG;MACNC,QAAQ,EAAEL,cAAc,CAAC/B,CAAC,CAAC;MAC3BqC,YAAY,EAAE,IAAIG,IAAI,CAACxC,CAAC,CAACgC,WAAW,CAAC,CAAC,EAAEhC,CAAC,CAACiC,QAAQ,CAAC,CAAC,EAAEjC,CAAC,CAACkC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAACO,OAAO,CAAC;IACjF,CAAC;EACH;EACA,OAAON,KAAK,CAACC,QAAQ;AACvB,CAAC;AAAC5B,OAAA,CAAA8B,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ymdAt = exports.todayIndexOf = exports.dayIndexOf = exports.clampIndex = exports.buildRange = void 0;
|
|
7
|
+
var _civil = require("./civil.js");
|
|
8
|
+
/**
|
|
9
|
+
* The one translation between the kit's integer index space and 'YYYY-MM-DD'.
|
|
10
|
+
*
|
|
11
|
+
* Every surface addresses a day as `dayIndex`, an offset from `range.start`.
|
|
12
|
+
* `buildRange` pays for the strings once; after that both directions are O(1)
|
|
13
|
+
* and allocation-free: `dayIndexOf` is a subtraction, `ymdAt` an array read.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Index of `ymd` within `range`. May fall outside `[0, days)`; NaN if malformed. */
|
|
17
|
+
const dayIndexOf = (range, ymd) => (0, _civil.epochDayOfYmd)(ymd) - range.startEpochDay;
|
|
18
|
+
|
|
19
|
+
/** 'YYYY-MM-DD' at `idx`. Defined for any integer; callers clamp first. */
|
|
20
|
+
exports.dayIndexOf = dayIndexOf;
|
|
21
|
+
const ymdAt = (range, idx) => range.ymdByIndex[idx] ?? (0, _civil.ymdOfEpochDay)(range.startEpochDay + idx);
|
|
22
|
+
|
|
23
|
+
/** The single gating predicate: an index is selectable iff clamping leaves it alone. */
|
|
24
|
+
exports.ymdAt = ymdAt;
|
|
25
|
+
const clampIndex = (range, idx) => idx < range.minIndex ? range.minIndex : idx > range.maxIndex ? range.maxIndex : idx;
|
|
26
|
+
exports.clampIndex = clampIndex;
|
|
27
|
+
const todayIndexOf = (startEpochDay, days) => {
|
|
28
|
+
const i = (0, _civil.todayEpochDay)() - startEpochDay;
|
|
29
|
+
return i >= 0 && i < days ? i : -1;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `start` is pushed back to the `firstDay` week boundary and `days` rounded up
|
|
34
|
+
* to whole weeks, so `floor(dayIndex / 7)` is always a week page.
|
|
35
|
+
*/
|
|
36
|
+
exports.todayIndexOf = todayIndexOf;
|
|
37
|
+
const buildRange = (minDate, maxDate, firstDay = 1) => {
|
|
38
|
+
const min = (0, _civil.epochDayOfDate)(minDate);
|
|
39
|
+
const max = (0, _civil.epochDayOfDate)(maxDate);
|
|
40
|
+
const startEpochDay = min - ((0, _civil.weekdayOf)(min) - firstDay + 7) % 7;
|
|
41
|
+
const days = Math.ceil((max - startEpochDay + 1) / 7) * 7;
|
|
42
|
+
const ymdByIndex = new Array(days);
|
|
43
|
+
for (let i = 0; i < days; i += 1) ymdByIndex[i] = (0, _civil.ymdOfEpochDay)(startEpochDay + i);
|
|
44
|
+
return {
|
|
45
|
+
start: ymdByIndex[0],
|
|
46
|
+
startEpochDay,
|
|
47
|
+
ymdByIndex,
|
|
48
|
+
days,
|
|
49
|
+
minIndex: min - startEpochDay,
|
|
50
|
+
maxIndex: max - startEpochDay,
|
|
51
|
+
firstDay,
|
|
52
|
+
todayIndex: todayIndexOf(startEpochDay, days)
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.buildRange = buildRange;
|
|
56
|
+
//# sourceMappingURL=dateKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_civil","require","dayIndexOf","range","ymd","epochDayOfYmd","startEpochDay","exports","ymdAt","idx","ymdByIndex","ymdOfEpochDay","clampIndex","minIndex","maxIndex","todayIndexOf","days","i","todayEpochDay","buildRange","minDate","maxDate","firstDay","min","epochDayOfDate","max","weekdayOf","Math","ceil","Array","start","todayIndex"],"sourceRoot":"../../../src","sources":["core/dateKey.ts"],"mappings":";;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACO,MAAMC,UAAU,GAAGA,CAACC,KAAoB,EAAEC,GAAe,KAC9D,IAAAC,oBAAa,EAACD,GAAG,CAAC,GAAGD,KAAK,CAACG,aAAa;;AAE1C;AAAAC,OAAA,CAAAL,UAAA,GAAAA,UAAA;AACO,MAAMM,KAAK,GAAGA,CAACL,KAAoB,EAAEM,GAAW,KACrDN,KAAK,CAACO,UAAU,CAACD,GAAG,CAAC,IAAI,IAAAE,oBAAa,EAACR,KAAK,CAACG,aAAa,GAAGG,GAAG,CAAC;;AAEnE;AAAAF,OAAA,CAAAC,KAAA,GAAAA,KAAA;AACO,MAAMI,UAAU,GAAGA,CAACT,KAAoB,EAAEM,GAAW,KAC1DA,GAAG,GAAGN,KAAK,CAACU,QAAQ,GAAGV,KAAK,CAACU,QAAQ,GAAGJ,GAAG,GAAGN,KAAK,CAACW,QAAQ,GAAGX,KAAK,CAACW,QAAQ,GAAGL,GAAG;AAACF,OAAA,CAAAK,UAAA,GAAAA,UAAA;AAE/E,MAAMG,YAAY,GAAGA,CAACT,aAAqB,EAAEU,IAAY,KAAa;EAC3E,MAAMC,CAAC,GAAG,IAAAC,oBAAa,EAAC,CAAC,GAAGZ,aA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