@zealakit/chrono-react 0.0.0-stage → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +624 -2
  3. package/dist/calendar/components.d.ts +346 -0
  4. package/dist/calendar/components.js +245 -0
  5. package/dist/calendar/context.d.ts +636 -0
  6. package/dist/calendar/context.js +21 -0
  7. package/dist/calendar/index.d.ts +6 -0
  8. package/dist/calendar/index.js +6 -0
  9. package/dist/calendar/mini-calendar.d.ts +60 -0
  10. package/dist/calendar/mini-calendar.js +50 -0
  11. package/dist/calendar/options.d.ts +4 -0
  12. package/dist/calendar/options.js +98 -0
  13. package/dist/calendar/use-calendar.d.ts +340 -0
  14. package/dist/calendar/use-calendar.js +156 -0
  15. package/dist/calendar/use-mini-calendar.d.ts +302 -0
  16. package/dist/calendar/use-mini-calendar.js +56 -0
  17. package/dist/calendar/utilities.d.ts +9 -0
  18. package/dist/calendar/utilities.js +8 -0
  19. package/dist/date/bind-panel.d.ts +30 -0
  20. package/dist/date/bind-panel.js +125 -0
  21. package/dist/date/components.d.ts +197 -0
  22. package/dist/date/components.js +202 -0
  23. package/dist/date/context.d.ts +34 -0
  24. package/dist/date/context.js +19 -0
  25. package/dist/date/index.d.ts +4 -0
  26. package/dist/date/index.js +4 -0
  27. package/dist/date/options.d.ts +7 -0
  28. package/dist/date/options.js +91 -0
  29. package/dist/date/use-date-input.d.ts +43 -0
  30. package/dist/date/use-date-input.js +138 -0
  31. package/dist/date/use-date-panel.d.ts +81 -0
  32. package/dist/date/use-date-panel.js +21 -0
  33. package/dist/date/utilities.d.ts +4 -0
  34. package/dist/date/utilities.js +4 -0
  35. package/dist/datetime/components.d.ts +121 -0
  36. package/dist/datetime/components.js +169 -0
  37. package/dist/datetime/context.d.ts +8 -0
  38. package/dist/datetime/context.js +18 -0
  39. package/dist/datetime/index.d.ts +4 -0
  40. package/dist/datetime/index.js +4 -0
  41. package/dist/datetime/options.d.ts +5 -0
  42. package/dist/datetime/options.js +99 -0
  43. package/dist/datetime/use-datetime-input.d.ts +44 -0
  44. package/dist/datetime/use-datetime-input.js +145 -0
  45. package/dist/datetime/use-datetime-panel.d.ts +128 -0
  46. package/dist/datetime/use-datetime-panel.js +60 -0
  47. package/dist/datetime/utilities.d.ts +4 -0
  48. package/dist/datetime/utilities.js +4 -0
  49. package/dist/index.d.ts +4 -0
  50. package/dist/index.js +4 -0
  51. package/dist/shared/merge-props.d.ts +9 -0
  52. package/dist/shared/merge-props.js +33 -0
  53. package/dist/shared/modifiers.d.ts +7 -0
  54. package/dist/shared/modifiers.js +6 -0
  55. package/dist/shared/part.d.ts +10 -0
  56. package/dist/shared/part.js +9 -0
  57. package/dist/shared/slot.d.ts +12 -0
  58. package/dist/shared/slot.js +60 -0
  59. package/dist/shared/style-properties.d.ts +8 -0
  60. package/dist/shared/style-properties.js +13 -0
  61. package/dist/shared/to-react-props.d.ts +11 -0
  62. package/dist/shared/to-react-props.js +27 -0
  63. package/dist/time/bind-panel.d.ts +19 -0
  64. package/dist/time/bind-panel.js +97 -0
  65. package/dist/time/components.d.ts +183 -0
  66. package/dist/time/components.js +174 -0
  67. package/dist/time/context.d.ts +24 -0
  68. package/dist/time/context.js +19 -0
  69. package/dist/time/index.d.ts +4 -0
  70. package/dist/time/index.js +4 -0
  71. package/dist/time/options.d.ts +5 -0
  72. package/dist/time/options.js +85 -0
  73. package/dist/time/use-time-input.d.ts +43 -0
  74. package/dist/time/use-time-input.js +138 -0
  75. package/dist/time/use-time-panel.d.ts +37 -0
  76. package/dist/time/use-time-panel.js +18 -0
  77. package/dist/time/utilities.d.ts +4 -0
  78. package/dist/time/utilities.js +4 -0
  79. package/dist/vendor/core/calendar/availability.d.ts +39 -0
  80. package/dist/vendor/core/calendar/availability.js +74 -0
  81. package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
  82. package/dist/vendor/core/calendar/controllers/calendar-controller.js +1448 -0
  83. package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
  84. package/dist/vendor/core/calendar/controllers/drag-engine.js +382 -0
  85. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
  86. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +170 -0
  87. package/dist/vendor/core/calendar/controllers/shared.d.ts +29 -0
  88. package/dist/vendor/core/calendar/controllers/shared.js +82 -0
  89. package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
  90. package/dist/vendor/core/calendar/events/agenda-layout.js +71 -0
  91. package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
  92. package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
  93. package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
  94. package/dist/vendor/core/calendar/events/background-layout.js +107 -0
  95. package/dist/vendor/core/calendar/events/index.d.ts +17 -0
  96. package/dist/vendor/core/calendar/events/index.js +8 -0
  97. package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
  98. package/dist/vendor/core/calendar/events/month-layout.js +156 -0
  99. package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
  100. package/dist/vendor/core/calendar/events/normalize.js +159 -0
  101. package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
  102. package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
  103. package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
  104. package/dist/vendor/core/calendar/events/overflow.js +112 -0
  105. package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
  106. package/dist/vendor/core/calendar/events/sort.js +35 -0
  107. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
  108. package/dist/vendor/core/calendar/events/time-grid-layout.js +184 -0
  109. package/dist/vendor/core/calendar/events/types.d.ts +141 -0
  110. package/dist/vendor/core/calendar/events/types.js +1 -0
  111. package/dist/vendor/core/calendar/index.d.ts +70 -0
  112. package/dist/vendor/core/calendar/index.js +37 -0
  113. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +19 -0
  114. package/dist/vendor/core/calendar/interaction/auto-scroll.js +64 -0
  115. package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
  116. package/dist/vendor/core/calendar/interaction/drag-geometry.js +125 -0
  117. package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
  118. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +56 -0
  119. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +23 -0
  120. package/dist/vendor/core/calendar/interaction/drag-pointer.js +203 -0
  121. package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
  122. package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
  123. package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
  124. package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
  125. package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
  126. package/dist/vendor/core/calendar/interaction/pending.js +17 -0
  127. package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
  128. package/dist/vendor/core/calendar/interaction/pointer.js +119 -0
  129. package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
  130. package/dist/vendor/core/calendar/interaction/selection.js +47 -0
  131. package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
  132. package/dist/vendor/core/calendar/internal/equal.js +43 -0
  133. package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
  134. package/dist/vendor/core/calendar/navigation/navigate.js +83 -0
  135. package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
  136. package/dist/vendor/core/calendar/navigation/range.js +52 -0
  137. package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
  138. package/dist/vendor/core/calendar/navigation/title.js +39 -0
  139. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
  140. package/dist/vendor/core/calendar/navigation/view-definition.js +61 -0
  141. package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
  142. package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
  143. package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
  144. package/dist/vendor/core/calendar/recurrence/apply.js +207 -0
  145. package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
  146. package/dist/vendor/core/calendar/recurrence/expand.js +302 -0
  147. package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
  148. package/dist/vendor/core/calendar/recurrence/pack.js +251 -0
  149. package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
  150. package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
  151. package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
  152. package/dist/vendor/core/calendar/recurrence/rrule.js +288 -0
  153. package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
  154. package/dist/vendor/core/calendar/recurrence/series.js +165 -0
  155. package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
  156. package/dist/vendor/core/calendar/recurrence/types.js +1 -0
  157. package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
  158. package/dist/vendor/core/calendar/resources/keys.js +2 -0
  159. package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
  160. package/dist/vendor/core/calendar/resources/resource-time-grid.js +130 -0
  161. package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
  162. package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
  163. package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
  164. package/dist/vendor/core/calendar/resources/timeline-layout.js +111 -0
  165. package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
  166. package/dist/vendor/core/calendar/resources/tree.js +86 -0
  167. package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
  168. package/dist/vendor/core/calendar/resources/types.js +1 -0
  169. package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
  170. package/dist/vendor/core/calendar/resources/views.js +45 -0
  171. package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
  172. package/dist/vendor/core/calendar/resources/windowing.js +17 -0
  173. package/dist/vendor/core/calendar/views/day.d.ts +37 -0
  174. package/dist/vendor/core/calendar/views/day.js +39 -0
  175. package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
  176. package/dist/vendor/core/calendar/views/list-layout.js +5 -0
  177. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
  178. package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
  179. package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
  180. package/dist/vendor/core/calendar/views/month-layout.js +63 -0
  181. package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
  182. package/dist/vendor/core/calendar/views/time-grid-layout.js +30 -0
  183. package/dist/vendor/core/date/index.d.ts +9 -0
  184. package/dist/vendor/core/date/index.js +9 -0
  185. package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
  186. package/dist/vendor/core/date/input/date-input-controller.js +478 -0
  187. package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
  188. package/dist/vendor/core/date/input/date-range-input-controller.js +189 -0
  189. package/dist/vendor/core/date/input/parse.d.ts +22 -0
  190. package/dist/vendor/core/date/input/parse.js +84 -0
  191. package/dist/vendor/core/date/input/validity.d.ts +6 -0
  192. package/dist/vendor/core/date/input/validity.js +13 -0
  193. package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
  194. package/dist/vendor/core/date/panel/panel-controller.js +726 -0
  195. package/dist/vendor/core/date/presets.d.ts +22 -0
  196. package/dist/vendor/core/date/presets.js +104 -0
  197. package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
  198. package/dist/vendor/core/date/selection/multiple.js +32 -0
  199. package/dist/vendor/core/date/selection/range.d.ts +29 -0
  200. package/dist/vendor/core/date/selection/range.js +39 -0
  201. package/dist/vendor/core/date/types.d.ts +12 -0
  202. package/dist/vendor/core/date/types.js +1 -0
  203. package/dist/vendor/core/datetime/compose.d.ts +24 -0
  204. package/dist/vendor/core/datetime/compose.js +49 -0
  205. package/dist/vendor/core/datetime/constraints.d.ts +42 -0
  206. package/dist/vendor/core/datetime/constraints.js +56 -0
  207. package/dist/vendor/core/datetime/index.d.ts +9 -0
  208. package/dist/vendor/core/datetime/index.js +9 -0
  209. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
  210. package/dist/vendor/core/datetime/input/datetime-input-controller.js +395 -0
  211. package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
  212. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +182 -0
  213. package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
  214. package/dist/vendor/core/datetime/input/parse.js +59 -0
  215. package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
  216. package/dist/vendor/core/datetime/panel/controller.js +197 -0
  217. package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
  218. package/dist/vendor/core/datetime/panel/range-controller.js +217 -0
  219. package/dist/vendor/core/datetime/types.d.ts +12 -0
  220. package/dist/vendor/core/datetime/types.js +1 -0
  221. package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
  222. package/dist/vendor/core/datetime/zone/day-instants.js +54 -0
  223. package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
  224. package/dist/vendor/core/datetime/zone/resolve.js +26 -0
  225. package/dist/vendor/core/foundation/a11y/announcer.d.ts +7 -0
  226. package/dist/vendor/core/foundation/a11y/announcer.js +36 -0
  227. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
  228. package/dist/vendor/core/foundation/a11y/grid-navigation.js +86 -0
  229. package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
  230. package/dist/vendor/core/foundation/a11y/index.js +5 -0
  231. package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
  232. package/dist/vendor/core/foundation/a11y/labels.js +43 -0
  233. package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
  234. package/dist/vendor/core/foundation/a11y/messages.js +74 -0
  235. package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
  236. package/dist/vendor/core/foundation/a11y/roving-focus.js +52 -0
  237. package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
  238. package/dist/vendor/core/foundation/constraints/availability-rules.js +66 -0
  239. package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
  240. package/dist/vendor/core/foundation/constraints/availability.js +490 -0
  241. package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
  242. package/dist/vendor/core/foundation/constraints/date.js +41 -0
  243. package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
  244. package/dist/vendor/core/foundation/constraints/index.js +4 -0
  245. package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
  246. package/dist/vendor/core/foundation/constraints/range.js +70 -0
  247. package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
  248. package/dist/vendor/core/foundation/constraints/time.js +56 -0
  249. package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
  250. package/dist/vendor/core/foundation/grid/index.js +4 -0
  251. package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
  252. package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
  253. package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
  254. package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
  255. package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
  256. package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
  257. package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
  258. package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
  259. package/dist/vendor/core/foundation/index.d.ts +8 -0
  260. package/dist/vendor/core/foundation/index.js +8 -0
  261. package/dist/vendor/core/foundation/input/form.d.ts +7 -0
  262. package/dist/vendor/core/foundation/input/form.js +10 -0
  263. package/dist/vendor/core/foundation/input/index.d.ts +6 -0
  264. package/dist/vendor/core/foundation/input/index.js +3 -0
  265. package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
  266. package/dist/vendor/core/foundation/input/segment-engine.js +49 -0
  267. package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
  268. package/dist/vendor/core/foundation/input/tokenize.js +24 -0
  269. package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
  270. package/dist/vendor/core/foundation/locale/digits.js +35 -0
  271. package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
  272. package/dist/vendor/core/foundation/locale/direction.js +37 -0
  273. package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
  274. package/dist/vendor/core/foundation/locale/format.js +79 -0
  275. package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
  276. package/dist/vendor/core/foundation/locale/hour-cycle.js +45 -0
  277. package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
  278. package/dist/vendor/core/foundation/locale/index.js +8 -0
  279. package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
  280. package/dist/vendor/core/foundation/locale/names.js +30 -0
  281. package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
  282. package/dist/vendor/core/foundation/locale/resolve.js +29 -0
  283. package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
  284. package/dist/vendor/core/foundation/locale/week-info.js +61 -0
  285. package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
  286. package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
  287. package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
  288. package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
  289. package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
  290. package/dist/vendor/core/foundation/ranges/index.js +2 -0
  291. package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
  292. package/dist/vendor/core/foundation/ranges/interval.js +56 -0
  293. package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
  294. package/dist/vendor/core/foundation/store/attributes.js +43 -0
  295. package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
  296. package/dist/vendor/core/foundation/store/controllable.js +50 -0
  297. package/dist/vendor/core/foundation/store/env.d.ts +1 -0
  298. package/dist/vendor/core/foundation/store/env.js +3 -0
  299. package/dist/vendor/core/foundation/store/global-state.d.ts +1 -0
  300. package/dist/vendor/core/foundation/store/global-state.js +21 -0
  301. package/dist/vendor/core/foundation/store/ids.d.ts +2 -0
  302. package/dist/vendor/core/foundation/store/ids.js +7 -0
  303. package/dist/vendor/core/foundation/store/index.d.ts +11 -0
  304. package/dist/vendor/core/foundation/store/index.js +7 -0
  305. package/dist/vendor/core/foundation/store/store.d.ts +7 -0
  306. package/dist/vendor/core/foundation/store/store.js +25 -0
  307. package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
  308. package/dist/vendor/core/foundation/store/ticker.js +27 -0
  309. package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
  310. package/dist/vendor/core/foundation/values/clock.js +21 -0
  311. package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
  312. package/dist/vendor/core/foundation/values/compare.js +70 -0
  313. package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
  314. package/dist/vendor/core/foundation/values/convert.js +112 -0
  315. package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
  316. package/dist/vendor/core/foundation/values/epoch-day.js +47 -0
  317. package/dist/vendor/core/foundation/values/index.d.ts +14 -0
  318. package/dist/vendor/core/foundation/values/index.js +10 -0
  319. package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
  320. package/dist/vendor/core/foundation/values/iso.js +113 -0
  321. package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
  322. package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
  323. package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
  324. package/dist/vendor/core/foundation/values/plain-date.js +105 -0
  325. package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
  326. package/dist/vendor/core/foundation/values/plain-time.js +45 -0
  327. package/dist/vendor/core/foundation/values/types.d.ts +37 -0
  328. package/dist/vendor/core/foundation/values/types.js +1 -0
  329. package/dist/vendor/core/foundation/values/week.d.ts +9 -0
  330. package/dist/vendor/core/foundation/values/week.js +31 -0
  331. package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
  332. package/dist/vendor/core/foundation/values/year-month.js +19 -0
  333. package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
  334. package/dist/vendor/core/foundation/values/zoned.js +155 -0
  335. package/dist/vendor/core/index.d.ts +5 -0
  336. package/dist/vendor/core/index.js +5 -0
  337. package/dist/vendor/core/time/index.d.ts +8 -0
  338. package/dist/vendor/core/time/index.js +8 -0
  339. package/dist/vendor/core/time/input/parse.d.ts +19 -0
  340. package/dist/vendor/core/time/input/parse.js +84 -0
  341. package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
  342. package/dist/vendor/core/time/input/time-input-controller.js +562 -0
  343. package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
  344. package/dist/vendor/core/time/input/time-range-input-controller.js +185 -0
  345. package/dist/vendor/core/time/input/validity.d.ts +7 -0
  346. package/dist/vendor/core/time/input/validity.js +16 -0
  347. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
  348. package/dist/vendor/core/time/panel/time-panel-controller.js +839 -0
  349. package/dist/vendor/core/time/selection/range.d.ts +25 -0
  350. package/dist/vendor/core/time/selection/range.js +35 -0
  351. package/dist/vendor/core/time/selection/slots.d.ts +46 -0
  352. package/dist/vendor/core/time/selection/slots.js +78 -0
  353. package/dist/vendor/core/time/types.d.ts +11 -0
  354. package/dist/vendor/core/time/types.js +1 -0
  355. package/package.json +90 -4
