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.
Files changed (403) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +364 -0
  3. package/lib/commonjs/agenda/AgendaBackdrop.js +68 -0
  4. package/lib/commonjs/agenda/AgendaBackdrop.js.map +1 -0
  5. package/lib/commonjs/agenda/AgendaList.js +354 -0
  6. package/lib/commonjs/agenda/AgendaList.js.map +1 -0
  7. package/lib/commonjs/agenda/AgendaSlot.js +88 -0
  8. package/lib/commonjs/agenda/AgendaSlot.js.map +1 -0
  9. package/lib/commonjs/agenda/AgendaWindow.js +171 -0
  10. package/lib/commonjs/agenda/AgendaWindow.js.map +1 -0
  11. package/lib/commonjs/agenda/StickyHeaderOverlay.js +125 -0
  12. package/lib/commonjs/agenda/StickyHeaderOverlay.js.map +1 -0
  13. package/lib/commonjs/agenda/buildAgendaLayout.js +100 -0
  14. package/lib/commonjs/agenda/buildAgendaLayout.js.map +1 -0
  15. package/lib/commonjs/agenda/constants.js +29 -0
  16. package/lib/commonjs/agenda/constants.js.map +1 -0
  17. package/lib/commonjs/agenda/heights.js +49 -0
  18. package/lib/commonjs/agenda/heights.js.map +1 -0
  19. package/lib/commonjs/agenda/useAgendaScrollSync.js +204 -0
  20. package/lib/commonjs/agenda/useAgendaScrollSync.js.map +1 -0
  21. package/lib/commonjs/core/ArrowGlyph.js +65 -0
  22. package/lib/commonjs/core/ArrowGlyph.js.map +1 -0
  23. package/lib/commonjs/core/CalendarContext.js +32 -0
  24. package/lib/commonjs/core/CalendarContext.js.map +1 -0
  25. package/lib/commonjs/core/CalendarProvider.js +141 -0
  26. package/lib/commonjs/core/CalendarProvider.js.map +1 -0
  27. package/lib/commonjs/core/CalendarStore.js +70 -0
  28. package/lib/commonjs/core/CalendarStore.js.map +1 -0
  29. package/lib/commonjs/core/KitText.js +23 -0
  30. package/lib/commonjs/core/KitText.js.map +1 -0
  31. package/lib/commonjs/core/TodayButton.js +136 -0
  32. package/lib/commonjs/core/TodayButton.js.map +1 -0
  33. package/lib/commonjs/core/civil.js +101 -0
  34. package/lib/commonjs/core/civil.js.map +1 -0
  35. package/lib/commonjs/core/dateKey.js +56 -0
  36. package/lib/commonjs/core/dateKey.js.map +1 -0
  37. package/lib/commonjs/core/motion.js +56 -0
  38. package/lib/commonjs/core/motion.js.map +1 -0
  39. package/lib/commonjs/core/worklets.js +44 -0
  40. package/lib/commonjs/core/worklets.js.map +1 -0
  41. package/lib/commonjs/expandable/DayCell.js +120 -0
  42. package/lib/commonjs/expandable/DayCell.js.map +1 -0
  43. package/lib/commonjs/expandable/ExpandableCalendar.js +280 -0
  44. package/lib/commonjs/expandable/ExpandableCalendar.js.map +1 -0
  45. package/lib/commonjs/expandable/Knob.js +72 -0
  46. package/lib/commonjs/expandable/Knob.js.map +1 -0
  47. package/lib/commonjs/expandable/MonthPager.js +180 -0
  48. package/lib/commonjs/expandable/MonthPager.js.map +1 -0
  49. package/lib/commonjs/expandable/WeekStrip.js +451 -0
  50. package/lib/commonjs/expandable/WeekStrip.js.map +1 -0
  51. package/lib/commonjs/expandable/calendarCells.js +152 -0
  52. package/lib/commonjs/expandable/calendarCells.js.map +1 -0
  53. package/lib/commonjs/expandable/geometry.js +62 -0
  54. package/lib/commonjs/expandable/geometry.js.map +1 -0
  55. package/lib/commonjs/expandable/useExpandGesture.js +124 -0
  56. package/lib/commonjs/expandable/useExpandGesture.js.map +1 -0
  57. package/lib/commonjs/expandable/useHorizontalPager.js +97 -0
  58. package/lib/commonjs/expandable/useHorizontalPager.js.map +1 -0
  59. package/lib/commonjs/index.js +167 -0
  60. package/lib/commonjs/index.js.map +1 -0
  61. package/lib/commonjs/package.json +1 -0
  62. package/lib/commonjs/theme/ThemeProvider.js +73 -0
  63. package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
  64. package/lib/commonjs/theme/index.js +75 -0
  65. package/lib/commonjs/theme/index.js.map +1 -0
  66. package/lib/commonjs/theme/theme.js +79 -0
  67. package/lib/commonjs/theme/theme.js.map +1 -0
  68. package/lib/commonjs/theme/tokens.js +54 -0
  69. package/lib/commonjs/theme/tokens.js.map +1 -0
  70. package/lib/commonjs/timeline/DayColumn.js +95 -0
  71. package/lib/commonjs/timeline/DayColumn.js.map +1 -0
  72. package/lib/commonjs/timeline/DayPager.js +250 -0
  73. package/lib/commonjs/timeline/DayPager.js.map +1 -0
  74. package/lib/commonjs/timeline/EventBlock.js +91 -0
  75. package/lib/commonjs/timeline/EventBlock.js.map +1 -0
  76. package/lib/commonjs/timeline/GridLines.js +47 -0
  77. package/lib/commonjs/timeline/GridLines.js.map +1 -0
  78. package/lib/commonjs/timeline/HourGrid.js +96 -0
  79. package/lib/commonjs/timeline/HourGrid.js.map +1 -0
  80. package/lib/commonjs/timeline/NowIndicator.js +132 -0
  81. package/lib/commonjs/timeline/NowIndicator.js.map +1 -0
  82. package/lib/commonjs/timeline/TimelineDay.js +126 -0
  83. package/lib/commonjs/timeline/TimelineDay.js.map +1 -0
  84. package/lib/commonjs/timeline/packEvents.js +102 -0
  85. package/lib/commonjs/timeline/packEvents.js.map +1 -0
  86. package/lib/commonjs/timeline/timelineGeometry.js +27 -0
  87. package/lib/commonjs/timeline/timelineGeometry.js.map +1 -0
  88. package/lib/commonjs/timeline/timelineMath.js +82 -0
  89. package/lib/commonjs/timeline/timelineMath.js.map +1 -0
  90. package/lib/commonjs/types.js +71 -0
  91. package/lib/commonjs/types.js.map +1 -0
  92. package/lib/module/agenda/AgendaBackdrop.js +63 -0
  93. package/lib/module/agenda/AgendaBackdrop.js.map +1 -0
  94. package/lib/module/agenda/AgendaList.js +349 -0
  95. package/lib/module/agenda/AgendaList.js.map +1 -0
  96. package/lib/module/agenda/AgendaSlot.js +84 -0
  97. package/lib/module/agenda/AgendaSlot.js.map +1 -0
  98. package/lib/module/agenda/AgendaWindow.js +167 -0
  99. package/lib/module/agenda/AgendaWindow.js.map +1 -0
  100. package/lib/module/agenda/StickyHeaderOverlay.js +120 -0
  101. package/lib/module/agenda/StickyHeaderOverlay.js.map +1 -0
  102. package/lib/module/agenda/buildAgendaLayout.js +95 -0
  103. package/lib/module/agenda/buildAgendaLayout.js.map +1 -0
  104. package/lib/module/agenda/constants.js +25 -0
  105. package/lib/module/agenda/constants.js.map +1 -0
  106. package/lib/module/agenda/heights.js +42 -0
  107. package/lib/module/agenda/heights.js.map +1 -0
  108. package/lib/module/agenda/useAgendaScrollSync.js +200 -0
  109. package/lib/module/agenda/useAgendaScrollSync.js.map +1 -0
  110. package/lib/module/core/ArrowGlyph.js +60 -0
  111. package/lib/module/core/ArrowGlyph.js.map +1 -0
  112. package/lib/module/core/CalendarContext.js +26 -0
  113. package/lib/module/core/CalendarContext.js.map +1 -0
  114. package/lib/module/core/CalendarProvider.js +136 -0
  115. package/lib/module/core/CalendarProvider.js.map +1 -0
  116. package/lib/module/core/CalendarStore.js +66 -0
  117. package/lib/module/core/CalendarStore.js.map +1 -0
  118. package/lib/module/core/KitText.js +19 -0
  119. package/lib/module/core/KitText.js.map +1 -0
  120. package/lib/module/core/TodayButton.js +133 -0
  121. package/lib/module/core/TodayButton.js.map +1 -0
  122. package/lib/module/core/civil.js +88 -0
  123. package/lib/module/core/civil.js.map +1 -0
  124. package/lib/module/core/dateKey.js +47 -0
  125. package/lib/module/core/dateKey.js.map +1 -0
  126. package/lib/module/core/motion.js +49 -0
  127. package/lib/module/core/motion.js.map +1 -0
  128. package/lib/module/core/worklets.js +38 -0
  129. package/lib/module/core/worklets.js.map +1 -0
  130. package/lib/module/expandable/DayCell.js +116 -0
  131. package/lib/module/expandable/DayCell.js.map +1 -0
  132. package/lib/module/expandable/ExpandableCalendar.js +275 -0
  133. package/lib/module/expandable/ExpandableCalendar.js.map +1 -0
  134. package/lib/module/expandable/Knob.js +67 -0
  135. package/lib/module/expandable/Knob.js.map +1 -0
  136. package/lib/module/expandable/MonthPager.js +175 -0
  137. package/lib/module/expandable/MonthPager.js.map +1 -0
  138. package/lib/module/expandable/WeekStrip.js +446 -0
  139. package/lib/module/expandable/WeekStrip.js.map +1 -0
  140. package/lib/module/expandable/calendarCells.js +142 -0
  141. package/lib/module/expandable/calendarCells.js.map +1 -0
  142. package/lib/module/expandable/geometry.js +58 -0
  143. package/lib/module/expandable/geometry.js.map +1 -0
  144. package/lib/module/expandable/useExpandGesture.js +118 -0
  145. package/lib/module/expandable/useExpandGesture.js.map +1 -0
  146. package/lib/module/expandable/useHorizontalPager.js +92 -0
  147. package/lib/module/expandable/useHorizontalPager.js.map +1 -0
  148. package/lib/module/index.js +35 -0
  149. package/lib/module/index.js.map +1 -0
  150. package/lib/module/package.json +1 -0
  151. package/lib/module/theme/ThemeProvider.js +65 -0
  152. package/lib/module/theme/ThemeProvider.js.map +1 -0
  153. package/lib/module/theme/index.js +6 -0
  154. package/lib/module/theme/index.js.map +1 -0
  155. package/lib/module/theme/theme.js +74 -0
  156. package/lib/module/theme/theme.js.map +1 -0
  157. package/lib/module/theme/tokens.js +50 -0
  158. package/lib/module/theme/tokens.js.map +1 -0
  159. package/lib/module/timeline/DayColumn.js +91 -0
  160. package/lib/module/timeline/DayColumn.js.map +1 -0
  161. package/lib/module/timeline/DayPager.js +245 -0
  162. package/lib/module/timeline/DayPager.js.map +1 -0
  163. package/lib/module/timeline/EventBlock.js +87 -0
  164. package/lib/module/timeline/EventBlock.js.map +1 -0
  165. package/lib/module/timeline/GridLines.js +43 -0
  166. package/lib/module/timeline/GridLines.js.map +1 -0
  167. package/lib/module/timeline/HourGrid.js +94 -0
  168. package/lib/module/timeline/HourGrid.js.map +1 -0
  169. package/lib/module/timeline/NowIndicator.js +126 -0
  170. package/lib/module/timeline/NowIndicator.js.map +1 -0
  171. package/lib/module/timeline/TimelineDay.js +122 -0
  172. package/lib/module/timeline/TimelineDay.js.map +1 -0
  173. package/lib/module/timeline/packEvents.js +97 -0
  174. package/lib/module/timeline/packEvents.js.map +1 -0
  175. package/lib/module/timeline/timelineGeometry.js +22 -0
  176. package/lib/module/timeline/timelineGeometry.js.map +1 -0
  177. package/lib/module/timeline/timelineMath.js +75 -0
  178. package/lib/module/timeline/timelineMath.js.map +1 -0
  179. package/lib/module/types.js +67 -0
  180. package/lib/module/types.js.map +1 -0
  181. package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts +20 -0
  182. package/lib/typescript/commonjs/agenda/AgendaBackdrop.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/agenda/AgendaList.d.ts +12 -0
  184. package/lib/typescript/commonjs/agenda/AgendaList.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts +45 -0
  186. package/lib/typescript/commonjs/agenda/AgendaSlot.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts +49 -0
  188. package/lib/typescript/commonjs/agenda/AgendaWindow.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts +39 -0
  190. package/lib/typescript/commonjs/agenda/StickyHeaderOverlay.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts +57 -0
  192. package/lib/typescript/commonjs/agenda/buildAgendaLayout.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/agenda/constants.d.ts +19 -0
  194. package/lib/typescript/commonjs/agenda/constants.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/agenda/heights.d.ts +20 -0
  196. package/lib/typescript/commonjs/agenda/heights.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts +44 -0
  198. package/lib/typescript/commonjs/agenda/useAgendaScrollSync.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/core/ArrowGlyph.d.ts +14 -0
  200. package/lib/typescript/commonjs/core/ArrowGlyph.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/core/CalendarContext.d.ts +35 -0
  202. package/lib/typescript/commonjs/core/CalendarContext.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/core/CalendarProvider.d.ts +41 -0
  204. package/lib/typescript/commonjs/core/CalendarProvider.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/core/CalendarStore.d.ts +28 -0
  206. package/lib/typescript/commonjs/core/CalendarStore.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/core/KitText.d.ts +10 -0
  208. package/lib/typescript/commonjs/core/KitText.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/core/TodayButton.d.ts +18 -0
  210. package/lib/typescript/commonjs/core/TodayButton.d.ts.map +1 -0
  211. package/lib/typescript/commonjs/core/civil.d.ts +26 -0
  212. package/lib/typescript/commonjs/core/civil.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/core/dateKey.d.ts +21 -0
  214. package/lib/typescript/commonjs/core/dateKey.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/core/motion.d.ts +18 -0
  216. package/lib/typescript/commonjs/core/motion.d.ts.map +1 -0
  217. package/lib/typescript/commonjs/core/worklets.d.ts +12 -0
  218. package/lib/typescript/commonjs/core/worklets.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/expandable/DayCell.d.ts +22 -0
  220. package/lib/typescript/commonjs/expandable/DayCell.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts +40 -0
  222. package/lib/typescript/commonjs/expandable/ExpandableCalendar.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/expandable/Knob.d.ts +19 -0
  224. package/lib/typescript/commonjs/expandable/Knob.d.ts.map +1 -0
  225. package/lib/typescript/commonjs/expandable/MonthPager.d.ts +35 -0
  226. package/lib/typescript/commonjs/expandable/MonthPager.d.ts.map +1 -0
  227. package/lib/typescript/commonjs/expandable/WeekStrip.d.ts +34 -0
  228. package/lib/typescript/commonjs/expandable/WeekStrip.d.ts.map +1 -0
  229. package/lib/typescript/commonjs/expandable/calendarCells.d.ts +52 -0
  230. package/lib/typescript/commonjs/expandable/calendarCells.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/expandable/geometry.d.ts +43 -0
  232. package/lib/typescript/commonjs/expandable/geometry.d.ts.map +1 -0
  233. package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts +35 -0
  234. package/lib/typescript/commonjs/expandable/useExpandGesture.d.ts.map +1 -0
  235. package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts +35 -0
  236. package/lib/typescript/commonjs/expandable/useHorizontalPager.d.ts.map +1 -0
  237. package/lib/typescript/commonjs/index.d.ts +26 -0
  238. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  239. package/lib/typescript/commonjs/package.json +1 -0
  240. package/lib/typescript/commonjs/theme/ThemeProvider.d.ts +27 -0
  241. package/lib/typescript/commonjs/theme/ThemeProvider.d.ts.map +1 -0
  242. package/lib/typescript/commonjs/theme/index.d.ts +4 -0
  243. package/lib/typescript/commonjs/theme/index.d.ts.map +1 -0
  244. package/lib/typescript/commonjs/theme/theme.d.ts +62 -0
  245. package/lib/typescript/commonjs/theme/theme.d.ts.map +1 -0
  246. package/lib/typescript/commonjs/theme/tokens.d.ts +46 -0
  247. package/lib/typescript/commonjs/theme/tokens.d.ts.map +1 -0
  248. package/lib/typescript/commonjs/timeline/DayColumn.d.ts +32 -0
  249. package/lib/typescript/commonjs/timeline/DayColumn.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/timeline/DayPager.d.ts +32 -0
  251. package/lib/typescript/commonjs/timeline/DayPager.d.ts.map +1 -0
  252. package/lib/typescript/commonjs/timeline/EventBlock.d.ts +17 -0
  253. package/lib/typescript/commonjs/timeline/EventBlock.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/timeline/GridLines.d.ts +5 -0
  255. package/lib/typescript/commonjs/timeline/GridLines.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/timeline/HourGrid.d.ts +12 -0
  257. package/lib/typescript/commonjs/timeline/HourGrid.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/timeline/NowIndicator.d.ts +28 -0
  259. package/lib/typescript/commonjs/timeline/NowIndicator.d.ts.map +1 -0
  260. package/lib/typescript/commonjs/timeline/TimelineDay.d.ts +14 -0
  261. package/lib/typescript/commonjs/timeline/TimelineDay.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/timeline/packEvents.d.ts +25 -0
  263. package/lib/typescript/commonjs/timeline/packEvents.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts +14 -0
  265. package/lib/typescript/commonjs/timeline/timelineGeometry.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/timeline/timelineMath.d.ts +32 -0
  267. package/lib/typescript/commonjs/timeline/timelineMath.d.ts.map +1 -0
  268. package/lib/typescript/commonjs/types.d.ts +237 -0
  269. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  270. package/lib/typescript/module/agenda/AgendaBackdrop.d.ts +20 -0
  271. package/lib/typescript/module/agenda/AgendaBackdrop.d.ts.map +1 -0
  272. package/lib/typescript/module/agenda/AgendaList.d.ts +12 -0
  273. package/lib/typescript/module/agenda/AgendaList.d.ts.map +1 -0
  274. package/lib/typescript/module/agenda/AgendaSlot.d.ts +45 -0
  275. package/lib/typescript/module/agenda/AgendaSlot.d.ts.map +1 -0
  276. package/lib/typescript/module/agenda/AgendaWindow.d.ts +49 -0
  277. package/lib/typescript/module/agenda/AgendaWindow.d.ts.map +1 -0
  278. package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts +39 -0
  279. package/lib/typescript/module/agenda/StickyHeaderOverlay.d.ts.map +1 -0
  280. package/lib/typescript/module/agenda/buildAgendaLayout.d.ts +57 -0
  281. package/lib/typescript/module/agenda/buildAgendaLayout.d.ts.map +1 -0
  282. package/lib/typescript/module/agenda/constants.d.ts +19 -0
  283. package/lib/typescript/module/agenda/constants.d.ts.map +1 -0
  284. package/lib/typescript/module/agenda/heights.d.ts +20 -0
  285. package/lib/typescript/module/agenda/heights.d.ts.map +1 -0
  286. package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts +44 -0
  287. package/lib/typescript/module/agenda/useAgendaScrollSync.d.ts.map +1 -0
  288. package/lib/typescript/module/core/ArrowGlyph.d.ts +14 -0
  289. package/lib/typescript/module/core/ArrowGlyph.d.ts.map +1 -0
  290. package/lib/typescript/module/core/CalendarContext.d.ts +35 -0
  291. package/lib/typescript/module/core/CalendarContext.d.ts.map +1 -0
  292. package/lib/typescript/module/core/CalendarProvider.d.ts +41 -0
  293. package/lib/typescript/module/core/CalendarProvider.d.ts.map +1 -0
  294. package/lib/typescript/module/core/CalendarStore.d.ts +28 -0
  295. package/lib/typescript/module/core/CalendarStore.d.ts.map +1 -0
  296. package/lib/typescript/module/core/KitText.d.ts +10 -0
  297. package/lib/typescript/module/core/KitText.d.ts.map +1 -0
  298. package/lib/typescript/module/core/TodayButton.d.ts +18 -0
  299. package/lib/typescript/module/core/TodayButton.d.ts.map +1 -0
  300. package/lib/typescript/module/core/civil.d.ts +26 -0
  301. package/lib/typescript/module/core/civil.d.ts.map +1 -0
  302. package/lib/typescript/module/core/dateKey.d.ts +21 -0
  303. package/lib/typescript/module/core/dateKey.d.ts.map +1 -0
  304. package/lib/typescript/module/core/motion.d.ts +18 -0
  305. package/lib/typescript/module/core/motion.d.ts.map +1 -0
  306. package/lib/typescript/module/core/worklets.d.ts +12 -0
  307. package/lib/typescript/module/core/worklets.d.ts.map +1 -0
  308. package/lib/typescript/module/expandable/DayCell.d.ts +22 -0
  309. package/lib/typescript/module/expandable/DayCell.d.ts.map +1 -0
  310. package/lib/typescript/module/expandable/ExpandableCalendar.d.ts +40 -0
  311. package/lib/typescript/module/expandable/ExpandableCalendar.d.ts.map +1 -0
  312. package/lib/typescript/module/expandable/Knob.d.ts +19 -0
  313. package/lib/typescript/module/expandable/Knob.d.ts.map +1 -0
  314. package/lib/typescript/module/expandable/MonthPager.d.ts +35 -0
  315. package/lib/typescript/module/expandable/MonthPager.d.ts.map +1 -0
  316. package/lib/typescript/module/expandable/WeekStrip.d.ts +34 -0
  317. package/lib/typescript/module/expandable/WeekStrip.d.ts.map +1 -0
  318. package/lib/typescript/module/expandable/calendarCells.d.ts +52 -0
  319. package/lib/typescript/module/expandable/calendarCells.d.ts.map +1 -0
  320. package/lib/typescript/module/expandable/geometry.d.ts +43 -0
  321. package/lib/typescript/module/expandable/geometry.d.ts.map +1 -0
  322. package/lib/typescript/module/expandable/useExpandGesture.d.ts +35 -0
  323. package/lib/typescript/module/expandable/useExpandGesture.d.ts.map +1 -0
  324. package/lib/typescript/module/expandable/useHorizontalPager.d.ts +35 -0
  325. package/lib/typescript/module/expandable/useHorizontalPager.d.ts.map +1 -0
  326. package/lib/typescript/module/index.d.ts +26 -0
  327. package/lib/typescript/module/index.d.ts.map +1 -0
  328. package/lib/typescript/module/package.json +1 -0
  329. package/lib/typescript/module/theme/ThemeProvider.d.ts +27 -0
  330. package/lib/typescript/module/theme/ThemeProvider.d.ts.map +1 -0
  331. package/lib/typescript/module/theme/index.d.ts +4 -0
  332. package/lib/typescript/module/theme/index.d.ts.map +1 -0
  333. package/lib/typescript/module/theme/theme.d.ts +62 -0
  334. package/lib/typescript/module/theme/theme.d.ts.map +1 -0
  335. package/lib/typescript/module/theme/tokens.d.ts +46 -0
  336. package/lib/typescript/module/theme/tokens.d.ts.map +1 -0
  337. package/lib/typescript/module/timeline/DayColumn.d.ts +32 -0
  338. package/lib/typescript/module/timeline/DayColumn.d.ts.map +1 -0
  339. package/lib/typescript/module/timeline/DayPager.d.ts +32 -0
  340. package/lib/typescript/module/timeline/DayPager.d.ts.map +1 -0
  341. package/lib/typescript/module/timeline/EventBlock.d.ts +17 -0
  342. package/lib/typescript/module/timeline/EventBlock.d.ts.map +1 -0
  343. package/lib/typescript/module/timeline/GridLines.d.ts +5 -0
  344. package/lib/typescript/module/timeline/GridLines.d.ts.map +1 -0
  345. package/lib/typescript/module/timeline/HourGrid.d.ts +12 -0
  346. package/lib/typescript/module/timeline/HourGrid.d.ts.map +1 -0
  347. package/lib/typescript/module/timeline/NowIndicator.d.ts +28 -0
  348. package/lib/typescript/module/timeline/NowIndicator.d.ts.map +1 -0
  349. package/lib/typescript/module/timeline/TimelineDay.d.ts +14 -0
  350. package/lib/typescript/module/timeline/TimelineDay.d.ts.map +1 -0
  351. package/lib/typescript/module/timeline/packEvents.d.ts +25 -0
  352. package/lib/typescript/module/timeline/packEvents.d.ts.map +1 -0
  353. package/lib/typescript/module/timeline/timelineGeometry.d.ts +14 -0
  354. package/lib/typescript/module/timeline/timelineGeometry.d.ts.map +1 -0
  355. package/lib/typescript/module/timeline/timelineMath.d.ts +32 -0
  356. package/lib/typescript/module/timeline/timelineMath.d.ts.map +1 -0
  357. package/lib/typescript/module/types.d.ts +237 -0
  358. package/lib/typescript/module/types.d.ts.map +1 -0
  359. package/package.json +105 -0
  360. package/src/agenda/AgendaBackdrop.tsx +55 -0
  361. package/src/agenda/AgendaList.tsx +370 -0
  362. package/src/agenda/AgendaSlot.tsx +88 -0
  363. package/src/agenda/AgendaWindow.tsx +183 -0
  364. package/src/agenda/StickyHeaderOverlay.tsx +126 -0
  365. package/src/agenda/buildAgendaLayout.ts +110 -0
  366. package/src/agenda/constants.ts +22 -0
  367. package/src/agenda/heights.ts +44 -0
  368. package/src/agenda/useAgendaScrollSync.ts +251 -0
  369. package/src/core/ArrowGlyph.tsx +53 -0
  370. package/src/core/CalendarContext.ts +47 -0
  371. package/src/core/CalendarProvider.tsx +165 -0
  372. package/src/core/CalendarStore.ts +64 -0
  373. package/src/core/KitText.tsx +10 -0
  374. package/src/core/TodayButton.tsx +121 -0
  375. package/src/core/civil.ts +92 -0
  376. package/src/core/dateKey.ts +52 -0
  377. package/src/core/motion.ts +51 -0
  378. package/src/core/worklets.ts +37 -0
  379. package/src/expandable/DayCell.tsx +97 -0
  380. package/src/expandable/ExpandableCalendar.tsx +278 -0
  381. package/src/expandable/Knob.tsx +67 -0
  382. package/src/expandable/MonthPager.tsx +208 -0
  383. package/src/expandable/WeekStrip.tsx +439 -0
  384. package/src/expandable/calendarCells.ts +155 -0
  385. package/src/expandable/geometry.ts +51 -0
  386. package/src/expandable/useExpandGesture.ts +147 -0
  387. package/src/expandable/useHorizontalPager.ts +116 -0
  388. package/src/index.ts +62 -0
  389. package/src/theme/ThemeProvider.tsx +85 -0
  390. package/src/theme/index.ts +18 -0
  391. package/src/theme/theme.ts +110 -0
  392. package/src/theme/tokens.ts +50 -0
  393. package/src/timeline/DayColumn.tsx +84 -0
  394. package/src/timeline/DayPager.tsx +295 -0
  395. package/src/timeline/EventBlock.tsx +76 -0
  396. package/src/timeline/GridLines.tsx +36 -0
  397. package/src/timeline/HourGrid.tsx +90 -0
  398. package/src/timeline/NowIndicator.tsx +123 -0
  399. package/src/timeline/TimelineDay.tsx +112 -0
  400. package/src/timeline/packEvents.ts +118 -0
  401. package/src/timeline/timelineGeometry.ts +23 -0
  402. package/src/timeline/timelineMath.ts +86 -0
  403. package/src/types.ts +252 -0
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The date owner. Compat with `react-native-calendars`' `CalendarProvider`.
5
+ *
6
+ * Two cadences: `setDate` is synchronous (day tap, Today, page settle, the `date`
7
+ * prop) and writes `dayIndex`; `commitDate` is the scroll path, called from a
8
+ * worklet at settle and per month crossing, and leaves `dayIndex` to the
9
+ * scroller that already owns it. Both bump `move` so the OTHER surfaces follow.
10
+ *
11
+ * The prop echo: a controlled caller mirrors every `onDateChanged` back into
12
+ * `date`, and a `runOnJS` commit can land between a render's commit and its
13
+ * effects, so "prop equals current date" is not enough (M5: a fast fling was
14
+ * thrown back a month as `propUpdate`). The provider queues what it emitted; a
15
+ * prop matching a pending emission is an echo and consumes the queue up to it.
16
+ */
17
+
18
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
19
+ import { StyleSheet, View } from 'react-native';
20
+ import { monthOrdinalOfYmd } from "./civil.js";
21
+ import { CalendarContext, CalendarDateContext } from "./CalendarContext.js";
22
+ import { useCreateCalendarStore } from "./CalendarStore.js";
23
+ import { clampIndex, dayIndexOf, ymdAt } from "./dateKey.js";
24
+ import { useReduceMotion } from "./motion.js";
25
+ import { TodayButton } from "./TodayButton.js";
26
+ import { AgendaKitThemeProvider } from "../theme/index.js";
27
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
+ /** Emissions a caller may leave unechoed before the oldest is forgotten. */
29
+ const MAX_PENDING_ECHOES = 8;
30
+ export const CalendarProvider = ({
31
+ range,
32
+ date,
33
+ onDateChanged,
34
+ onMonthChange,
35
+ showTodayButton = false,
36
+ todayBottomMargin = 0,
37
+ todayLabel,
38
+ theme,
39
+ themeBase,
40
+ children
41
+ }) => {
42
+ const [initialIndex] = useState(() => dayIndexOf(range, date));
43
+ const store = useCreateCalendarStore(range, initialIndex);
44
+ const dateRef = useRef(date);
45
+ const pendingEchoesRef = useRef([]);
46
+ const reduceMotion = useReduceMotion();
47
+ const [committed, setCommitted] = useState(date);
48
+
49
+ // Read through a ref so a caller passing inline arrows, or the setting
50
+ // changing, cannot churn `setDate`'s identity — every scroller holds it.
51
+ const live = useRef({
52
+ onDateChanged,
53
+ onMonthChange,
54
+ reduceMotion
55
+ });
56
+ live.current.onDateChanged = onDateChanged;
57
+ live.current.onMonthChange = onMonthChange;
58
+ live.current.reduceMotion = reduceMotion;
59
+ useEffect(() => {
60
+ if (__DEV__ && showTodayButton && !todayLabel) {
61
+ console.warn('[agenda-kit] showTodayButton needs todayLabel; the button is not rendered.');
62
+ }
63
+ }, [showTodayButton, todayLabel]);
64
+ const commitCore = useCallback((idx, source, writeDayIndex, origin, animated) => {
65
+ const ymd = ymdAt(range, idx);
66
+ const prev = dateRef.current;
67
+ dateRef.current = ymd;
68
+ const pending = pendingEchoesRef.current;
69
+ pending.push(ymd);
70
+ if (pending.length > MAX_PENDING_ECHOES) pending.shift();
71
+ setCommitted(ymd);
72
+ live.current.onDateChanged?.(ymd, source);
73
+ if (monthOrdinalOfYmd(prev) !== monthOrdinalOfYmd(ymd)) live.current.onMonthChange?.(ymd, source);
74
+ if (writeDayIndex) store.dayIndex.value = idx;
75
+ store.move.value = {
76
+ seq: store.move.value.seq + 1,
77
+ idx,
78
+ origin,
79
+ animated: animated && !live.current.reduceMotion
80
+ };
81
+ }, [range, store]);
82
+ const setDate = useCallback((ymd, source, origin = 'external', animated = true) => {
83
+ if (ymd === dateRef.current) return;
84
+ const idx = dayIndexOf(range, ymd);
85
+ if (Number.isNaN(idx)) return;
86
+ commitCore(clampIndex(range, idx), source, true, origin, animated);
87
+ }, [commitCore, range]);
88
+ const commitDate = useCallback((idx, source, origin) => {
89
+ const clamped = clampIndex(range, idx);
90
+ if (ymdAt(range, clamped) === dateRef.current) return;
91
+ commitCore(clamped, source, false, origin, false);
92
+ }, [commitCore, range]);
93
+
94
+ // A layout effect runs inside the commit, which narrows the race; the queue is
95
+ // what makes it correct. `indexOf` consumes the EARLIEST matching emission.
96
+ useLayoutEffect(() => {
97
+ const pending = pendingEchoesRef.current;
98
+ const at = pending.indexOf(date);
99
+ if (at >= 0) {
100
+ pending.splice(0, at + 1);
101
+ return;
102
+ }
103
+ setDate(date, 'propUpdate');
104
+ }, [date, setDate]);
105
+ const value = useMemo(() => ({
106
+ range,
107
+ store,
108
+ dateRef,
109
+ setDate,
110
+ commitDate,
111
+ reduceMotion
112
+ }), [range, store, setDate, commitDate, reduceMotion]);
113
+ return /*#__PURE__*/_jsx(AgendaKitThemeProvider, {
114
+ theme: theme,
115
+ base: themeBase,
116
+ children: /*#__PURE__*/_jsx(CalendarContext.Provider, {
117
+ value: value,
118
+ children: /*#__PURE__*/_jsx(CalendarDateContext.Provider, {
119
+ value: committed,
120
+ children: /*#__PURE__*/_jsxs(View, {
121
+ style: styles.wrapper,
122
+ children: [children, showTodayButton && todayLabel ? /*#__PURE__*/_jsx(TodayButton, {
123
+ label: todayLabel,
124
+ bottomMargin: todayBottomMargin
125
+ }) : null]
126
+ })
127
+ })
128
+ })
129
+ });
130
+ };
131
+ const styles = StyleSheet.create({
132
+ wrapper: {
133
+ flex: 1
134
+ }
135
+ });
136
+ //# sourceMappingURL=CalendarProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","StyleSheet","View","monthOrdinalOfYmd","CalendarContext","CalendarDateContext","useCreateCalendarStore","clampIndex","dayIndexOf","ymdAt","useReduceMotion","TodayButton","AgendaKitThemeProvider","jsx","_jsx","jsxs","_jsxs","MAX_PENDING_ECHOES","CalendarProvider","range","date","onDateChanged","onMonthChange","showTodayButton","todayBottomMargin","todayLabel","theme","themeBase","children","initialIndex","store","dateRef","pendingEchoesRef","reduceMotion","committed","setCommitted","live","current","__DEV__","console","warn","commitCore","idx","source","writeDayIndex","origin","animated","ymd","prev","pending","push","length","shift","dayIndex","value","move","seq","setDate","Number","isNaN","commitDate","clamped","at","indexOf","splice","base","Provider","style","styles","wrapper","label","bottomMargin","create","flex"],"sourceRoot":"../../../src","sources":["core/CalendarProvider.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAwB,OAAO;AAC1G,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,iBAAiB,QAAQ,YAAS;AAC3C,SAASC,eAAe,EAAEC,mBAAmB,QAAmC,sBAAmB;AACnG,SAASC,sBAAsB,QAAQ,oBAAiB;AACxD,SAASC,UAAU,EAAEC,UAAU,EAAEC,KAAK,QAAQ,cAAW;AACzD,SAASC,eAAe,QAAQ,aAAU;AAC1C,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,sBAAsB,QAAQ,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA2BlD;AACA,MAAMC,kBAAkB,GAAG,CAAC;AAE5B,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,KAAK;EACLC,IAAI;EACJ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,QAAA,eACrCd,IAAA,CAACT,mBAAmB,CAAC6D,QAAQ;QAACZ,KAAK,EAAEpB,SAAU;QAAAN,QAAA,eAC7CZ,KAAA,CAACd,IAAI;UAACiE,KAAK,EAAEC,MAAM,CAACC,OAAQ;UAAAzC,QAAA,GACzBA,QAAQ,EACRL,eAAe,IAAIE,UAAU,gBAC5BX,IAAA,CAACH,WAAW;YAAC2D,KAAK,EAAE7C,UAAW;YAAC8C,YAAY,EAAE/C;UAAkB,CAAE,CAAC,GACjE,IAAI;QAAA,CACJ;MAAC,CACqB;IAAC,CACP;EAAC,CACL,CAAC;AAE7B,CAAC;AAED,MAAM4C,MAAM,GAAGnE,UAAU,CAACuE,MAAM,CAAC;EAC/BH,OAAO,EAAE;IAAEI,IAAI,EAAE;EAAE;AACrB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The UI-thread half of the calendar: four shared values, created once.
5
+ *
6
+ * The scroll offset owns position and `dayIndex` is derived from it on the UI
7
+ * thread, so the week strip, the Today button and the sticky header track a
8
+ * fling frame-locked. `move` carries a programmatic move with its `origin`;
9
+ * each scroller ignores its own origin, so a `scrollTo` never echoes back.
10
+ */
11
+
12
+ import { useEffect, useState } from 'react';
13
+ import { AppState } from 'react-native';
14
+ import { useSharedValue } from 'react-native-reanimated';
15
+ import { todayIndexOf } from "./dateKey.js";
16
+
17
+ /**
18
+ * SHARED VALUES ONLY. Worklets that read `store.x.value` capture `store`, and
19
+ * react-native-worklets freezes captured objects in `__DEV__`: a plain ref in
20
+ * here silently ignores every write (M2: the echo guard compared against a date
21
+ * frozen at mount). Anything else lives on the provider and the context.
22
+ */
23
+
24
+ const NO_MOVE = {
25
+ seq: 0,
26
+ idx: 0,
27
+ origin: 'external',
28
+ animated: false
29
+ };
30
+ export const useCreateCalendarStore = (range, initialIndex) => {
31
+ const dayIndex = useSharedValue(initialIndex);
32
+ const move = useSharedValue(NO_MOVE);
33
+ const todayIndex = useSharedValue(range.todayIndex);
34
+ const listDragSeq = useSharedValue(0);
35
+ const {
36
+ startEpochDay,
37
+ days
38
+ } = range;
39
+ useEffect(() => {
40
+ let timer;
41
+ // One timer for the next local midnight, re-armed on foreground: a 24 h
42
+ // interval drifts and fires at the wrong instant after a suspend.
43
+ const refreshAndArm = () => {
44
+ todayIndex.value = todayIndexOf(startEpochDay, days);
45
+ if (timer) clearTimeout(timer);
46
+ const now = new Date();
47
+ const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 5);
48
+ timer = setTimeout(refreshAndArm, Math.max(1000, next.getTime() - now.getTime()));
49
+ };
50
+ refreshAndArm();
51
+ const sub = AppState.addEventListener('change', state => {
52
+ if (state === 'active') refreshAndArm();
53
+ });
54
+ return () => {
55
+ if (timer) clearTimeout(timer);
56
+ sub.remove();
57
+ };
58
+ }, [days, startEpochDay, todayIndex]);
59
+ return useState(() => ({
60
+ dayIndex,
61
+ move,
62
+ todayIndex,
63
+ listDragSeq
64
+ }))[0];
65
+ };
66
+ //# sourceMappingURL=CalendarStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","AppState","useSharedValue","todayIndexOf","NO_MOVE","seq","idx","origin","animated","useCreateCalendarStore","range","initialIndex","dayIndex","move","todayIndex","listDragSeq","startEpochDay","days","timer","refreshAndArm","value","clearTimeout","now","Date","next","getFullYear","getMonth","getDate","setTimeout","Math","max","getTime","sub","addEventListener","state","remove"],"sourceRoot":"../../../src","sources":["core/CalendarStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAA0B,yBAAyB;AAC1E,SAASC,YAAY,QAAQ,cAAW;;AAGxC;AACA;AACA;AACA;AACA;AACA;;AAYA,MAAMC,OAAqB,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC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C;IACzC,CAAC,CAAC;IACF,OAAO,MAAM;MACX,IAAID,KAAK,EAAEG,YAAY,CAACH,KAAK,CAAC;MAC9Bc,GAAG,CAACG,MAAM,CAAC,CAAC;IACd,CAAC;EACH,CAAC,EAAE,CAAClB,IAAI,EAAED,aAAa,EAAEF,UAAU,CAAC,CAAC;EAErC,OAAOd,QAAQ,CAAC,OAAO;IAAEY,QAAQ;IAAEC,IAAI;IAAEC,UAAU;IAAEC;EAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import { Text } from 'react-native';
4
+
5
+ /**
6
+ * Kit text with OS scaling pinned off: row heights are declared, so scaled text
7
+ * would clip in its slot. `Text.defaultProps` is a no-op under React 19.
8
+ */
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ export const KitText = ({
11
+ ref,
12
+ ...props
13
+ }) => /*#__PURE__*/_jsx(Text, {
14
+ ref: ref,
15
+ allowFontScaling: false,
16
+ maxFontSizeMultiplier: 1,
17
+ ...props
18
+ });
19
+ //# sourceMappingURL=KitText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Text","jsx","_jsx","KitText","ref","props","allowFontScaling","maxFontSizeMultiplier"],"sourceRoot":"../../../src","sources":["core/KitText.tsx"],"mappings":";;AACA,SAASA,IAAI,QAAwB,cAAc;;AAEnD;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA;AAIA,OAAO,MAAMC,OAAO,GAAGA,CAAC;EAAEC,GAAG;EAAE,GAAGC;AAAuC,CAAC,kBACxEH,IAAA,CAACF,IAAI;EAACI,GAAG,EAAEA,GAAI;EAACE,gBAAgB,EAAE,KAAM;EAACC,qBAAqB,EAAE,CAAE;EAAA,GAAKF;AAAK,CAAG,CAChF","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The Today pill, visible whenever the calendar is not on today: centred, with an
5
+ * arrow pointing the way back to today (the owner's Teams reference, 2026-09-11).
6
+ *
7
+ * Visibility and the arrow's direction are derived on the UI thread from
8
+ * `dayIndex` and `todayIndex`, so the pill appears the frame a fling leaves today
9
+ * and the arrow flips with no React commit. The show/hide animation starts from a
10
+ * reaction that fires only when the boolean flips — `withTiming` returned from
11
+ * `useAnimatedStyle` would restart on every frame of a fling. Hidden means
12
+ * translated off the bottom edge: a transparent pill would still swallow taps.
13
+ */
14
+
15
+ import { useKitStyles, useKitTheme } from "../theme/index.js";
16
+ import { ANIMATION, FONT_SIZE, RADIUS, SPACING } from "../theme/tokens.js";
17
+ import { memo, useCallback, useMemo } from 'react';
18
+ import { Pressable, StyleSheet } from 'react-native';
19
+ import Animated, { useAnimatedReaction, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
20
+ import { ArrowGlyph } from "./ArrowGlyph.js";
21
+ import { useCalendarContext } from "./CalendarContext.js";
22
+ import { dayIndexOf, ymdAt } from "./dateKey.js";
23
+ import { KitText } from "./KitText.js";
24
+ import { KIT_EASING, kitDuration } from "./motion.js";
25
+
26
+ /** The library's non-tablet `todayButton.height`. */
27
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
+ const BUTTON_HEIGHT = 28;
29
+ const ARROW_SIZE = 14;
30
+ const TodayButtonInner = ({
31
+ label,
32
+ bottomMargin = 0
33
+ }) => {
34
+ const styles = useKitStyles(makeStyles);
35
+ const {
36
+ colors
37
+ } = useKitTheme();
38
+ const {
39
+ range,
40
+ store,
41
+ dateRef,
42
+ setDate,
43
+ reduceMotion
44
+ } = useCalendarContext();
45
+ const duration = kitDuration(ANIMATION.base, reduceMotion);
46
+ const hiddenOffset = bottomMargin + BUTTON_HEIGHT + SPACING[5];
47
+
48
+ // Mount-time seed from plain values (reading a shared value in render is
49
+ // unsupported); the reaction owns every change after that.
50
+ const shown = useSharedValue(range.todayIndex >= 0 && dayIndexOf(range, dateRef.current) !== range.todayIndex ? 1 : 0);
51
+ useAnimatedReaction(() => {
52
+ const today = store.todayIndex.value;
53
+ return today >= 0 && store.dayIndex.value !== today ? 1 : 0;
54
+ }, (next, prev) => {
55
+ if (next === prev) return;
56
+ shown.value = withTiming(next, {
57
+ duration,
58
+ easing: KIT_EASING
59
+ });
60
+ }, [duration]);
61
+ const animatedStyle = useAnimatedStyle(() => ({
62
+ opacity: shown.value,
63
+ transform: [{
64
+ translateY: (1 - shown.value) * hiddenOffset
65
+ }]
66
+ }));
67
+ // Up when today lies above the list's day, down when below.
68
+ const arrowStyle = useAnimatedStyle(() => ({
69
+ transform: [{
70
+ rotate: store.todayIndex.value < store.dayIndex.value ? '0deg' : '180deg'
71
+ }]
72
+ }));
73
+ const onPress = useCallback(() => {
74
+ const today = store.todayIndex.value;
75
+ if (today >= 0) setDate(ymdAt(range, today), 'todayPress');
76
+ }, [range, setDate, store]);
77
+ const containerStyle = useMemo(() => [styles.container, {
78
+ bottom: bottomMargin
79
+ }, animatedStyle], [animatedStyle, bottomMargin, styles.container]);
80
+ return /*#__PURE__*/_jsx(Animated.View, {
81
+ pointerEvents: "box-none",
82
+ style: containerStyle,
83
+ children: /*#__PURE__*/_jsxs(Pressable, {
84
+ style: styles.button,
85
+ onPress: onPress,
86
+ hitSlop: 8,
87
+ accessibilityRole: "button",
88
+ accessibilityLabel: label,
89
+ children: [/*#__PURE__*/_jsx(Animated.View, {
90
+ style: arrowStyle,
91
+ children: /*#__PURE__*/_jsx(ArrowGlyph, {
92
+ size: ARROW_SIZE,
93
+ color: colors.accent
94
+ })
95
+ }), /*#__PURE__*/_jsx(KitText, {
96
+ style: styles.label,
97
+ numberOfLines: 1,
98
+ children: label
99
+ })]
100
+ })
101
+ });
102
+ };
103
+ export const TodayButton = /*#__PURE__*/memo(TodayButtonInner);
104
+ TodayButton.displayName = 'TodayButton';
105
+ const makeStyles = ({
106
+ colors,
107
+ fonts
108
+ }) => StyleSheet.create({
109
+ container: {
110
+ position: 'absolute',
111
+ left: 0,
112
+ right: 0,
113
+ alignItems: 'center'
114
+ },
115
+ button: {
116
+ height: BUTTON_HEIGHT,
117
+ flexDirection: 'row',
118
+ alignItems: 'center',
119
+ gap: SPACING[1],
120
+ paddingHorizontal: SPACING[3],
121
+ borderRadius: RADIUS.full,
122
+ borderWidth: 1,
123
+ borderColor: colors.border,
124
+ backgroundColor: colors.surface
125
+ },
126
+ // An action's label: accent INK, never a fill.
127
+ label: {
128
+ fontFamily: fonts.medium,
129
+ fontSize: FONT_SIZE.sm,
130
+ color: colors.accent
131
+ }
132
+ });
133
+ //# sourceMappingURL=TodayButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useKitStyles","useKitTheme","ANIMATION","FONT_SIZE","RADIUS","SPACING","memo","useCallback","useMemo","Pressable","StyleSheet","Animated","useAnimatedReaction","useAnimatedStyle","useSharedValue","withTiming","ArrowGlyph","useCalendarContext","dayIndexOf","ymdAt","KitText","KIT_EASING","kitDuration","jsx","_jsx","jsxs","_jsxs","BUTTON_HEIGHT","ARROW_SIZE","TodayButtonInner","label","bottomMargin","styles","makeStyles","colors","range","store","dateRef","setDate","reduceMotion","duration","base","hiddenOffset","shown","todayIndex","current","today","value","dayIndex","next","prev","easing","animatedStyle","opacity","transform","translateY","arrowStyle","rotate","onPress","containerStyle","container","bottom","View","pointerEvents","style","children","button","hitSlop","accessibilityRole","accessibilityLabel","size","color","accent","numberOfLines","TodayButton","displayName","fonts","create","position","left","right","alignItems","height","flexDirection","gap","paddingHorizontal","borderRadius","full","borderWidth","borderColor","border","backgroundColor","surface","fontFamily","medium","fontSize","sm"],"sourceRoot":"../../../src","sources":["core/TodayButton.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,EAAEC,WAAW,QAA2B,mBAAU;AACvE,SAASC,SAAS,EAAEC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,oBAAiB;AACvE,SAASC,IAAI,EAAEC,WAAW,EAA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AEhF,OAAO,CAAC,CAAC,CAAC;IAC7BiF,YAAY,EAAElF,MAAM,CAACmF,IAAI;IACzBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAEvD,MAAM,CAACwD,MAAM;IAC1BC,eAAe,EAAEzD,MAAM,CAAC0D;EAC1B,CAAC;EACD;EACA9D,KAAK,EAAE;IAAE+D,UAAU,EAAEjB,KAAK,CAACkB,MAAM;IAAEC,QAAQ,EAAE5F,SAAS,CAAC6F,EAAE;IAAEzB,KAAK,EAAErC,MAAM,CAACsC;EAAO;AAClF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Integer civil-date arithmetic: no `Date`, no string splitting, no timezone.
5
+ *
6
+ * An epoch day is the count of days since 1970-01-01 in the proleptic Gregorian
7
+ * calendar. Calendar days are integers here, so a DST transition cannot make two
8
+ * days 23 or 25 hours apart — the bug a `(a - b) / 86400000` calendar has twice
9
+ * a year. Algorithms: H. Hinnant, "chrono-Compatible Low-Level Date Algorithms".
10
+ */
11
+
12
+ /** Epoch day of a civil date. `m` is 1–12. */
13
+ export const epochDayOf = (y, m, d) => {
14
+ const yy = m <= 2 ? y - 1 : y;
15
+ const era = Math.floor(yy / 400);
16
+ const yoe = yy - era * 400;
17
+ const doy = Math.floor((153 * ((m + 9) % 12) + 2) / 5) + d - 1;
18
+ const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
19
+ return era * 146097 + doe - 719468;
20
+ };
21
+
22
+ /** Civil date of an epoch day, packed as YYYYMMDD so nothing is allocated. */
23
+ export const civilOf = z => {
24
+ const zz = z + 719468;
25
+ const era = Math.floor(zz / 146097);
26
+ const doe = zz - era * 146097;
27
+ const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);
28
+ const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));
29
+ const mp = Math.floor((5 * doy + 2) / 153);
30
+ const d = doy - Math.floor((153 * mp + 2) / 5) + 1;
31
+ const m = mp < 10 ? mp + 3 : mp - 9;
32
+ return (yoe + era * 400 + (m <= 2 ? 1 : 0)) * 10000 + m * 100 + d;
33
+ };
34
+
35
+ /** 0 = Sunday … 6 = Saturday, as `Date#getDay`. 1970-01-01 was a Thursday. */
36
+ export const weekdayOf = z => ((z + 4) % 7 + 7) % 7;
37
+ const isLeap = y => y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
38
+ const MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
39
+ export const daysInMonth = (y, m) => m === 2 && isLeap(y) ? 29 : MONTH_DAYS[m - 1];
40
+
41
+ /** '00'…'31', so formatting never calls `padStart` or builds a template per part. */
42
+ const TWO_DIGIT = Array.from({
43
+ length: 32
44
+ }, (_, i) => i < 10 ? `0${i}` : `${i}`);
45
+
46
+ /** 'YYYY-MM-DD' of an epoch day. */
47
+ export const ymdOfEpochDay = z => {
48
+ const c = civilOf(z);
49
+ const y = Math.floor(c / 10000);
50
+ return `${y}-${TWO_DIGIT[Math.floor(c / 100) % 100]}-${TWO_DIGIT[c % 100]}`;
51
+ };
52
+ const digit = (s, i) => {
53
+ const c = s.charCodeAt(i) - 48;
54
+ return c >= 0 && c <= 9 ? c : NaN;
55
+ };
56
+
57
+ /** Epoch day of 'YYYY-MM-DD' (anything after position 10 is ignored); NaN if malformed. */
58
+ export const epochDayOfYmd = s => {
59
+ if (s.length < 10) return NaN;
60
+ const y = digit(s, 0) * 1000 + digit(s, 1) * 100 + digit(s, 2) * 10 + digit(s, 3);
61
+ const m = digit(s, 5) * 10 + digit(s, 6);
62
+ const d = digit(s, 8) * 10 + digit(s, 9);
63
+ return epochDayOf(y, m, d);
64
+ };
65
+
66
+ /** y·12 + (m − 1) of 'YYYY-MM-DD' — a month ordinal that orders and subtracts. */
67
+ export 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;
68
+
69
+ /** Epoch day of a `Date`'s LOCAL calendar day. The one bridge from `Date`. */
70
+ export const epochDayOfDate = d => epochDayOf(d.getFullYear(), d.getMonth() + 1, d.getDate());
71
+ let today = {
72
+ epochDay: 0,
73
+ validUntilMs: 0
74
+ };
75
+
76
+ /** Today's epoch day. Cached until local midnight: a hot call is one `Date.now()`, no allocation. */
77
+ export const todayEpochDay = () => {
78
+ const now = Date.now();
79
+ if (now >= today.validUntilMs) {
80
+ const d = new Date(now);
81
+ today = {
82
+ epochDay: epochDayOfDate(d),
83
+ validUntilMs: new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1).getTime()
84
+ };
85
+ }
86
+ return today.epochDay;
87
+ };
88
+ //# sourceMappingURL=civil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["epochDayOf","y","m","d","yy","era","Math","floor","yoe","doy","doe","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"],"sourceRoot":"../../../src","sources":["core/civil.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,UAAU,GAAGA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,KAAa;EACrE,MAAMC,EAAE,GAAGF,CAAC,IAAI,CAAC,GAAGD,CAAC,GAAG,CAAC,GAAGA,CAAC;EAC7B,MAAMI,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACH,EAAE,GAAG,GAAG,CAAC;EAChC,MAAMI,GAAG,GAAGJ,EAAE,GAAGC,GAAG,GAAG,GAAG;EAC1B,MAAMI,GAAG,GAAGH,IAAI,CAACC,KAAK,CAAC,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,CAACC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAGD,KAAK,CAACC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAGD,KAAK,CAACC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,GAC9ED,KAAK,CAACC,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAChBD,KAAK,CAACC,CAAC,EAAE,CAAC,CAAC,GACX,CAAC;;AAEH;AACA,OAAO,MAAMK,cAAc,GAAI9B,CAAO,IACpCH,UAAU,CAACG,CAAC,CAAC+B,WAAW,CAAC,CAAC,EAAE/B,CAAC,CAACgC,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAEhC,CAAC,CAACiC,OAAO,CAAC,CAAC,CAAC;AAE5D,IAAIC,KAAK,GAAG;EAAEC,QAAQ,EAAE,CAAC;EAAEC,YAAY,EAAE;AAAE,CAAC;;AAE5C;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAc;EACzC,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC;EACtB,IAAIA,GAAG,IAAIJ,KAAK,CAACE,YAAY,EAAE;IAC7B,MAAMpC,CAAC,GAAG,IAAIuC,IAAI,CAACD,GAAG,CAAC;IACvBJ,KAAK,GAAG;MACNC,QAAQ,EAAEL,cAAc,CAAC9B,CAAC,CAAC;MAC3BoC,YAAY,EAAE,IAAIG,IAAI,CAACvC,CAAC,CAAC+B,WAAW,CAAC,CAAC,EAAE/B,CAAC,CAACgC,QAAQ,CAAC,CAAC,EAAEhC,CAAC,CAACiC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAACO,OAAO,CAAC;IACjF,CAAC;EACH;EACA,OAAON,KAAK,CAACC,QAAQ;AACvB,CAAC","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The one translation between the kit's integer index space and 'YYYY-MM-DD'.
5
+ *
6
+ * Every surface addresses a day as `dayIndex`, an offset from `range.start`.
7
+ * `buildRange` pays for the strings once; after that both directions are O(1)
8
+ * and allocation-free: `dayIndexOf` is a subtraction, `ymdAt` an array read.
9
+ */
10
+
11
+ import { epochDayOfDate, epochDayOfYmd, todayEpochDay, weekdayOf, ymdOfEpochDay } from "./civil.js";
12
+ /** Index of `ymd` within `range`. May fall outside `[0, days)`; NaN if malformed. */
13
+ export const dayIndexOf = (range, ymd) => epochDayOfYmd(ymd) - range.startEpochDay;
14
+
15
+ /** 'YYYY-MM-DD' at `idx`. Defined for any integer; callers clamp first. */
16
+ export const ymdAt = (range, idx) => range.ymdByIndex[idx] ?? ymdOfEpochDay(range.startEpochDay + idx);
17
+
18
+ /** The single gating predicate: an index is selectable iff clamping leaves it alone. */
19
+ export const clampIndex = (range, idx) => idx < range.minIndex ? range.minIndex : idx > range.maxIndex ? range.maxIndex : idx;
20
+ export const todayIndexOf = (startEpochDay, days) => {
21
+ const i = todayEpochDay() - startEpochDay;
22
+ return i >= 0 && i < days ? i : -1;
23
+ };
24
+
25
+ /**
26
+ * `start` is pushed back to the `firstDay` week boundary and `days` rounded up
27
+ * to whole weeks, so `floor(dayIndex / 7)` is always a week page.
28
+ */
29
+ export const buildRange = (minDate, maxDate, firstDay = 1) => {
30
+ const min = epochDayOfDate(minDate);
31
+ const max = epochDayOfDate(maxDate);
32
+ const startEpochDay = min - (weekdayOf(min) - firstDay + 7) % 7;
33
+ const days = Math.ceil((max - startEpochDay + 1) / 7) * 7;
34
+ const ymdByIndex = new Array(days);
35
+ for (let i = 0; i < days; i += 1) ymdByIndex[i] = ymdOfEpochDay(startEpochDay + i);
36
+ return {
37
+ start: ymdByIndex[0],
38
+ startEpochDay,
39
+ ymdByIndex,
40
+ days,
41
+ minIndex: min - startEpochDay,
42
+ maxIndex: max - startEpochDay,
43
+ firstDay,
44
+ todayIndex: todayIndexOf(startEpochDay, days)
45
+ };
46
+ };
47
+ //# sourceMappingURL=dateKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["epochDayOfDate","epochDayOfYmd","todayEpochDay","weekdayOf","ymdOfEpochDay","dayIndexOf","range","ymd","startEpochDay","ymdAt","idx","ymdByIndex","clampIndex","minIndex","maxIndex","todayIndexOf","days","i","buildRange","minDate","maxDate","firstDay","min","max","Math","ceil","Array","start","todayIndex"],"sourceRoot":"../../../src","sources":["core/dateKey.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,EAAEC,aAAa,EAAEC,aAAa,EAAEC,SAAS,EAAEC,aAAa,QAAQ,YAAS;AAGhG;AACA,OAAO,MAAMC,UAAU,GAAGA,CAACC,KAAoB,EAAEC,GAAe,KAC9DN,aAAa,CAACM,GAAG,CAAC,GAAGD,KAAK,CAACE,aAAa;;AAE1C;AACA,OAAO,MAAMC,KAAK,GAAGA,CAACH,KAAoB,EAAEI,GAAW,KACrDJ,KAAK,CAACK,UAAU,CAACD,GAAG,CAAC,IAAIN,aAAa,CAACE,KAAK,CAACE,aAAa,GAAGE,GAAG,CAAC;;AAEnE;AACA,OAAO,MAAME,UAAU,GAAGA,CAACN,KAAoB,EAAEI,GAAW,KAC1DA,GAAG,GAAGJ,KAAK,CAACO,QAAQ,GAAGP,KAAK,CAACO,QAAQ,GAAGH,GAAG,GAAGJ,KAAK,CAACQ,QAAQ,GAAGR,KAAK,CAACQ,QAAQ,GAAGJ,GAAG;AAErF,OAAO,MAAMK,YAAY,GAAGA,CAACP,aAAqB,EAAEQ,IAAY,KAAa;EAC3E,MAAMC,CAAC,GAAGf,aAAa,CAAC,CAAC,GAAGM,aAAa;EACzC,OAAOS,CAAC,IAAI,CAAC,IAAIA,CAAC,GAAGD,IAAI,GAAGC,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAACC,OAAa,EAAEC,OAAa,EAAEC,QAAgB,GAAG,CAAC,KAAoB;EAC/F,MAAMC,GAAG,GAAGtB,cAAc,CAACmB,OAAO,CAAC;EACnC,MAAMI,GAAG,GAAGvB,cAAc,CAACoB,OAAO,CAAC;EACnC,MAAMZ,aAAa,GAAGc,GAAG,GAAI,CAACnB,SAAS,CAACmB,GAAG,CAAC,GAAGD,QAAQ,GAAG,CAAC,IAAI,CAAE;EACjE,MAAML,IAAI,GAAGQ,IAAI,CAACC,IAAI,CAAC,CAACF,GAAG,GAAGf,aAAa,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;EAEzD,MAAMG,UAAU,GAAG,IAAIe,KAAK,CAAaV,IAAI,CAAC;EAC9C,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,IAAI,EAAEC,CAAC,IAAI,CAAC,EAAEN,UAAU,CAACM,CAAC,CAAC,GAAGb,aAAa,CAACI,aAAa,GAAGS,CAAC,CAAC;EAElF,OAAO;IACLU,KAAK,EAAEhB,UAAU,CAAC,CAAC,CAAC;IACpBH,aAAa;IACbG,UAAU;IACVK,IAAI;IACJH,QAAQ,EAAES,GAAG,GAAGd,aAAa;IAC7BM,QAAQ,EAAES,GAAG,GAAGf,aAAa;IAC7Ba,QAAQ;IACRO,UAAU,EAAEb,YAAY,CAACP,aAAa,EAAEQ,IAAI;EAC9C,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The kit's motion inputs and the two accessibility flags it obeys.
5
+ *
6
+ * Durations come from `theme/tokens` (`ANIMATION.fast/base/slow`). They are
7
+ * module constants, not themeable: `KIT_EASING` is captured by worklets at
8
+ * module scope and so cannot read a React context.
9
+ */
10
+
11
+ import { EASING } from "../theme/tokens.js";
12
+ import { useEffect, useState } from 'react';
13
+ import { AccessibilityInfo } from 'react-native';
14
+ import { Easing } from 'react-native-reanimated';
15
+ export const KIT_EASING = Easing.bezier(...EASING.bezier);
16
+
17
+ /** Reanimated treats `duration: 0` as an immediate set, so a snap stays a snap. */
18
+ export const kitDuration = (ms, reduced) => reduced ? 0 : ms;
19
+
20
+ /** A platform that cannot answer gets the default: full motion, visual calendar. */
21
+ const useA11yFlag = (read, event) => {
22
+ const [on, setOn] = useState(false);
23
+ useEffect(() => {
24
+ let alive = true;
25
+ read().then(value => {
26
+ if (alive) setOn(value);
27
+ }).catch(() => undefined);
28
+ const sub = AccessibilityInfo.addEventListener(event, value => {
29
+ if (alive) setOn(Boolean(value));
30
+ });
31
+ return () => {
32
+ alive = false;
33
+ sub.remove();
34
+ };
35
+ }, [read, event]);
36
+ return on;
37
+ };
38
+ const readReduceMotion = () => AccessibilityInfo.isReduceMotionEnabled();
39
+ const readScreenReader = () => AccessibilityInfo.isScreenReaderEnabled();
40
+
41
+ /** Subscribe ONCE per tree: the provider reads it and publishes it on the context. */
42
+ export const useReduceMotion = () => useA11yFlag(readReduceMotion, 'reduceMotionChanged');
43
+
44
+ /**
45
+ * TalkBack does not see opacity, so the stacked week strip and month grid would
46
+ * both be read. `ExpandableCalendar` renders a static grid while this is true.
47
+ */
48
+ export const useScreenReaderEnabled = () => useA11yFlag(readScreenReader, 'screenReaderChanged');
49
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EASING","useEffect","useState","AccessibilityInfo","Easing","KIT_EASING","bezier","kitDuration","ms","reduced","useA11yFlag","read","event","on","setOn","alive","then","value","catch","undefined","sub","addEventListener","Boolean","remove","readReduceMotion","isReduceMotionEnabled","readScreenReader","isScreenReaderEnabled","useReduceMotion","useScreenReaderEnabled"],"sourceRoot":"../../../src","sources":["core/motion.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,oBAAiB;AACxC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,iBAAiB,QAA2C,cAAc;AACnF,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,OAAO,MAAMC,UAAU,GAAGD,MAAM,CAACE,MAAM,CAAC,GAAGN,MAAM,CAACM,MAAM,CAAC;;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Module-scope `'worklet'` helpers. The babel plugin workletizes a top-level
5
+ * function with the directive unconditionally; inside a hook call it depends on
6
+ * configuration (`hooks/useChromeScrub.ts:24-39`).
7
+ */
8
+
9
+ /**
10
+ * Largest `i` with `offsets[i] <= y`, or 0. `offsets` is a strictly increasing
11
+ * prefix-sum table, so the search is exact and allocation-free.
12
+ */
13
+ export const bsearchLE = (offsets, y) => {
14
+ 'worklet';
15
+
16
+ let lo = 0;
17
+ let hi = offsets.length - 1;
18
+ if (hi < 0 || y <= offsets[0]) return 0;
19
+ if (y >= offsets[hi]) return hi;
20
+ while (lo < hi) {
21
+ // Upper mid, so the loop converges on the LAST index satisfying the predicate.
22
+ const mid = lo + hi + 1 >> 1;
23
+ if (offsets[mid] <= y) lo = mid;else hi = mid - 1;
24
+ }
25
+ return lo;
26
+ };
27
+ export const clampNum = (v, lo, hi) => {
28
+ 'worklet';
29
+
30
+ return v < lo ? lo : v > hi ? hi : v;
31
+ };
32
+
33
+ // Without the worklets babel plugin every scroll handler silently runs on the JS
34
+ // thread; the only symptom would be the jank the kit exists to remove.
35
+ if (__DEV__ && clampNum.__workletHash === undefined) {
36
+ console.error('[agenda-kit] worklet helpers are not workletized — the worklets babel plugin did not run over this package. Metro must apply babel to node_modules.');
37
+ }
38
+ //# sourceMappingURL=worklets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["bsearchLE","offsets","y","lo","hi","length","mid","clampNum","v","__DEV__","__workletHash","undefined","console","error"],"sourceRoot":"../../../src","sources":["core/worklets.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAGA,CAACC,OAA0B,EAAEC,CAAS,KAAa;EAC1E,SAAS;;EACT,IAAIC,EAAE,GAAG,CAAC;EACV,IAAIC,EAAE,GAAGH,OAAO,CAACI,MAAM,GAAG,CAAC;EAC3B,IAAID,EAAE,GAAG,CAAC,IAAIF,CAAC,IAAID,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;EACvC,IAAIC,CAAC,IAAID,OAAO,CAACG,EAAE,CAAC,EAAE,OAAOA,EAAE;EAC/B,OAAOD,EAAE,GAAGC,EAAE,EAAE;IACd;IACA,MAAME,GAAG,GAAIH,EAAE,GAAGC,EAAE,GAAG,CAAC,IAAK,CAAC;IAC9B,IAAIH,OAAO,CAACK,GAAG,CAAC,IAAIJ,CAAC,EAAEC,EAAE,GAAGG,GAAG,CAAC,KAC3BF,EAAE,GAAGE,GAAG,GAAG,CAAC;EACnB;EACA,OAAOH,EAAE;AACX,CAAC;AAED,OAAO,MAAMI,QAAQ,GAAGA,CAACC,CAAS,EAAEL,EAAU,EAAEC,EAAU,KAAa;EACrE,SAAS;;EACT,OAAOI,CAAC,GAAGL,EAAE,GAAGA,EAAE,GAAGK,CAAC,GAAGJ,EAAE,GAAGA,EAAE,GAAGI,CAAC;AACtC,CAAC;;AAED;AACA;AACA,IAAIC,OAAO,IAAKF,QAAQ,CAA4CG,aAAa,KAAKC,SAAS,EAAE;EAC/FC,OAAO,CAACC,KAAK,CACX,qJACF,CAAC;AACH","ignoreList":[]}