@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,165 @@
1
+ import { compare, fromDate, fromEpochDay, fromSecondOfDay, parseIsoDate, plainDate, plainDateTime, toEpochDay, toIsoString, toPlainDate, toPlainDateTime, toSecondOfDay, } from "../../foundation/index.js";
2
+ import { normalizeEventInput } from "../events/normalize.js";
3
+ import { expandRule } from "./expand.js";
4
+ import { parseRRule } from "./rrule.js";
5
+ const SECONDS_PER_DAY = 86400;
6
+ const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
7
+ const MIDNIGHT = { hour: 0, minute: 0, second: 0 };
8
+ const wallSeconds = (value) => toEpochDay(value) * SECONDS_PER_DAY + toSecondOfDay(value);
9
+ const fromWallSeconds = (seconds) => {
10
+ const day = Math.floor(seconds / SECONDS_PER_DAY);
11
+ return plainDateTime(fromEpochDay(day), fromSecondOfDay(seconds - day * SECONDS_PER_DAY));
12
+ };
13
+ /** A value as wall time in the display zone (all-day: midnight of the date). */
14
+ export function recurrenceWall(value, allDay, timeZone) {
15
+ if (typeof value === "string" && DATE_ONLY.test(value)) {
16
+ return plainDateTime(parseIsoDate(value), MIDNIGHT);
17
+ }
18
+ if (typeof value.getTime === "function") {
19
+ const zoned = fromDate(value, timeZone);
20
+ const date = plainDate(zoned.year, zoned.month, zoned.day);
21
+ return allDay
22
+ ? plainDateTime(date, MIDNIGHT)
23
+ : plainDateTime(date, {
24
+ hour: zoned.hour,
25
+ minute: zoned.minute,
26
+ second: zoned.second,
27
+ });
28
+ }
29
+ if (allDay) {
30
+ return plainDateTime(toPlainDate(value, timeZone), MIDNIGHT);
31
+ }
32
+ return toPlainDateTime(value, timeZone);
33
+ }
34
+ export function isZonedStart(value) {
35
+ if (typeof value === "string") {
36
+ return /(?:Z|[+-]\d{2}:?\d{2})(?:\[[^\]]+\])?$/.test(value);
37
+ }
38
+ return typeof value === "object" && value !== null && "timeZone" in value;
39
+ }
40
+ function overlaps(start, end, range) {
41
+ const from = plainDateTime(range.start, MIDNIGHT);
42
+ const last = plainDateTime(range.end, {
43
+ hour: 23,
44
+ minute: 59,
45
+ second: 59,
46
+ });
47
+ if (compare(start, end) === 0) {
48
+ return compare(start, from) >= 0 && compare(start, last) <= 0;
49
+ }
50
+ return compare(start, last) <= 0 && compare(end, from) > 0;
51
+ }
52
+ function singleOccurrence(series, start, end, allDay) {
53
+ return [
54
+ {
55
+ event: series,
56
+ start,
57
+ end,
58
+ allDay,
59
+ key: `${String(series.id)}:${toIsoString(start)}`,
60
+ recurrence: {
61
+ recurringId: series.id,
62
+ occurrenceStart: start,
63
+ isOverride: false,
64
+ series,
65
+ },
66
+ },
67
+ ];
68
+ }
69
+ /**
70
+ * Expand one series into the occurrences overlapping `range` (plan 12 RR4–RR5).
71
+ * The series' `start` is DTSTART and its `start`/`end` distance is the duration.
72
+ * EXDATE removes generated occurrences after COUNT; RDATE adds occurrences that
73
+ * are not subject to COUNT or UNTIL.
74
+ */
75
+ export function expandRecurrence(series, range, options = {}) {
76
+ if (series.rrule === undefined) {
77
+ return [];
78
+ }
79
+ const timeZone = options.timeZone ?? "UTC";
80
+ const parsed = normalizeEventInput(series, timeZone);
81
+ const allDay = parsed.allDay;
82
+ const zoned = isZonedStart(series.start);
83
+ const durationSeconds = allDay
84
+ ? 0
85
+ : Math.max(0, wallSeconds(parsed.end) - wallSeconds(parsed.start));
86
+ const durationDays = allDay
87
+ ? Math.max(1, toEpochDay(parsed.end) - toEpochDay(parsed.start))
88
+ : 0;
89
+ let rule;
90
+ try {
91
+ rule = parseRRule(series.rrule);
92
+ }
93
+ catch (error) {
94
+ options.onError?.(error);
95
+ return overlaps(parsed.start, parsed.end, range)
96
+ ? singleOccurrence(series, parsed.start, parsed.end, allDay)
97
+ : [];
98
+ }
99
+ const exdates = new Set((series.exdates ?? []).map((value) => toIsoString(recurrenceWall(value, allDay, timeZone))));
100
+ const generated = expandRule(rule, {
101
+ start: parsed.start,
102
+ allDay,
103
+ timeZone,
104
+ zoned,
105
+ durationSeconds,
106
+ durationDays,
107
+ range,
108
+ onError: options.onError,
109
+ });
110
+ const occurrences = new Map();
111
+ const startKey = (value) => toIsoString(value);
112
+ const push = (start, end) => {
113
+ const key = startKey(start);
114
+ if (occurrences.has(key) || exdates.has(key)) {
115
+ return;
116
+ }
117
+ occurrences.set(key, {
118
+ event: series,
119
+ start,
120
+ end,
121
+ allDay,
122
+ key: `${String(series.id)}:${key}`,
123
+ recurrence: {
124
+ recurringId: series.id,
125
+ occurrenceStart: start,
126
+ isOverride: false,
127
+ series,
128
+ },
129
+ });
130
+ };
131
+ for (const occurrence of generated) {
132
+ push(occurrence.start, occurrence.end);
133
+ }
134
+ for (const value of series.rdates ?? []) {
135
+ const start = recurrenceWall(value, allDay, timeZone);
136
+ const end = allDay
137
+ ? plainDateTime(fromEpochDay(toEpochDay(start) + durationDays), MIDNIGHT)
138
+ : fromWallSeconds(wallSeconds(start) + durationSeconds);
139
+ if (overlaps(start, end, range)) {
140
+ push(start, end);
141
+ }
142
+ }
143
+ return [...occurrences.values()].sort((a, b) => compare(a.start, b.start));
144
+ }
145
+ /** The `(series id, original occurrence start)` an override replaces (RR6). */
146
+ export function overrideOf(event, timeZone) {
147
+ const input = event;
148
+ if (input.recurringId === undefined || input.recurrenceId === undefined) {
149
+ return null;
150
+ }
151
+ const parsed = normalizeEventInput(event, timeZone);
152
+ return {
153
+ recurringId: input.recurringId,
154
+ occurrenceStart: recurrenceWall(input.recurrenceId, parsed.allDay, timeZone),
155
+ };
156
+ }
157
+ /** The recurrence data for an override piece (RR6/RR7). */
158
+ export function overrideInfo(series, occurrenceStart) {
159
+ return {
160
+ recurringId: series.id,
161
+ occurrenceStart,
162
+ isOverride: true,
163
+ series,
164
+ };
165
+ }
@@ -0,0 +1,30 @@
1
+ import type { DateRange, PlainDateTime } from "../../foundation/index.js";
2
+ import type { CalendarEventInput, RecurrenceInfo } from "../events/types.js";
3
+ import type { RRuleError } from "./rrule-types.js";
4
+ export type { RRule, RRuleByDay, RRuleError, RRuleErrorCode, RRuleFreq, RRuleUntil, } from "./rrule-types.js";
5
+ export { rruleError } from "./rrule-types.js";
6
+ export type { RecurrenceInfo } from "../events/types.js";
7
+ /** One expanded occurrence, before layout. */
8
+ export type RecurrenceOccurrence<TEvent extends CalendarEventInput> = {
9
+ event: TEvent;
10
+ start: PlainDateTime;
11
+ end: PlainDateTime;
12
+ allDay: boolean;
13
+ key: string;
14
+ recurrence?: RecurrenceInfo<TEvent>;
15
+ };
16
+ export type RecurrenceErrorHandler = (event: CalendarEventInput, error: RRuleError) => void;
17
+ export type RecurrenceExpandOptions = {
18
+ visibleRange: DateRange;
19
+ /** Display zone; the expansion keeps DTSTART's wall time in this zone. */
20
+ timeZone: string;
21
+ /** Called once per series object and error code (plan 12 R5). */
22
+ onRecurrenceError?: RecurrenceErrorHandler;
23
+ };
24
+ /**
25
+ * The opt-in recurrence pack (plan 12 RR2). A plain value: importing
26
+ * `recurrence` is what loads the engine.
27
+ */
28
+ export type RecurrencePack = {
29
+ expand<TEvent extends CalendarEventInput>(events: readonly TEvent[], options: RecurrenceExpandOptions): RecurrenceOccurrence<TEvent>[];
30
+ };
@@ -0,0 +1 @@
1
+ export { rruleError } from "./rrule-types.js";
@@ -0,0 +1,2 @@
1
+ /** Cell key of a resource cell (plan 10 IG4): `<base>@<encoded resource id>`. */
2
+ export declare const resourceCellKey: (base: string, resourceKey: string) => string;
@@ -0,0 +1,2 @@
1
+ /** Cell key of a resource cell (plan 10 IG4): `<base>@<encoded resource id>`. */
2
+ export const resourceCellKey = (base, resourceKey) => `${base}@${encodeURIComponent(resourceKey)}`;
@@ -0,0 +1,7 @@
1
+ import type { CalendarEventInput } from "../events/types.js";
2
+ import type { ResourceBuildContext, ResourceInput, ResourceTimeGridLayout } from "./types.js";
3
+ /**
4
+ * The resource time grid (plan 10 R5): columns are visible days × leaf
5
+ * resources, each laid out independently with the stage-3 algorithm.
6
+ */
7
+ export declare function layoutResourceTimeGrid<TEvent extends CalendarEventInput, TResource extends ResourceInput>(ctx: ResourceBuildContext<TEvent, TResource>): ResourceTimeGridLayout<TEvent, TResource>;
@@ -0,0 +1,130 @@
1
+ import { layoutAllDayRow } from "../events/all-day-row.js";
2
+ import { layoutTimeGridEvents } from "../events/time-grid-layout.js";
3
+ import { buildResourceTree } from "./tree.js";
4
+ import { clampWindow, windowInfo } from "./windowing.js";
5
+ const encode = (key) => encodeURIComponent(key);
6
+ /**
7
+ * The resource time grid (plan 10 R5): columns are visible days × leaf
8
+ * resources, each laid out independently with the stage-3 algorithm.
9
+ */
10
+ export function layoutResourceTimeGrid(ctx) {
11
+ const { rows } = buildResourceTree(ctx.resources, ctx.collapsed, ctx.getLabel);
12
+ const leafRows = rows.filter((row) => !row.group);
13
+ const days = ctx.days;
14
+ const dayCount = days.length;
15
+ const totalColumns = leafRows.length * dayCount;
16
+ const slots = [];
17
+ if (ctx.grouping === "date-first") {
18
+ for (const day of days) {
19
+ for (const row of leafRows)
20
+ slots.push({ row, day });
21
+ }
22
+ }
23
+ else {
24
+ for (const row of leafRows) {
25
+ for (const day of days)
26
+ slots.push({ row, day });
27
+ }
28
+ }
29
+ const window = clampWindow(totalColumns, ctx.resourceWindow);
30
+ const visibleSlots = slots.slice(window.start, window.end);
31
+ const columns = visibleSlots.map((slot, i) => ({
32
+ key: `${slot.row.key}@${slot.day.key}`,
33
+ resourceKey: slot.row.key,
34
+ resourceId: slot.row.id,
35
+ resource: slot.row.resource,
36
+ label: slot.row.label,
37
+ day: slot.day,
38
+ index: window.start + i,
39
+ }));
40
+ const groups = [];
41
+ if (ctx.grouping === "resource-first") {
42
+ for (const row of rows) {
43
+ if (!row.group || !row.expanded)
44
+ continue;
45
+ const under = leafRows.filter((leaf) => isDescendant(row, leaf, rows));
46
+ if (under.length === 0)
47
+ continue;
48
+ const first = leafRows.indexOf(under[0]);
49
+ groups.push({
50
+ key: `group:${row.key}`,
51
+ resourceKey: row.key,
52
+ resource: row.resource,
53
+ label: row.label,
54
+ level: row.level,
55
+ startColumn: first * dayCount,
56
+ colSpan: under.length * dayCount,
57
+ });
58
+ }
59
+ }
60
+ const byResource = new Map();
61
+ for (const event of ctx.events) {
62
+ for (const id of event.resourceIds ?? []) {
63
+ const key = String(id);
64
+ const list = byResource.get(key) ?? [];
65
+ list.push(event);
66
+ byResource.set(key, list);
67
+ }
68
+ }
69
+ const pieces = [];
70
+ const allDay = [];
71
+ for (const column of columns) {
72
+ const events = byResource.get(column.resourceKey) ?? [];
73
+ if (events.length === 0)
74
+ continue;
75
+ const one = [column.day];
76
+ const options = {
77
+ dayStart: ctx.dayStart,
78
+ dayEnd: ctx.dayEnd,
79
+ minEventDuration: ctx.minEventDuration,
80
+ longEventsInAllDayRow: ctx.longEventsInAllDayRow,
81
+ now: ctx.now,
82
+ };
83
+ for (const segment of layoutTimeGridEvents(events, one, options)) {
84
+ pieces.push({
85
+ ...segment,
86
+ key: `${segment.key}@${encode(column.resourceKey)}`,
87
+ resourceKey: column.resourceKey,
88
+ resourceId: column.resourceId,
89
+ columnKey: column.key,
90
+ });
91
+ }
92
+ const row = layoutAllDayRow(events, one, {
93
+ longEventsInAllDayRow: ctx.longEventsInAllDayRow,
94
+ now: ctx.now,
95
+ });
96
+ for (const segment of row.segments) {
97
+ allDay.push({
98
+ ...segment,
99
+ key: `${segment.key}@${encode(column.resourceKey)}`,
100
+ resourceKey: column.resourceKey,
101
+ resourceId: column.resourceId,
102
+ columnKey: column.key,
103
+ });
104
+ }
105
+ }
106
+ const rowStart = leafRows.length
107
+ ? Math.floor(window.start /
108
+ Math.max(1, ctx.grouping === "date-first" ? leafRows.length : dayCount))
109
+ : 0;
110
+ return {
111
+ kind: "resource-time-grid",
112
+ grouping: ctx.grouping,
113
+ rows: leafRows,
114
+ columns,
115
+ groups,
116
+ pieces,
117
+ allDay,
118
+ window: windowInfo(leafRows.length, totalColumns, { start: rowStart }, { start: window.start }),
119
+ };
120
+ }
121
+ function isDescendant(ancestor, node, rows) {
122
+ const byKey = new Map(rows.map((row) => [row.key, row]));
123
+ let current = node.parentKey;
124
+ while (current !== null) {
125
+ if (current === ancestor.key)
126
+ return true;
127
+ current = byKey.get(current)?.parentKey ?? null;
128
+ }
129
+ return false;
130
+ }
@@ -0,0 +1,10 @@
1
+ import { type PlainDate, type PlainDateTime } from "../../foundation/index.js";
2
+ import type { TimelineAxis, TimelineSlotDuration, TimelineUnit } from "./types.js";
3
+ /** `YYYY-MM-DDTHH:mm` of a wall-time value (the slot key base, plan 10 IG4). */
4
+ export declare const slotKeyOf: (value: PlainDateTime) => string;
5
+ export declare function slotSeconds(duration: TimelineSlotDuration): number;
6
+ /**
7
+ * The timeline axis (plan 10 R6): wall-time slots over `days`, and header rows
8
+ * (coarser unit first) whose cells span the slots inside them.
9
+ */
10
+ export declare function buildTimelineAxis(first: PlainDate, dayCount: number, duration: TimelineSlotDuration, headerRows: readonly TimelineUnit[], locale: string | undefined): TimelineAxis;
@@ -0,0 +1,98 @@
1
+ import { fromEpochDay, formatDateTime, plainDateTime, plainTime, toEpochDay, } from "../../foundation/index.js";
2
+ const DAY = 86400;
3
+ const pad = (n) => String(n).padStart(2, "0");
4
+ /** `YYYY-MM-DDTHH:mm` of a wall-time value (the slot key base, plan 10 IG4). */
5
+ export const slotKeyOf = (value) => `${value.year}-${pad(value.month)}-${pad(value.day)}T${pad(value.hour)}:${pad(value.minute)}`;
6
+ export function slotSeconds(duration) {
7
+ if (duration.minutes !== undefined)
8
+ return duration.minutes * 60;
9
+ if (duration.days !== undefined)
10
+ return duration.days * DAY;
11
+ if (duration.weeks !== undefined)
12
+ return duration.weeks * 7 * DAY;
13
+ return 3600;
14
+ }
15
+ const at = (epochSeconds) => {
16
+ const day = Math.floor(epochSeconds / DAY);
17
+ const rest = epochSeconds - day * DAY;
18
+ return plainDateTime(fromEpochDay(day), plainTime(Math.floor(rest / 3600), Math.floor((rest % 3600) / 60), rest % 60));
19
+ };
20
+ /** The bucket id of `value` in `unit`; slots with the same id share a header cell. */
21
+ function bucket(value, unit) {
22
+ const day = toEpochDay(value);
23
+ switch (unit) {
24
+ case "month":
25
+ return `${value.year}-${pad(value.month)}`;
26
+ case "week":
27
+ // Monday-based week: epoch day 0 is a Thursday.
28
+ return `W${Math.floor((day + 3) / 7)}`;
29
+ case "day":
30
+ return `${value.year}-${pad(value.month)}-${pad(value.day)}`;
31
+ case "hour":
32
+ return `${value.year}-${pad(value.month)}-${pad(value.day)}T${pad(value.hour)}`;
33
+ default:
34
+ return slotKeyOf(value);
35
+ }
36
+ }
37
+ function labelOf(value, unit, locale) {
38
+ switch (unit) {
39
+ case "month":
40
+ return formatDateTime(value, locale, { month: "long", year: "numeric" });
41
+ case "week":
42
+ case "day":
43
+ return formatDateTime(value, locale, {
44
+ weekday: "short",
45
+ month: "short",
46
+ day: "numeric",
47
+ });
48
+ case "hour":
49
+ return formatDateTime(value, locale, { hour: "numeric" });
50
+ default:
51
+ return formatDateTime(value, locale, {
52
+ hour: "numeric",
53
+ minute: "2-digit",
54
+ });
55
+ }
56
+ }
57
+ /**
58
+ * The timeline axis (plan 10 R6): wall-time slots over `days`, and header rows
59
+ * (coarser unit first) whose cells span the slots inside them.
60
+ */
61
+ export function buildTimelineAxis(first, dayCount, duration, headerRows, locale) {
62
+ const size = slotSeconds(duration);
63
+ const origin = toEpochDay(first) * DAY;
64
+ const length = dayCount * DAY;
65
+ const slots = [];
66
+ for (let offset = 0; offset < length; offset += size) {
67
+ const start = at(origin + offset);
68
+ slots.push({ index: slots.length, key: slotKeyOf(start), start, offset });
69
+ }
70
+ const rows = headerRows.map((unit) => {
71
+ const cells = [];
72
+ for (const slot of slots) {
73
+ const id = bucket(slot.start, unit);
74
+ const last = cells[cells.length - 1];
75
+ if (last && last.key === `${unit}:${id}`) {
76
+ last.span += 1;
77
+ }
78
+ else {
79
+ cells.push({
80
+ key: `${unit}:${id}`,
81
+ unit,
82
+ label: labelOf(slot.start, unit, locale),
83
+ start: slot.start,
84
+ span: 1,
85
+ startSlot: slot.index,
86
+ });
87
+ }
88
+ }
89
+ return { unit, cells };
90
+ });
91
+ return {
92
+ start: at(origin),
93
+ length,
94
+ slotSeconds: size,
95
+ slots,
96
+ headerRows: rows,
97
+ };
98
+ }
@@ -0,0 +1,7 @@
1
+ import type { CalendarEventInput } from "../events/types.js";
2
+ import type { ResourceBuildContext, ResourceInput, TimelineLayout } from "./types.js";
3
+ /**
4
+ * The resource timeline (plan 10 R6/R7): one row per visible resource, events
5
+ * placed on the wall-time axis as `left`/`width` fractions and packed in lanes.
6
+ */
7
+ export declare function layoutTimeline<TEvent extends CalendarEventInput, TResource extends ResourceInput>(ctx: ResourceBuildContext<TEvent, TResource>): TimelineLayout<TEvent, TResource>;
@@ -0,0 +1,111 @@
1
+ import { compare, toEpochDay, toSecondOfDay } from "../../foundation/index.js";
2
+ import { compareEventIds } from "../events/sort.js";
3
+ import { buildTimelineAxis } from "./timeline-axis.js";
4
+ import { buildResourceTree } from "./tree.js";
5
+ import { clampWindow, windowInfo } from "./windowing.js";
6
+ const DAY = 86400;
7
+ const wall = (v) => toEpochDay(v) * DAY + toSecondOfDay(v);
8
+ /** Lane packing per row on the continuous axis: first fit, half-open (plan 10 R7). */
9
+ function packLanes(pieces) {
10
+ const sorted = [...pieces].sort((a, b) => {
11
+ const time = compare(a.start, b.start);
12
+ if (time !== 0)
13
+ return time;
14
+ if (a.width !== b.width)
15
+ return b.width - a.width;
16
+ const id = compareEventIds(a.eventId, b.eventId);
17
+ if (id !== 0)
18
+ return id;
19
+ return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
20
+ });
21
+ const ends = [];
22
+ const placed = [];
23
+ for (const piece of sorted) {
24
+ const start = piece.left;
25
+ const end = Math.max(piece.left + piece.width, piece.left + 1e-9);
26
+ let lane = ends.findIndex((laneEnd) => laneEnd <= start);
27
+ if (lane < 0) {
28
+ lane = ends.length;
29
+ ends.push(end);
30
+ }
31
+ else {
32
+ ends[lane] = end;
33
+ }
34
+ placed.push({ ...piece, lane });
35
+ }
36
+ return { placed, lanes: Math.max(1, ends.length) };
37
+ }
38
+ /**
39
+ * The resource timeline (plan 10 R6/R7): one row per visible resource, events
40
+ * placed on the wall-time axis as `left`/`width` fractions and packed in lanes.
41
+ */
42
+ export function layoutTimeline(ctx) {
43
+ const definition = ctx.definition;
44
+ const headerUnits = (definition.headerRows ?? [
45
+ "day",
46
+ "hour",
47
+ ]);
48
+ const firstDay = (ctx.days[0] ?? { date: ctx.range.start }).date;
49
+ const dayCount = ctx.days.length || 1;
50
+ const axis = buildTimelineAxis(firstDay, dayCount, definition.slot ?? { minutes: 60 }, headerUnits, ctx.locale);
51
+ const axisStart = wall(axis.start);
52
+ const axisEnd = axisStart + axis.length;
53
+ const nowSeconds = wall(ctx.now);
54
+ const { rows } = buildResourceTree(ctx.resources, ctx.collapsed, ctx.getLabel);
55
+ const window = clampWindow(rows.length, ctx.resourceWindow);
56
+ const slotWindow = clampWindow(axis.slots.length, ctx.slotWindow);
57
+ const visibleRows = rows.slice(window.start, window.end);
58
+ const visibleKeys = new Set(visibleRows.filter((r) => !r.group).map((r) => r.key));
59
+ const byRow = new Map();
60
+ for (const event of ctx.events) {
61
+ const s = wall(event.start);
62
+ const e = Math.max(wall(event.end), s);
63
+ if (e < axisStart || s >= axisEnd || (e === s && s < axisStart))
64
+ continue;
65
+ if (e === axisStart && s < axisStart)
66
+ continue;
67
+ const from = Math.max(s, axisStart);
68
+ const to = Math.min(e, axisEnd);
69
+ for (const id of event.resourceIds ?? []) {
70
+ const key = String(id);
71
+ if (!visibleKeys.has(key))
72
+ continue;
73
+ const list = byRow.get(key) ?? [];
74
+ list.push({
75
+ key: `${event.key}:${encodeURIComponent(key)}`,
76
+ event: event.event,
77
+ eventId: event.id,
78
+ start: event.start,
79
+ end: event.end,
80
+ allDay: event.allDay,
81
+ resourceKey: key,
82
+ resourceId: id,
83
+ rowKey: key,
84
+ left: (from - axisStart) / axis.length,
85
+ width: (to - from) / axis.length,
86
+ continuesBefore: s < axisStart,
87
+ continuesAfter: e > axisEnd,
88
+ past: e <= nowSeconds,
89
+ recurrence: event.recurrence,
90
+ });
91
+ byRow.set(key, list);
92
+ }
93
+ }
94
+ const pieces = [];
95
+ const timelineRows = visibleRows.map((row) => {
96
+ const { placed, lanes } = packLanes(byRow.get(row.key) ?? []);
97
+ pieces.push(...placed);
98
+ return { ...row, lanes };
99
+ });
100
+ const trimmed = slotWindow.start === 0 && slotWindow.end === axis.slots.length
101
+ ? axis
102
+ : { ...axis, slots: axis.slots.slice(slotWindow.start, slotWindow.end) };
103
+ return {
104
+ kind: "timeline",
105
+ axis: trimmed,
106
+ rows: timelineRows,
107
+ pieces,
108
+ grouped: rows.some((row) => row.group),
109
+ window: windowInfo(rows.length, axis.slots.length, window, slotWindow),
110
+ };
111
+ }
@@ -0,0 +1,10 @@
1
+ import type { ResourceId, ResourceInput, ResourceRow } from "./types.js";
2
+ /**
3
+ * Flat resources → the visible, depth-first rows (plan 10 §13.2). Roots have no
4
+ * `parentId` or an unknown one; cycles are broken by dropping the back edge;
5
+ * a repeated `id` keeps the first. Collapsed groups hide their descendants.
6
+ */
7
+ export declare function buildResourceTree<T extends ResourceInput>(resources: readonly T[], collapsed?: readonly ResourceId[], getLabel?: (resource: T) => string): {
8
+ rows: ResourceRow<T>[];
9
+ leafCount: number;
10
+ };
@@ -0,0 +1,86 @@
1
+ import { warnOnce } from "../events/normalize.js";
2
+ /**
3
+ * Flat resources → the visible, depth-first rows (plan 10 §13.2). Roots have no
4
+ * `parentId` or an unknown one; cycles are broken by dropping the back edge;
5
+ * a repeated `id` keeps the first. Collapsed groups hide their descendants.
6
+ */
7
+ export function buildResourceTree(resources, collapsed = [], getLabel) {
8
+ const byKey = new Map();
9
+ for (const resource of resources) {
10
+ const key = String(resource.id);
11
+ if (byKey.has(key)) {
12
+ warnOnce(`[chrono] Duplicate resource id "${key}".`);
13
+ continue;
14
+ }
15
+ byKey.set(key, resource);
16
+ }
17
+ const parentOf = (resource) => {
18
+ const parent = resource.parentId;
19
+ if (parent === undefined || parent === null) {
20
+ return null;
21
+ }
22
+ const key = String(parent);
23
+ if (!byKey.has(key)) {
24
+ warnOnce(`[chrono] Resource "${resource.id}" has an unknown parentId "${key}".`);
25
+ return null;
26
+ }
27
+ return key;
28
+ };
29
+ const parents = new Map();
30
+ for (const [key, resource] of byKey) {
31
+ parents.set(key, parentOf(resource));
32
+ }
33
+ // Break cycles: walk up from each node; a revisit means a back edge.
34
+ for (const key of byKey.keys()) {
35
+ const seen = new Set([key]);
36
+ let current = parents.get(key) ?? null;
37
+ while (current !== null) {
38
+ if (seen.has(current)) {
39
+ warnOnce(`[chrono] Resource "${key}" is part of a parent cycle; made a root.`);
40
+ parents.set(key, null);
41
+ break;
42
+ }
43
+ seen.add(current);
44
+ current = parents.get(current) ?? null;
45
+ }
46
+ }
47
+ const children = new Map();
48
+ for (const key of byKey.keys()) {
49
+ const parent = parents.get(key) ?? null;
50
+ const list = children.get(parent) ?? [];
51
+ list.push(key);
52
+ children.set(parent, list);
53
+ }
54
+ const collapsedKeys = new Set(collapsed.map(String));
55
+ const rows = [];
56
+ let leafCount = 0;
57
+ const visit = (key, level) => {
58
+ const resource = byKey.get(key);
59
+ const kids = children.get(key) ?? [];
60
+ const group = kids.length > 0;
61
+ const expanded = group && !collapsedKeys.has(key);
62
+ rows.push({
63
+ key,
64
+ id: resource.id,
65
+ resource,
66
+ label: getLabel ? getLabel(resource) : String(resource.id),
67
+ parentKey: parents.get(key) ?? null,
68
+ level,
69
+ group,
70
+ expanded,
71
+ index: rows.length,
72
+ });
73
+ if (!group) {
74
+ leafCount += 1;
75
+ }
76
+ if (expanded) {
77
+ for (const child of kids) {
78
+ visit(child, level + 1);
79
+ }
80
+ }
81
+ };
82
+ for (const root of children.get(null) ?? []) {
83
+ visit(root, 0);
84
+ }
85
+ return { rows, leafCount };
86
+ }