@@ -0,0 +1,17 @@
1
+ export { coveredDays, normalizeEvents, wallSecondsOf } from "./normalize.js";
2
+ export type { NormalizeOptions } from "./normalize.js";
3
+ export { compareEventIds, compareMonthSegments } from "./sort.js";
4
+ export type { SortableSegment } from "./sort.js";
5
+ export { layoutMonthEvents } from "./month-layout.js";
6
+ export type { MonthLayoutEventsOptions } from "./month-layout.js";
7
+ export { layoutAllDayRow } from "./all-day-row.js";
8
+ export type { AllDayRowOptions } from "./all-day-row.js";
9
+ export { layoutTimeGridEvents } from "./time-grid-layout.js";
10
+ export type { TimeGridEventsOptions } from "./time-grid-layout.js";
11
+ export { getNowIndicator } from "./now-indicator.js";
12
+ export type { NowIndicator, NowIndicatorDay } from "./now-indicator.js";
13
+ export { layoutAgenda } from "./agenda-layout.js";
14
+ export type { AgendaDay, AgendaOptions } from "./agenda-layout.js";
15
+ export { applyEventLimit, applyPieceLimit } from "./overflow.js";
16
+ export type { DayOverflow, OverflowResult } from "./overflow.js";
17
+ export type { AgendaItem, AllDayRowSegment, CalendarEventInput, CalendarEvents, EventId, EventSegmentBase, MonthEventLayout, MonthSegment, NormalizedEvent, SelectionProposal, TimeGridSegment, } from "./types.js";
@@ -0,0 +1,8 @@
1
+ export { coveredDays, normalizeEvents, wallSecondsOf } from "./normalize.js";
2
+ export { compareEventIds, compareMonthSegments } from "./sort.js";
3
+ export { layoutMonthEvents } from "./month-layout.js";
4
+ export { layoutAllDayRow } from "./all-day-row.js";
5
+ export { layoutTimeGridEvents } from "./time-grid-layout.js";
6
+ export { getNowIndicator } from "./now-indicator.js";
7
+ export { layoutAgenda } from "./agenda-layout.js";
8
+ export { applyEventLimit, applyPieceLimit } from "./overflow.js";
@@ -0,0 +1,13 @@
1
+ import { type PlainDateTime } from "../../foundation/index.js";
2
+ import type { CalendarEventInput, MonthEventLayout, MonthSegment, NormalizedEvent } from "./types.js";
3
+ export type MonthLayoutEventsOptions = {
4
+ /** Wall time in the display zone, used to set `past` (plan 05 E19). */
5
+ now?: PlainDateTime;
6
+ };
7
+ /**
8
+ * Lay out normalized events into month segments (plan 05 §2.3): split each
9
+ * event per week row, sort with the E6 order and pack lanes first-fit.
10
+ * All-day events become one spanning piece per week row; timed events become
11
+ * one piece per day they cover.
12
+ */
13
+ export declare function layoutMonthEvents<T extends CalendarEventInput>(events: readonly NormalizedEvent<T>[], layout: MonthEventLayout, options?: MonthLayoutEventsOptions): MonthSegment<T>[];
@@ -0,0 +1,156 @@
1
+ import { compare, toEpochDay, } from "../../foundation/index.js";
2
+ import { coveredDays } from "./normalize.js";
3
+ import { compareMonthSegments } from "./sort.js";
4
+ /**
5
+ * The month grid that owns each visible day. A day that exists twice in a
6
+ * multi-month layout (once in-month, once as an adjacent day) is hosted by its
7
+ * in-month grid only; leading/trailing adjacent days with no in-month grid in
8
+ * the layout fall back to the grid that shows them (plan 05 13.6).
9
+ */
10
+ function buildHostMap(layout) {
11
+ const host = new Map();
12
+ const visit = (outsideMonth) => {
13
+ layout.months.forEach((month, monthIndex) => {
14
+ month.weeks.forEach((week, weekIndex) => {
15
+ week.days
16
+ .filter((day) => !day.hidden)
17
+ .forEach((day, column) => {
18
+ if (day.outsideMonth !== outsideMonth) {
19
+ return;
20
+ }
21
+ const epoch = toEpochDay(day.date);
22
+ if (!outsideMonth || !host.has(epoch)) {
23
+ host.set(epoch, {
24
+ month: monthIndex,
25
+ week: weekIndex,
26
+ column,
27
+ key: day.key,
28
+ });
29
+ }
30
+ });
31
+ });
32
+ });
33
+ };
34
+ visit(false); // in-month days win
35
+ visit(true); // leading/trailing adjacent days fill the gaps
36
+ return host;
37
+ }
38
+ /**
39
+ * Lay out normalized events into month segments (plan 05 §2.3): split each
40
+ * event per week row, sort with the E6 order and pack lanes first-fit.
41
+ * All-day events become one spanning piece per week row; timed events become
42
+ * one piece per day they cover.
43
+ */
44
+ export function layoutMonthEvents(events, layout, options = {}) {
45
+ const host = buildHostMap(layout);
46
+ const now = options.now;
47
+ const pieces = [];
48
+ for (const event of events) {
49
+ const { firstDay, lastDay } = coveredDays(event.start, event.end, event.allDay);
50
+ const rows = new Map();
51
+ for (let day = firstDay; day <= lastDay; day += 1) {
52
+ const cell = host.get(day);
53
+ if (!cell) {
54
+ continue; // hidden day, or an adjacent-day duplicate
55
+ }
56
+ const rowKey = `${cell.month}:${cell.week}`;
57
+ let row = rows.get(rowKey);
58
+ if (!row) {
59
+ row = { month: cell.month, week: cell.week, cells: [] };
60
+ rows.set(rowKey, row);
61
+ }
62
+ row.cells.push({ column: cell.column, day, key: cell.key });
63
+ }
64
+ for (const row of rows.values()) {
65
+ row.cells.sort((a, b) => a.column - b.column);
66
+ const first = row.cells[0];
67
+ const last = row.cells[row.cells.length - 1];
68
+ const base = {
69
+ event: event.event,
70
+ start: event.start,
71
+ end: event.end,
72
+ past: now !== undefined && compare(event.end, now) <= 0,
73
+ recurrence: event.recurrence,
74
+ };
75
+ if (event.allDay) {
76
+ pieces.push({
77
+ month: row.month,
78
+ week: row.week,
79
+ segment: {
80
+ ...base,
81
+ key: `${event.key}:${first.key}`,
82
+ allDay: true,
83
+ continuesBefore: first.day > firstDay,
84
+ continuesAfter: last.day < lastDay,
85
+ month: row.month,
86
+ week: row.week,
87
+ startColumn: first.column,
88
+ days: row.cells.length,
89
+ lane: 0,
90
+ hidden: false,
91
+ },
92
+ });
93
+ }
94
+ else {
95
+ for (const cell of row.cells) {
96
+ pieces.push({
97
+ month: row.month,
98
+ week: row.week,
99
+ segment: {
100
+ ...base,
101
+ key: `${event.key}:${cell.key}`,
102
+ allDay: false,
103
+ continuesBefore: cell.day > firstDay,
104
+ continuesAfter: cell.day < lastDay,
105
+ month: row.month,
106
+ week: row.week,
107
+ startColumn: cell.column,
108
+ days: 1,
109
+ lane: 0,
110
+ hidden: false,
111
+ },
112
+ });
113
+ }
114
+ }
115
+ }
116
+ }
117
+ // Group by week row, sort with the E6 order and assign lanes first-fit.
118
+ const groups = new Map();
119
+ for (const piece of pieces) {
120
+ const key = `${piece.month}:${piece.week}`;
121
+ const list = groups.get(key) ?? [];
122
+ groups.set(key, list);
123
+ list.push(piece.segment);
124
+ }
125
+ const result = [];
126
+ for (const group of groups.values()) {
127
+ group.sort(compareMonthSegments);
128
+ const lanes = [];
129
+ for (const segment of group) {
130
+ let lane = 0;
131
+ while (laneOverlaps(lanes[lane], segment.startColumn, segment.days)) {
132
+ lane += 1;
133
+ }
134
+ if (!lanes[lane]) {
135
+ lanes[lane] = new Set();
136
+ }
137
+ const occupied = lanes[lane];
138
+ for (let c = segment.startColumn; c < segment.startColumn + segment.days; c += 1) {
139
+ occupied.add(c);
140
+ }
141
+ result.push({ ...segment, lane });
142
+ }
143
+ }
144
+ return result;
145
+ }
146
+ function laneOverlaps(occupied, start, days) {
147
+ if (!occupied) {
148
+ return false;
149
+ }
150
+ for (let c = start; c < start + days; c += 1) {
151
+ if (occupied.has(c)) {
152
+ return true;
153
+ }
154
+ }
155
+ return false;
156
+ }
@@ -0,0 +1,33 @@
1
+ import { type DateRange, type PlainDateTime } from "../../foundation/index.js";
2
+ import type { RecurrencePack, RRuleError } from "../recurrence/types.js";
3
+ import type { CalendarEventInput, NormalizedEvent } from "./types.js";
4
+ export type NormalizeOptions = {
5
+ /** Events fully outside this range are dropped (plan 05 §2.2). */
6
+ visibleRange: DateRange;
7
+ /** Display zone. Defaults to `"UTC"`, never the host zone. */
8
+ timeZone?: string;
9
+ /** The opt-in recurrence pack (plan 12 RR2). */
10
+ recurrence?: RecurrencePack;
11
+ onRecurrenceError?: (event: CalendarEventInput, error: RRuleError) => void;
12
+ };
13
+ /** One development warning per cause per process (plan 13). */
14
+ export declare function warnOnce(message: string): void;
15
+ /** Inclusive `[first, last]` day span an event covers (all-day end is exclusive). */
16
+ export declare function coveredDays(start: PlainDateTime, end: PlainDateTime, allDay: boolean): {
17
+ firstDay: number;
18
+ lastDay: number;
19
+ };
20
+ /** Wall-clock seconds since epoch as if the value were UTC (no host zone). */
21
+ export declare function wallSecondsOf(value: PlainDateTime): number;
22
+ /**
23
+ * Parse one event into display-zone wall time and resolve all-day and reversed
24
+ * ranges (plan 05 §2.2). No range filtering or id dedupe.
25
+ */
26
+ export declare function normalizeEventInput<T extends CalendarEventInput>(event: T, timeZone?: string): NormalizedEvent<T>;
27
+ /**
28
+ * Parse events into display-zone wall time, resolve all-day, swap reversed
29
+ * ranges, dedupe ids and drop events fully outside `visibleRange` (plan 05 §2.2).
30
+ * With a recurrence pack, series are expanded and overrides resolved first
31
+ * (plan 12 RR2/RR6).
32
+ */
33
+ export declare function normalizeEvents<T extends CalendarEventInput>(events: readonly T[], options: NormalizeOptions): NormalizedEvent<T>[];
@@ -0,0 +1,159 @@
1
+ import { addDays, compare, plainDateTime, toEpochDay, toPlainDate, toPlainDateTime, toSecondOfDay, } from "../../foundation/index.js";
2
+ const MIDNIGHT = { hour: 0, minute: 0, second: 0 };
3
+ const warned = new Set();
4
+ /** One development warning per cause per process (plan 13). */
5
+ export function warnOnce(message) {
6
+ if (warned.has(message)) {
7
+ return;
8
+ }
9
+ warned.add(message);
10
+ console.warn(message);
11
+ }
12
+ const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
13
+ function isDateOnlyValue(value) {
14
+ if (typeof value === "string") {
15
+ return DATE_ONLY.test(value);
16
+ }
17
+ if (value instanceof Date) {
18
+ return false;
19
+ }
20
+ return !("hour" in value);
21
+ }
22
+ /** `allDay` is explicit, else inferred from a date-only `start` (plan 05 E2/R4). */
23
+ function resolveAllDay(event, start) {
24
+ return event.allDay === undefined ? isDateOnlyValue(start) : event.allDay;
25
+ }
26
+ /** An endpoint as wall time in the display zone (all-day: midnight of the date). */
27
+ function toWallTime(input, allDay, timeZone) {
28
+ if (allDay) {
29
+ return plainDateTime(toPlainDate(input, timeZone), MIDNIGHT);
30
+ }
31
+ return toPlainDateTime(input, timeZone);
32
+ }
33
+ /** The distinct resource ids of an event input (plan 10 R2). */
34
+ function resourceIdsOf(value) {
35
+ if (value === undefined) {
36
+ return undefined;
37
+ }
38
+ const list = Array.isArray(value)
39
+ ? value
40
+ : [value];
41
+ const seen = new Set();
42
+ return list.filter((id) => {
43
+ const key = String(id);
44
+ if (seen.has(key)) {
45
+ return false;
46
+ }
47
+ seen.add(key);
48
+ return true;
49
+ });
50
+ }
51
+ /** Inclusive `[first, last]` day span an event covers (all-day end is exclusive). */
52
+ export function coveredDays(start, end, allDay) {
53
+ const firstDay = toEpochDay(start);
54
+ const endsAtMidnight = end.hour === 0 && end.minute === 0 && end.second === 0;
55
+ const lastDay = allDay
56
+ ? toEpochDay(end) - 1
57
+ : toEpochDay(end) - (endsAtMidnight ? 1 : 0);
58
+ return { firstDay, lastDay };
59
+ }
60
+ /** Wall-clock seconds since epoch as if the value were UTC (no host zone). */
61
+ export function wallSecondsOf(value) {
62
+ return toEpochDay(value) * 86400 + toSecondOfDay(value);
63
+ }
64
+ /**
65
+ * Parse one event into display-zone wall time and resolve all-day and reversed
66
+ * ranges (plan 05 §2.2). No range filtering or id dedupe.
67
+ */
68
+ export function normalizeEventInput(event, timeZone = "UTC") {
69
+ const allDay = resolveAllDay(event, event.start);
70
+ let start = toWallTime(event.start, allDay, timeZone);
71
+ const rawEnd = event.end;
72
+ let end;
73
+ if (rawEnd == null) {
74
+ end = allDay ? plainDateTime(addDays(start, 1), MIDNIGHT) : start;
75
+ warnOnce(`[chrono] Event "${String(event.id)}" has no end; treated as ${allDay ? "one day" : "zero length"}.`);
76
+ }
77
+ else {
78
+ end = toWallTime(rawEnd, allDay, timeZone);
79
+ }
80
+ if (allDay) {
81
+ const startDay = toEpochDay(start);
82
+ const endDay = toEpochDay(end);
83
+ if (endDay === startDay) {
84
+ // A one-day event: `{ start: "2026-11-17", end: "2026-11-17" }` (E3).
85
+ end = plainDateTime(addDays(start, 1), MIDNIGHT);
86
+ warnOnce(`[chrono] All-day event "${String(event.id)}" has end === start; treated as one day.`);
87
+ }
88
+ else if (endDay < startDay) {
89
+ const tmp = start;
90
+ start = end;
91
+ end = tmp;
92
+ warnOnce(`[chrono] All-day event "${String(event.id)}" has end before start; swapped.`);
93
+ }
94
+ }
95
+ else if (compare(end, start) < 0) {
96
+ const tmp = start;
97
+ start = end;
98
+ end = tmp;
99
+ warnOnce(`[chrono] Event "${String(event.id)}" has end before start; swapped.`);
100
+ }
101
+ return {
102
+ id: event.id,
103
+ key: String(event.id),
104
+ event,
105
+ start,
106
+ end,
107
+ allDay,
108
+ recurringId: event.recurringId,
109
+ calendarId: event.calendarId,
110
+ resourceIds: resourceIdsOf(event.resourceId),
111
+ };
112
+ }
113
+ /**
114
+ * Parse events into display-zone wall time, resolve all-day, swap reversed
115
+ * ranges, dedupe ids and drop events fully outside `visibleRange` (plan 05 §2.2).
116
+ * With a recurrence pack, series are expanded and overrides resolved first
117
+ * (plan 12 RR2/RR6).
118
+ */
119
+ export function normalizeEvents(events, options) {
120
+ const timeZone = options.timeZone ?? "UTC";
121
+ if (options.recurrence) {
122
+ const occurrences = options.recurrence.expand(events, {
123
+ visibleRange: options.visibleRange,
124
+ timeZone,
125
+ onRecurrenceError: options.onRecurrenceError,
126
+ });
127
+ return occurrences.map((occurrence) => ({
128
+ id: occurrence.event.id,
129
+ key: occurrence.key,
130
+ event: occurrence.event,
131
+ start: occurrence.start,
132
+ end: occurrence.end,
133
+ allDay: occurrence.allDay,
134
+ recurringId: occurrence.event.recurringId,
135
+ calendarId: occurrence.event.calendarId,
136
+ resourceIds: resourceIdsOf(occurrence.event.resourceId),
137
+ recurrence: occurrence.recurrence,
138
+ }));
139
+ }
140
+ const rangeStart = toEpochDay(options.visibleRange.start);
141
+ const rangeEnd = toEpochDay(options.visibleRange.end);
142
+ const seen = new Map();
143
+ const result = [];
144
+ for (const event of events) {
145
+ const parsed = normalizeEventInput(event, timeZone);
146
+ const { firstDay, lastDay } = coveredDays(parsed.start, parsed.end, parsed.allDay);
147
+ if (lastDay < rangeStart || firstDay > rangeEnd) {
148
+ continue; // fully outside the visible range
149
+ }
150
+ const count = seen.get(event.id) ?? 0;
151
+ seen.set(event.id, count + 1);
152
+ const key = count === 0 ? String(event.id) : `${String(event.id)}#${count}`;
153
+ if (count > 0) {
154
+ warnOnce(`[chrono] Duplicate event id "${String(event.id)}".`);
155
+ }
156
+ result.push({ ...parsed, key });
157
+ }
158
+ return result;
159
+ }
@@ -0,0 +1,18 @@
1
+ import { type PlainDate, type PlainDateTime, type PlainTime } from "../../foundation/index.js";
2
+ export type NowIndicator = {
3
+ dayKey: string;
4
+ top: number;
5
+ };
6
+ export type NowIndicatorDay = {
7
+ date: PlainDate;
8
+ key: string;
9
+ };
10
+ /**
11
+ * The now-indicator position (plan 05 §2.4 step 4): `{ dayKey, top }` when the
12
+ * current time falls inside a visible day and the time axis, else `null`.
13
+ * `top` is a fraction 0–1 of the axis `[dayStart, dayEnd)`.
14
+ */
15
+ export declare function getNowIndicator(now: PlainDateTime, days: readonly NowIndicatorDay[], options?: {
16
+ dayStart?: PlainTime;
17
+ dayEnd?: PlainTime;
18
+ }): NowIndicator | null;
@@ -0,0 +1,19 @@
1
+ import { plainDate, toIsoString, toSecondOfDay, } from "../../foundation/index.js";
2
+ /**
3
+ * The now-indicator position (plan 05 §2.4 step 4): `{ dayKey, top }` when the
4
+ * current time falls inside a visible day and the time axis, else `null`.
5
+ * `top` is a fraction 0–1 of the axis `[dayStart, dayEnd)`.
6
+ */
7
+ export function getNowIndicator(now, days, options = {}) {
8
+ const axisStart = options.dayStart ? toSecondOfDay(options.dayStart) : 0;
9
+ const axisEnd = options.dayEnd ? toSecondOfDay(options.dayEnd) : 86400;
10
+ const dayKey = toIsoString(plainDate(now.year, now.month, now.day));
11
+ if (!days.some((day) => day.key === dayKey)) {
12
+ return null;
13
+ }
14
+ const second = toSecondOfDay(now);
15
+ if (second < axisStart || second >= axisEnd) {
16
+ return null;
17
+ }
18
+ return { dayKey, top: (second - axisStart) / (axisEnd - axisStart) };
19
+ }
@@ -0,0 +1,36 @@
1
+ import type { CalendarEventInput, MonthEventLayout, MonthSegment } from "./types.js";
2
+ /** One day's overflow (plan 05 §2.3, 13.3). */
3
+ export type DayOverflow<TEvent extends CalendarEventInput = CalendarEventInput> = {
4
+ /** ISO date of the overflowing day. */
5
+ dayKey: string;
6
+ /** Number of hidden pieces on that day. */
7
+ count: number;
8
+ /** The hidden events, for `onMoreActivate` (deduplicated). */
9
+ events: TEvent[];
10
+ };
11
+ export type OverflowResult<TEvent extends CalendarEventInput = CalendarEventInput> = {
12
+ segments: MonthSegment<TEvent>[];
13
+ more: DayOverflow<TEvent>[];
14
+ };
15
+ /** A piece the overflow limit can act on. */
16
+ type PieceLike = {
17
+ startColumn: number;
18
+ days: number;
19
+ lane: number;
20
+ hidden: boolean;
21
+ event: CalendarEventInput;
22
+ };
23
+ /**
24
+ * The overflow rule shared by the month view and the all-day row (plan 05 E7):
25
+ * a day with more than `limit` lanes shows only lanes `0..limit-2` and counts
26
+ * the rest as "+N more". A piece hidden on some days and visible on others is
27
+ * split so each run has one `hidden` flag (13.3). No `limit` (or a non-positive
28
+ * one) leaves everything visible.
29
+ */
30
+ export declare function applyPieceLimit<P extends PieceLike>(pieces: readonly P[], limit: number | undefined, groupKey: (piece: P) => string, columnKey: (piece: P, column: number) => string | undefined): {
31
+ pieces: P[];
32
+ more: DayOverflow<P["event"]>[];
33
+ };
34
+ /** Apply an `eventLimit` to month segments (plan 05 E7). */
35
+ export declare function applyEventLimit<T extends CalendarEventInput>(segments: readonly MonthSegment<T>[], limit: number | undefined, layout: MonthEventLayout): OverflowResult<T>;
36
+ export {};
@@ -0,0 +1,112 @@
1
+ function isHiddenOn(lane, column, lanesAt, limit) {
2
+ const lanes = lanesAt.get(column);
3
+ // With limit L, lanes 0..L-2 stay visible only when a day has more than L lanes.
4
+ return lanes !== undefined && lanes.size > limit && lane >= limit - 1;
5
+ }
6
+ /**
7
+ * The overflow rule shared by the month view and the all-day row (plan 05 E7):
8
+ * a day with more than `limit` lanes shows only lanes `0..limit-2` and counts
9
+ * the rest as "+N more". A piece hidden on some days and visible on others is
10
+ * split so each run has one `hidden` flag (13.3). No `limit` (or a non-positive
11
+ * one) leaves everything visible.
12
+ */
13
+ export function applyPieceLimit(pieces, limit, groupKey, columnKey) {
14
+ if (limit === undefined || !Number.isFinite(limit) || limit <= 0) {
15
+ return {
16
+ pieces: pieces.map((piece) => ({ ...piece, hidden: false })),
17
+ more: [],
18
+ };
19
+ }
20
+ const groups = new Map();
21
+ for (const piece of pieces) {
22
+ const key = groupKey(piece);
23
+ const list = groups.get(key) ?? [];
24
+ groups.set(key, list);
25
+ list.push(piece);
26
+ }
27
+ const out = [];
28
+ for (const group of groups.values()) {
29
+ const lanesAt = new Map();
30
+ for (const piece of group) {
31
+ for (let c = piece.startColumn; c < piece.startColumn + piece.days; c += 1) {
32
+ const lanes = lanesAt.get(c) ?? new Set();
33
+ lanes.add(piece.lane);
34
+ lanesAt.set(c, lanes);
35
+ }
36
+ }
37
+ for (const piece of group) {
38
+ const runs = [];
39
+ let start = piece.startColumn;
40
+ let hidden = isHiddenOn(piece.lane, start, lanesAt, limit);
41
+ for (let c = piece.startColumn + 1; c < piece.startColumn + piece.days; c += 1) {
42
+ const next = isHiddenOn(piece.lane, c, lanesAt, limit);
43
+ if (next !== hidden) {
44
+ runs.push({ start, days: c - start, hidden });
45
+ start = c;
46
+ hidden = next;
47
+ }
48
+ }
49
+ runs.push({
50
+ start,
51
+ days: piece.startColumn + piece.days - start,
52
+ hidden,
53
+ });
54
+ for (const run of runs) {
55
+ out.push({
56
+ ...piece,
57
+ startColumn: run.start,
58
+ days: run.days,
59
+ hidden: run.hidden,
60
+ });
61
+ }
62
+ }
63
+ }
64
+ const more = new Map();
65
+ for (const piece of out) {
66
+ if (!piece.hidden) {
67
+ continue;
68
+ }
69
+ for (let c = piece.startColumn; c < piece.startColumn + piece.days; c += 1) {
70
+ const dayKey = columnKey(piece, c);
71
+ if (!dayKey) {
72
+ continue;
73
+ }
74
+ const entry = more.get(dayKey) ?? {
75
+ count: 0,
76
+ events: new Set(),
77
+ };
78
+ entry.count += 1;
79
+ entry.events.add(piece.event);
80
+ more.set(dayKey, entry);
81
+ }
82
+ }
83
+ return {
84
+ pieces: out,
85
+ more: [...more.entries()]
86
+ .map(([dayKey, entry]) => ({
87
+ dayKey,
88
+ count: entry.count,
89
+ events: [...entry.events],
90
+ }))
91
+ .sort((a, b) => (a.dayKey < b.dayKey ? -1 : a.dayKey > b.dayKey ? 1 : 0)),
92
+ };
93
+ }
94
+ function columnKeys(layout) {
95
+ const keys = new Map();
96
+ layout.months.forEach((month, monthIndex) => {
97
+ month.weeks.forEach((week, weekIndex) => {
98
+ week.days
99
+ .filter((day) => !day.hidden)
100
+ .forEach((day, column) => {
101
+ keys.set(`${monthIndex}:${weekIndex}:${column}`, day.key);
102
+ });
103
+ });
104
+ });
105
+ return keys;
106
+ }
107
+ /** Apply an `eventLimit` to month segments (plan 05 E7). */
108
+ export function applyEventLimit(segments, limit, layout) {
109
+ const keys = columnKeys(layout);
110
+ const { pieces, more } = applyPieceLimit(segments, limit, (segment) => `${segment.month}:${segment.week}`, (segment, column) => keys.get(`${segment.month}:${segment.week}:${column}`));
111
+ return { segments: pieces, more };
112
+ }
@@ -0,0 +1,21 @@
1
+ import { type PlainDateTime } from "../../foundation/index.js";
2
+ import type { EventId } from "./types.js";
3
+ /** Stable order for ids that may be a string or a number (plan 05 E6). */
4
+ export declare function compareEventIds(a: EventId, b: EventId): number;
5
+ /** The fields every sortable piece shares. */
6
+ export type SortableSegment = {
7
+ startColumn: number;
8
+ days: number;
9
+ allDay: boolean;
10
+ start: PlainDateTime;
11
+ event: {
12
+ id: EventId;
13
+ };
14
+ key: string;
15
+ };
16
+ /**
17
+ * The month (and all-day row) sort order (plan 05 E6): start column, longer
18
+ * span first, all-day before timed, start time, then id (and the unique key as
19
+ * the final tie-break so output is deterministic).
20
+ */
21
+ export declare function compareMonthSegments(a: SortableSegment, b: SortableSegment): number;
@@ -0,0 +1,35 @@
1
+ import { compare } from "../../foundation/index.js";
2
+ /** Stable order for ids that may be a string or a number (plan 05 E6). */
3
+ export function compareEventIds(a, b) {
4
+ if (typeof a === "number" && typeof b === "number") {
5
+ return a - b;
6
+ }
7
+ const x = String(a);
8
+ const y = String(b);
9
+ return x < y ? -1 : x > y ? 1 : 0;
10
+ }
11
+ /**
12
+ * The month (and all-day row) sort order (plan 05 E6): start column, longer
13
+ * span first, all-day before timed, start time, then id (and the unique key as
14
+ * the final tie-break so output is deterministic).
15
+ */
16
+ export function compareMonthSegments(a, b) {
17
+ if (a.startColumn !== b.startColumn) {
18
+ return a.startColumn - b.startColumn;
19
+ }
20
+ if (a.days !== b.days) {
21
+ return b.days - a.days;
22
+ }
23
+ if (a.allDay !== b.allDay) {
24
+ return a.allDay ? -1 : 1;
25
+ }
26
+ const time = compare(a.start, b.start);
27
+ if (time !== 0) {
28
+ return time;
29
+ }
30
+ const id = compareEventIds(a.event.id, b.event.id);
31
+ if (id !== 0) {
32
+ return id;
33
+ }
34
+ return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
35
+ }
@@ -0,0 +1,22 @@
1
+ import { type PlainDate, type PlainDateTime, type PlainTime } from "../../foundation/index.js";
2
+ import type { CalendarEventInput, NormalizedEvent, TimeGridSegment } from "./types.js";
3
+ export type TimeGridEventsOptions = {
4
+ dayStart?: PlainTime;
5
+ /** Exclusive; omit for 24:00. */
6
+ dayEnd?: PlainTime;
7
+ /** Minimum drawn height in minutes (plan 05 E4), default 15. */
8
+ minEventDuration?: number;
9
+ /** Timed events of 24h or more move to the all-day row (E5), default `true`. */
10
+ longEventsInAllDayRow?: boolean;
11
+ now?: PlainDateTime;
12
+ };
13
+ /**
14
+ * The timed area of a week / work week / day time grid (plan 05 §2.4): split
15
+ * each event per day, clip to the axis, lay out overlapping events into
16
+ * columns with rightward expansion. All-day and long events are handled by
17
+ * `layoutAllDayRow`, not here.
18
+ */
19
+ export declare function layoutTimeGridEvents<T extends CalendarEventInput>(events: readonly NormalizedEvent<T>[], days: readonly {
20
+ date: PlainDate;
21
+ key: string;
22
+ }[], options?: TimeGridEventsOptions): TimeGridSegment<T>[];