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

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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +625 -2
  3. package/dist/calendar/components.d.ts +346 -0
  4. package/dist/calendar/components.js +243 -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 +51 -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 +154 -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 +193 -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 +164 -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/defined-options.d.ts +18 -0
  52. package/dist/shared/defined-options.js +9 -0
  53. package/dist/shared/merge-props.d.ts +9 -0
  54. package/dist/shared/merge-props.js +31 -0
  55. package/dist/shared/modifiers.d.ts +7 -0
  56. package/dist/shared/modifiers.js +6 -0
  57. package/dist/shared/part.d.ts +10 -0
  58. package/dist/shared/part.js +9 -0
  59. package/dist/shared/slot.d.ts +12 -0
  60. package/dist/shared/slot.js +57 -0
  61. package/dist/shared/style-properties.d.ts +8 -0
  62. package/dist/shared/style-properties.js +13 -0
  63. package/dist/shared/to-react-props.d.ts +11 -0
  64. package/dist/shared/to-react-props.js +27 -0
  65. package/dist/time/bind-panel.d.ts +19 -0
  66. package/dist/time/bind-panel.js +97 -0
  67. package/dist/time/components.d.ts +183 -0
  68. package/dist/time/components.js +169 -0
  69. package/dist/time/context.d.ts +24 -0
  70. package/dist/time/context.js +19 -0
  71. package/dist/time/index.d.ts +4 -0
  72. package/dist/time/index.js +4 -0
  73. package/dist/time/options.d.ts +5 -0
  74. package/dist/time/options.js +85 -0
  75. package/dist/time/use-time-input.d.ts +43 -0
  76. package/dist/time/use-time-input.js +138 -0
  77. package/dist/time/use-time-panel.d.ts +37 -0
  78. package/dist/time/use-time-panel.js +18 -0
  79. package/dist/time/utilities.d.ts +4 -0
  80. package/dist/time/utilities.js +4 -0
  81. package/dist/vendor/core/calendar/availability.d.ts +39 -0
  82. package/dist/vendor/core/calendar/availability.js +73 -0
  83. package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
  84. package/dist/vendor/core/calendar/controllers/calendar-controller.js +1396 -0
  85. package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
  86. package/dist/vendor/core/calendar/controllers/drag-engine.js +363 -0
  87. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
  88. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +171 -0
  89. package/dist/vendor/core/calendar/controllers/shared.d.ts +33 -0
  90. package/dist/vendor/core/calendar/controllers/shared.js +82 -0
  91. package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
  92. package/dist/vendor/core/calendar/events/agenda-layout.js +72 -0
  93. package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
  94. package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
  95. package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
  96. package/dist/vendor/core/calendar/events/background-layout.js +106 -0
  97. package/dist/vendor/core/calendar/events/index.d.ts +17 -0
  98. package/dist/vendor/core/calendar/events/index.js +8 -0
  99. package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
  100. package/dist/vendor/core/calendar/events/month-layout.js +157 -0
  101. package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
  102. package/dist/vendor/core/calendar/events/normalize.js +156 -0
  103. package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
  104. package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
  105. package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
  106. package/dist/vendor/core/calendar/events/overflow.js +112 -0
  107. package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
  108. package/dist/vendor/core/calendar/events/sort.js +35 -0
  109. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
  110. package/dist/vendor/core/calendar/events/time-grid-layout.js +177 -0
  111. package/dist/vendor/core/calendar/events/types.d.ts +141 -0
  112. package/dist/vendor/core/calendar/events/types.js +1 -0
  113. package/dist/vendor/core/calendar/index.d.ts +70 -0
  114. package/dist/vendor/core/calendar/index.js +37 -0
  115. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +11 -0
  116. package/dist/vendor/core/calendar/interaction/auto-scroll.js +37 -0
  117. package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
  118. package/dist/vendor/core/calendar/interaction/drag-geometry.js +122 -0
  119. package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
  120. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +53 -0
  121. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +24 -0
  122. package/dist/vendor/core/calendar/interaction/drag-pointer.js +43 -0
  123. package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
  124. package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
  125. package/dist/vendor/core/calendar/interaction/gesture-handle.d.ts +17 -0
  126. package/dist/vendor/core/calendar/interaction/gesture-handle.js +26 -0
  127. package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
  128. package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
  129. package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
  130. package/dist/vendor/core/calendar/interaction/pending.js +17 -0
  131. package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
  132. package/dist/vendor/core/calendar/interaction/pointer.js +169 -0
  133. package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
  134. package/dist/vendor/core/calendar/interaction/selection.js +47 -0
  135. package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
  136. package/dist/vendor/core/calendar/internal/equal.js +43 -0
  137. package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
  138. package/dist/vendor/core/calendar/navigation/navigate.js +81 -0
  139. package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
  140. package/dist/vendor/core/calendar/navigation/range.js +52 -0
  141. package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
  142. package/dist/vendor/core/calendar/navigation/title.js +39 -0
  143. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
  144. package/dist/vendor/core/calendar/navigation/view-definition.js +62 -0
  145. package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
  146. package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
  147. package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
  148. package/dist/vendor/core/calendar/recurrence/apply.js +206 -0
  149. package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
  150. package/dist/vendor/core/calendar/recurrence/expand.js +298 -0
  151. package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
  152. package/dist/vendor/core/calendar/recurrence/pack.js +248 -0
  153. package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
  154. package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
  155. package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
  156. package/dist/vendor/core/calendar/recurrence/rrule.js +278 -0
  157. package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
  158. package/dist/vendor/core/calendar/recurrence/series.js +163 -0
  159. package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
  160. package/dist/vendor/core/calendar/recurrence/types.js +1 -0
  161. package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
  162. package/dist/vendor/core/calendar/resources/keys.js +2 -0
  163. package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
  164. package/dist/vendor/core/calendar/resources/resource-time-grid.js +129 -0
  165. package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
  166. package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
  167. package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
  168. package/dist/vendor/core/calendar/resources/timeline-layout.js +109 -0
  169. package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
  170. package/dist/vendor/core/calendar/resources/tree.js +86 -0
  171. package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
  172. package/dist/vendor/core/calendar/resources/types.js +1 -0
  173. package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
  174. package/dist/vendor/core/calendar/resources/views.js +45 -0
  175. package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
  176. package/dist/vendor/core/calendar/resources/windowing.js +17 -0
  177. package/dist/vendor/core/calendar/views/day.d.ts +37 -0
  178. package/dist/vendor/core/calendar/views/day.js +36 -0
  179. package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
  180. package/dist/vendor/core/calendar/views/list-layout.js +5 -0
  181. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
  182. package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
  183. package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
  184. package/dist/vendor/core/calendar/views/month-layout.js +63 -0
  185. package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
  186. package/dist/vendor/core/calendar/views/time-grid-layout.js +27 -0
  187. package/dist/vendor/core/date/index.d.ts +9 -0
  188. package/dist/vendor/core/date/index.js +9 -0
  189. package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
  190. package/dist/vendor/core/date/input/date-input-controller.js +466 -0
  191. package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
  192. package/dist/vendor/core/date/input/date-range-input-controller.js +186 -0
  193. package/dist/vendor/core/date/input/parse.d.ts +22 -0
  194. package/dist/vendor/core/date/input/parse.js +78 -0
  195. package/dist/vendor/core/date/input/validity.d.ts +6 -0
  196. package/dist/vendor/core/date/input/validity.js +13 -0
  197. package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
  198. package/dist/vendor/core/date/panel/panel-controller.js +704 -0
  199. package/dist/vendor/core/date/presets.d.ts +22 -0
  200. package/dist/vendor/core/date/presets.js +103 -0
  201. package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
  202. package/dist/vendor/core/date/selection/multiple.js +29 -0
  203. package/dist/vendor/core/date/selection/range.d.ts +29 -0
  204. package/dist/vendor/core/date/selection/range.js +35 -0
  205. package/dist/vendor/core/date/types.d.ts +12 -0
  206. package/dist/vendor/core/date/types.js +1 -0
  207. package/dist/vendor/core/datetime/compose.d.ts +24 -0
  208. package/dist/vendor/core/datetime/compose.js +49 -0
  209. package/dist/vendor/core/datetime/constraints.d.ts +42 -0
  210. package/dist/vendor/core/datetime/constraints.js +56 -0
  211. package/dist/vendor/core/datetime/index.d.ts +9 -0
  212. package/dist/vendor/core/datetime/index.js +9 -0
  213. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
  214. package/dist/vendor/core/datetime/input/datetime-input-controller.js +380 -0
  215. package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
  216. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +171 -0
  217. package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
  218. package/dist/vendor/core/datetime/input/parse.js +56 -0
  219. package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
  220. package/dist/vendor/core/datetime/panel/controller.js +191 -0
  221. package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
  222. package/dist/vendor/core/datetime/panel/range-controller.js +205 -0
  223. package/dist/vendor/core/datetime/types.d.ts +12 -0
  224. package/dist/vendor/core/datetime/types.js +1 -0
  225. package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
  226. package/dist/vendor/core/datetime/zone/day-instants.js +52 -0
  227. package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
  228. package/dist/vendor/core/datetime/zone/resolve.js +24 -0
  229. package/dist/vendor/core/dom/auto-scroll.d.ts +37 -0
  230. package/dist/vendor/core/dom/auto-scroll.js +57 -0
  231. package/dist/vendor/core/dom/drag-session.d.ts +25 -0
  232. package/dist/vendor/core/dom/drag-session.js +257 -0
  233. package/dist/vendor/core/foundation/a11y/announcer.d.ts +12 -0
  234. package/dist/vendor/core/foundation/a11y/announcer.js +24 -0
  235. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
  236. package/dist/vendor/core/foundation/a11y/grid-navigation.js +76 -0
  237. package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
  238. package/dist/vendor/core/foundation/a11y/index.js +5 -0
  239. package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
  240. package/dist/vendor/core/foundation/a11y/labels.js +43 -0
  241. package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
  242. package/dist/vendor/core/foundation/a11y/messages.js +74 -0
  243. package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
  244. package/dist/vendor/core/foundation/a11y/roving-focus.js +73 -0
  245. package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
  246. package/dist/vendor/core/foundation/constraints/availability-rules.js +64 -0
  247. package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
  248. package/dist/vendor/core/foundation/constraints/availability.js +480 -0
  249. package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
  250. package/dist/vendor/core/foundation/constraints/date.js +41 -0
  251. package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
  252. package/dist/vendor/core/foundation/constraints/index.js +4 -0
  253. package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
  254. package/dist/vendor/core/foundation/constraints/range.js +70 -0
  255. package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
  256. package/dist/vendor/core/foundation/constraints/time.js +56 -0
  257. package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
  258. package/dist/vendor/core/foundation/grid/index.js +4 -0
  259. package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
  260. package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
  261. package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
  262. package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
  263. package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
  264. package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
  265. package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
  266. package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
  267. package/dist/vendor/core/foundation/index.d.ts +8 -0
  268. package/dist/vendor/core/foundation/index.js +8 -0
  269. package/dist/vendor/core/foundation/input/form.d.ts +7 -0
  270. package/dist/vendor/core/foundation/input/form.js +10 -0
  271. package/dist/vendor/core/foundation/input/index.d.ts +6 -0
  272. package/dist/vendor/core/foundation/input/index.js +3 -0
  273. package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
  274. package/dist/vendor/core/foundation/input/segment-engine.js +45 -0
  275. package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
  276. package/dist/vendor/core/foundation/input/tokenize.js +24 -0
  277. package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
  278. package/dist/vendor/core/foundation/locale/digits.js +35 -0
  279. package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
  280. package/dist/vendor/core/foundation/locale/direction.js +25 -0
  281. package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
  282. package/dist/vendor/core/foundation/locale/format.js +77 -0
  283. package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
  284. package/dist/vendor/core/foundation/locale/hour-cycle.js +41 -0
  285. package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
  286. package/dist/vendor/core/foundation/locale/index.js +8 -0
  287. package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
  288. package/dist/vendor/core/foundation/locale/names.js +30 -0
  289. package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
  290. package/dist/vendor/core/foundation/locale/resolve.js +39 -0
  291. package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
  292. package/dist/vendor/core/foundation/locale/week-info.js +60 -0
  293. package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
  294. package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
  295. package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
  296. package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
  297. package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
  298. package/dist/vendor/core/foundation/ranges/index.js +2 -0
  299. package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
  300. package/dist/vendor/core/foundation/ranges/interval.js +54 -0
  301. package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
  302. package/dist/vendor/core/foundation/store/attributes.js +43 -0
  303. package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
  304. package/dist/vendor/core/foundation/store/controllable.js +50 -0
  305. package/dist/vendor/core/foundation/store/env.d.ts +1 -0
  306. package/dist/vendor/core/foundation/store/env.js +3 -0
  307. package/dist/vendor/core/foundation/store/ids.d.ts +9 -0
  308. package/dist/vendor/core/foundation/store/ids.js +12 -0
  309. package/dist/vendor/core/foundation/store/index.d.ts +11 -0
  310. package/dist/vendor/core/foundation/store/index.js +7 -0
  311. package/dist/vendor/core/foundation/store/store.d.ts +7 -0
  312. package/dist/vendor/core/foundation/store/store.js +25 -0
  313. package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
  314. package/dist/vendor/core/foundation/store/ticker.js +27 -0
  315. package/dist/vendor/core/foundation/store/with-optional.d.ts +15 -0
  316. package/dist/vendor/core/foundation/store/with-optional.js +3 -0
  317. package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
  318. package/dist/vendor/core/foundation/values/clock.js +21 -0
  319. package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
  320. package/dist/vendor/core/foundation/values/compare.js +70 -0
  321. package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
  322. package/dist/vendor/core/foundation/values/convert.js +108 -0
  323. package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
  324. package/dist/vendor/core/foundation/values/epoch-day.js +43 -0
  325. package/dist/vendor/core/foundation/values/index.d.ts +14 -0
  326. package/dist/vendor/core/foundation/values/index.js +10 -0
  327. package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
  328. package/dist/vendor/core/foundation/values/iso.js +111 -0
  329. package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
  330. package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
  331. package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
  332. package/dist/vendor/core/foundation/values/plain-date.js +105 -0
  333. package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
  334. package/dist/vendor/core/foundation/values/plain-time.js +43 -0
  335. package/dist/vendor/core/foundation/values/types.d.ts +37 -0
  336. package/dist/vendor/core/foundation/values/types.js +1 -0
  337. package/dist/vendor/core/foundation/values/week.d.ts +9 -0
  338. package/dist/vendor/core/foundation/values/week.js +31 -0
  339. package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
  340. package/dist/vendor/core/foundation/values/year-month.js +19 -0
  341. package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
  342. package/dist/vendor/core/foundation/values/zoned.js +152 -0
  343. package/dist/vendor/core/index.d.ts +5 -0
  344. package/dist/vendor/core/index.js +5 -0
  345. package/dist/vendor/core/time/index.d.ts +8 -0
  346. package/dist/vendor/core/time/index.js +8 -0
  347. package/dist/vendor/core/time/input/parse.d.ts +19 -0
  348. package/dist/vendor/core/time/input/parse.js +82 -0
  349. package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
  350. package/dist/vendor/core/time/input/time-input-controller.js +547 -0
  351. package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
  352. package/dist/vendor/core/time/input/time-range-input-controller.js +178 -0
  353. package/dist/vendor/core/time/input/validity.d.ts +7 -0
  354. package/dist/vendor/core/time/input/validity.js +16 -0
  355. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
  356. package/dist/vendor/core/time/panel/time-panel-controller.js +809 -0
  357. package/dist/vendor/core/time/selection/range.d.ts +25 -0
  358. package/dist/vendor/core/time/selection/range.js +35 -0
  359. package/dist/vendor/core/time/selection/slots.d.ts +46 -0
  360. package/dist/vendor/core/time/selection/slots.js +76 -0
  361. package/dist/vendor/core/time/types.d.ts +11 -0
  362. package/dist/vendor/core/time/types.js +1 -0
  363. package/package.json +83 -4
@@ -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,109 @@
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
+ import { withOptional } from "../../foundation/store/with-optional.js";
7
+ const DAY = 86400;
8
+ const wall = (v) => toEpochDay(v) * DAY + toSecondOfDay(v);
9
+ /** Lane packing per row on the continuous axis: first fit, half-open (plan 10 R7). */
10
+ function packLanes(pieces) {
11
+ const sorted = [...pieces].sort((a, b) => {
12
+ const time = compare(a.start, b.start);
13
+ if (time !== 0)
14
+ return time;
15
+ if (a.width !== b.width)
16
+ return b.width - a.width;
17
+ const id = compareEventIds(a.eventId, b.eventId);
18
+ if (id !== 0)
19
+ return id;
20
+ return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
21
+ });
22
+ const ends = [];
23
+ const placed = [];
24
+ for (const piece of sorted) {
25
+ const start = piece.left;
26
+ const end = Math.max(piece.left + piece.width, piece.left + 1e-9);
27
+ let lane = ends.findIndex((laneEnd) => laneEnd <= start);
28
+ if (lane < 0) {
29
+ lane = ends.length;
30
+ ends.push(end);
31
+ }
32
+ else {
33
+ ends[lane] = end;
34
+ }
35
+ placed.push({ ...piece, lane });
36
+ }
37
+ return { placed, lanes: Math.max(1, ends.length) };
38
+ }
39
+ /**
40
+ * The resource timeline (plan 10 R6/R7): one row per visible resource, events
41
+ * placed on the wall-time axis as `left`/`width` fractions and packed in lanes.
42
+ */
43
+ export function layoutTimeline(ctx) {
44
+ const definition = ctx.definition;
45
+ const headerUnits = (definition.headerRows ?? ["day", "hour"]);
46
+ const firstDay = (ctx.days[0] ?? { date: ctx.range.start }).date;
47
+ const dayCount = ctx.days.length || 1;
48
+ const axis = buildTimelineAxis(firstDay, dayCount, definition.slot ?? { minutes: 60 }, headerUnits, ctx.locale);
49
+ const axisStart = wall(axis.start);
50
+ const axisEnd = axisStart + axis.length;
51
+ const nowSeconds = wall(ctx.now);
52
+ const { rows } = buildResourceTree(ctx.resources, ctx.collapsed, ctx.getLabel);
53
+ const window = clampWindow(rows.length, ctx.resourceWindow);
54
+ const slotWindow = clampWindow(axis.slots.length, ctx.slotWindow);
55
+ const visibleRows = rows.slice(window.start, window.end);
56
+ const visibleKeys = new Set(visibleRows.filter((r) => !r.group).map((r) => r.key));
57
+ const byRow = new Map();
58
+ for (const event of ctx.events) {
59
+ const s = wall(event.start);
60
+ const e = Math.max(wall(event.end), s);
61
+ if (e < axisStart || s >= axisEnd || (e === s && s < axisStart))
62
+ continue;
63
+ if (e === axisStart && s < axisStart)
64
+ continue;
65
+ const from = Math.max(s, axisStart);
66
+ const to = Math.min(e, axisEnd);
67
+ for (const id of event.resourceIds ?? []) {
68
+ const key = String(id);
69
+ if (!visibleKeys.has(key))
70
+ continue;
71
+ const list = byRow.get(key) ?? [];
72
+ list.push(withOptional({
73
+ key: `${event.key}:${encodeURIComponent(key)}`,
74
+ event: event.event,
75
+ eventId: event.id,
76
+ start: event.start,
77
+ end: event.end,
78
+ allDay: event.allDay,
79
+ resourceKey: key,
80
+ resourceId: id,
81
+ rowKey: key,
82
+ left: (from - axisStart) / axis.length,
83
+ width: (to - from) / axis.length,
84
+ continuesBefore: s < axisStart,
85
+ continuesAfter: e > axisEnd,
86
+ past: e <= nowSeconds,
87
+ recurrence: event.recurrence,
88
+ }));
89
+ byRow.set(key, list);
90
+ }
91
+ }
92
+ const pieces = [];
93
+ const timelineRows = visibleRows.map((row) => {
94
+ const { placed, lanes } = packLanes(byRow.get(row.key) ?? []);
95
+ pieces.push(...placed);
96
+ return { ...row, lanes };
97
+ });
98
+ const trimmed = slotWindow.start === 0 && slotWindow.end === axis.slots.length
99
+ ? axis
100
+ : { ...axis, slots: axis.slots.slice(slotWindow.start, slotWindow.end) };
101
+ return {
102
+ kind: "timeline",
103
+ axis: trimmed,
104
+ rows: timelineRows,
105
+ pieces,
106
+ grouped: rows.some((row) => row.group),
107
+ window: windowInfo(rows.length, axis.slots.length, window, slotWindow),
108
+ };
109
+ }
@@ -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
+ }
@@ -0,0 +1,177 @@
1
+ import type { DateRange, PlainDate, PlainDateTime, PlainTime } from "../../foundation/index.js";
2
+ import type { AllDayRowSegment, CalendarEventInput, EventId, NormalizedEvent, TimeGridSegment } from "../events/types.js";
3
+ import type { RecurrenceInfo } from "../recurrence/types.js";
4
+ import type { CalendarDay } from "../views/day.js";
5
+ /** A resource id: a string or a number (plan 10 R1). */
6
+ export type ResourceId = string | number;
7
+ /** What the app passes for one resource; its own fields pass through untouched. */
8
+ export type ResourceInput = {
9
+ id: ResourceId;
10
+ /** Tree parent. Missing or unknown parents make the resource a root. */
11
+ parentId?: ResourceId | null;
12
+ };
13
+ /** A resource in the visible order, with tree state (plan 10 R9). */
14
+ export type ResourceRow<T extends ResourceInput = ResourceInput> = {
15
+ /** `String(id)`. */
16
+ key: string;
17
+ id: ResourceId;
18
+ resource: T;
19
+ label: string;
20
+ parentKey: string | null;
21
+ /** Depth, 0 for roots. */
22
+ level: number;
23
+ /** Has children in the tree. */
24
+ group: boolean;
25
+ expanded: boolean;
26
+ /** Index in the visible order. */
27
+ index: number;
28
+ };
29
+ export type ResourceGrouping = "resource-first" | "date-first";
30
+ export type WindowRange = {
31
+ start: number;
32
+ end: number;
33
+ };
34
+ /** Counts and offsets an app virtualizer can drive (plan 10 R14). */
35
+ export type ResourceWindowInfo = {
36
+ totalRows: number;
37
+ totalColumns: number;
38
+ rowOffset: number;
39
+ columnOffset: number;
40
+ };
41
+ /** One column of the resource time grid: a resource on a day. */
42
+ export type ResourceColumn<T extends ResourceInput = ResourceInput> = {
43
+ /** `${resourceKey}@${dayKey}`. */
44
+ key: string;
45
+ resourceKey: string;
46
+ resourceId: ResourceId;
47
+ resource: T;
48
+ label: string;
49
+ day: CalendarDay;
50
+ /** Absolute column index (before windowing). */
51
+ index: number;
52
+ };
53
+ /** A group header spanning the leaf columns below it. */
54
+ export type ResourceGroupHeader<T extends ResourceInput = ResourceInput> = {
55
+ key: string;
56
+ resourceKey: string;
57
+ resource: T;
58
+ label: string;
59
+ level: number;
60
+ startColumn: number;
61
+ colSpan: number;
62
+ };
63
+ type PieceResource = {
64
+ resourceKey: string;
65
+ resourceId: ResourceId;
66
+ };
67
+ export type ResourceTimeGridPiece<TEvent extends CalendarEventInput = CalendarEventInput> = TimeGridSegment<TEvent> & PieceResource & {
68
+ columnKey: string;
69
+ };
70
+ export type ResourceAllDayPiece<TEvent extends CalendarEventInput = CalendarEventInput> = AllDayRowSegment<TEvent> & PieceResource & {
71
+ columnKey: string;
72
+ };
73
+ export type ResourceTimeGridLayout<TEvent extends CalendarEventInput = CalendarEventInput, TResource extends ResourceInput = ResourceInput> = {
74
+ kind: "resource-time-grid";
75
+ grouping: ResourceGrouping;
76
+ /** Leaf resources in the window. */
77
+ rows: ResourceRow<TResource>[];
78
+ columns: ResourceColumn<TResource>[];
79
+ groups: ResourceGroupHeader<TResource>[];
80
+ pieces: ResourceTimeGridPiece<TEvent>[];
81
+ allDay: ResourceAllDayPiece<TEvent>[];
82
+ window: ResourceWindowInfo;
83
+ };
84
+ export type TimelineUnit = "month" | "week" | "day" | "hour" | "minute";
85
+ export type TimelineSlotDuration = {
86
+ minutes?: number;
87
+ days?: number;
88
+ weeks?: number;
89
+ };
90
+ export type TimelineSlot = {
91
+ index: number;
92
+ /** ISO local date-time, `YYYY-MM-DDTHH:mm`. */
93
+ key: string;
94
+ start: PlainDateTime;
95
+ /** Wall-clock seconds of the start since the axis start. */
96
+ offset: number;
97
+ };
98
+ export type TimelineHeaderCell = {
99
+ key: string;
100
+ unit: TimelineUnit;
101
+ label: string;
102
+ start: PlainDateTime;
103
+ /** Number of axis slots the cell spans. */
104
+ span: number;
105
+ /** Index of the first slot it spans. */
106
+ startSlot: number;
107
+ };
108
+ export type TimelineAxis = {
109
+ start: PlainDateTime;
110
+ /** Total length in seconds. */
111
+ length: number;
112
+ slotSeconds: number;
113
+ slots: TimelineSlot[];
114
+ /** Coarser rows first. */
115
+ headerRows: {
116
+ unit: TimelineUnit;
117
+ cells: TimelineHeaderCell[];
118
+ }[];
119
+ };
120
+ export type TimelinePiece<TEvent extends CalendarEventInput = CalendarEventInput> = PieceResource & {
121
+ /** `${eventKey}:${resourceKey}`. */
122
+ key: string;
123
+ event: TEvent;
124
+ eventId: EventId;
125
+ start: PlainDateTime;
126
+ end: PlainDateTime;
127
+ allDay: boolean;
128
+ rowKey: string;
129
+ /** Fractions 0–1 of the visible axis. */
130
+ left: number;
131
+ width: number;
132
+ lane: number;
133
+ continuesBefore: boolean;
134
+ continuesAfter: boolean;
135
+ past: boolean;
136
+ recurrence?: RecurrenceInfo<TEvent>;
137
+ };
138
+ export type TimelineRow<T extends ResourceInput = ResourceInput> = ResourceRow<T> & {
139
+ /** Lanes used by the row's pieces, at least 1. */
140
+ lanes: number;
141
+ };
142
+ export type TimelineLayout<TEvent extends CalendarEventInput = CalendarEventInput, TResource extends ResourceInput = ResourceInput> = {
143
+ kind: "timeline";
144
+ axis: TimelineAxis;
145
+ rows: TimelineRow<TResource>[];
146
+ pieces: TimelinePiece<TEvent>[];
147
+ /** True when any visible resource is a group (treegrid semantics). */
148
+ grouped: boolean;
149
+ window: ResourceWindowInfo;
150
+ };
151
+ export type ResourceLayout<TEvent extends CalendarEventInput = CalendarEventInput, TResource extends ResourceInput = ResourceInput> = ResourceTimeGridLayout<TEvent, TResource> | TimelineLayout<TEvent, TResource>;
152
+ /** Everything a resource layout needs, assembled by the controller. */
153
+ export type ResourceBuildContext<TEvent extends CalendarEventInput = CalendarEventInput, TResource extends ResourceInput = ResourceInput> = {
154
+ definition: {
155
+ id: string;
156
+ slot?: TimelineSlotDuration;
157
+ headerRows?: TimelineUnit[];
158
+ };
159
+ range: DateRange;
160
+ /** Visible (not hidden) days of the range. */
161
+ days: CalendarDay[];
162
+ locale: string | undefined;
163
+ now: PlainDateTime;
164
+ events: readonly NormalizedEvent<TEvent>[];
165
+ resources: readonly TResource[];
166
+ collapsed: readonly ResourceId[];
167
+ grouping: ResourceGrouping;
168
+ getLabel?: ((resource: TResource) => string) | undefined;
169
+ resourceWindow?: WindowRange | undefined;
170
+ slotWindow?: WindowRange | undefined;
171
+ dayStart?: PlainTime | undefined;
172
+ dayEnd?: PlainTime | undefined;
173
+ minEventDuration?: number | undefined;
174
+ longEventsInAllDayRow?: boolean | undefined;
175
+ };
176
+ export type ResourceLayoutBuilder = (context: ResourceBuildContext<any, any>) => ResourceLayout<any, any>;
177
+ export type { PlainDate };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ViewDefinition } from "../navigation/view-definition.js";
2
+ /**
3
+ * The resource view pack (plan 10 R3/R4): plain data. Pass it as `views` to opt
4
+ * in; the base calendar never imports this module, so apps without resources
5
+ * do not pay for it. No top-level code runs here.
6
+ */
7
+ export declare const resourceViews: Record<string, Omit<ViewDefinition, "id">>;
@@ -0,0 +1,45 @@
1
+ import { layoutResourceTimeGrid } from "./resource-time-grid.js";
2
+ import { layoutTimeline } from "./timeline-layout.js";
3
+ /**
4
+ * The resource view pack (plan 10 R3/R4): plain data. Pass it as `views` to opt
5
+ * in; the base calendar never imports this module, so apps without resources
6
+ * do not pay for it. No top-level code runs here.
7
+ */
8
+ export const resourceViews = {
9
+ resourceDay: {
10
+ layout: "resource-time-grid",
11
+ length: { days: 1 },
12
+ align: "day",
13
+ layoutBuilder: layoutResourceTimeGrid,
14
+ },
15
+ resourceWeek: {
16
+ layout: "resource-time-grid",
17
+ length: { weeks: 1 },
18
+ align: "week",
19
+ layoutBuilder: layoutResourceTimeGrid,
20
+ },
21
+ timelineDay: {
22
+ layout: "timeline",
23
+ length: { days: 1 },
24
+ align: "day",
25
+ slot: { minutes: 60 },
26
+ headerRows: ["day", "hour"],
27
+ layoutBuilder: layoutTimeline,
28
+ },
29
+ timelineWeek: {
30
+ layout: "timeline",
31
+ length: { weeks: 1 },
32
+ align: "week",
33
+ slot: { days: 1 },
34
+ headerRows: ["week", "day"],
35
+ layoutBuilder: layoutTimeline,
36
+ },
37
+ timelineMonth: {
38
+ layout: "timeline",
39
+ length: { months: 1 },
40
+ align: "month",
41
+ slot: { days: 1 },
42
+ headerRows: ["month", "day"],
43
+ layoutBuilder: layoutTimeline,
44
+ },
45
+ };
@@ -0,0 +1,11 @@
1
+ import type { ResourceWindowInfo, WindowRange } from "./types.js";
2
+ /** Clamp a half-open `[start, end)` window to `total` items (plan 10 R14). */
3
+ export declare function clampWindow(total: number, window: WindowRange | undefined): {
4
+ start: number;
5
+ end: number;
6
+ };
7
+ export declare function windowInfo(totalRows: number, totalColumns: number, rows: {
8
+ start: number;
9
+ }, columns: {
10
+ start: number;
11
+ }): ResourceWindowInfo;
@@ -0,0 +1,17 @@
1
+ /** Clamp a half-open `[start, end)` window to `total` items (plan 10 R14). */
2
+ export function clampWindow(total, window) {
3
+ if (!window) {
4
+ return { start: 0, end: total };
5
+ }
6
+ const start = Math.max(0, Math.min(total, Math.floor(window.start)));
7
+ const end = Math.max(start, Math.min(total, Math.floor(window.end)));
8
+ return { start, end };
9
+ }
10
+ export function windowInfo(totalRows, totalColumns, rows, columns) {
11
+ return {
12
+ totalRows,
13
+ totalColumns,
14
+ rowOffset: rows.start,
15
+ columnOffset: columns.start,
16
+ };
17
+ }
@@ -0,0 +1,37 @@
1
+ import { type DateRange, type DayOfWeek, type GridDay, type PlainDate, type WeekInfo } from "../../foundation/index.js";
2
+ /** One rendered day. Adds calendar state to a foundation {@link GridDay}. */
3
+ export type CalendarDay = GridDay & {
4
+ /** ISO date, used as `data-chrono-key`. */
5
+ key: string;
6
+ /** Inside the logical range (Mini Calendar: inside `syncWith.visibleRange`). */
7
+ inRange: boolean;
8
+ hidden: boolean;
9
+ /** Outside `min` / `max`. */
10
+ disabled: boolean;
11
+ focused: boolean;
12
+ /** Presentation only (C16): set by the app. */
13
+ selected: boolean;
14
+ highlighted: boolean;
15
+ /** Mini Calendar `isMarked`. Always `false` in the main calendar. */
16
+ marked: boolean;
17
+ };
18
+ export type DayContext = {
19
+ range: DateRange;
20
+ /** Overrides what counts as `inRange`; `null` means nothing is (Mini Calendar without sync). */
21
+ inRangeOf?: DateRange | null;
22
+ focusedDate: PlainDate;
23
+ hiddenDays: readonly DayOfWeek[];
24
+ min?: PlainDate | undefined;
25
+ max?: PlainDate | undefined;
26
+ selectedDate?: PlainDate | undefined;
27
+ isHighlighted?: ((date: PlainDate) => boolean) | undefined;
28
+ isMarked?: ((date: PlainDate) => boolean) | undefined;
29
+ };
30
+ /** Outside `min` / `max`. */
31
+ export declare function isOutside(date: PlainDate, min?: PlainDate, max?: PlainDate): boolean;
32
+ export declare function makeDay(grid: GridDay, ctx: DayContext): CalendarDay;
33
+ /** Every visible (not hidden) day of `ctx.range`, as the time grid and the agenda list them. */
34
+ export declare function visibleDays(ctx: DayContext & {
35
+ weekInfo: Pick<WeekInfo, "weekend">;
36
+ today: PlainDate;
37
+ }): CalendarDay[];
@@ -0,0 +1,36 @@
1
+ import { compare, dayOfWeek, eachDay, isDateInRange, isSameDay, toIsoString, } from "../../foundation/index.js";
2
+ /** Outside `min` / `max`. */
3
+ export function isOutside(date, min, max) {
4
+ return ((min !== undefined && compare(date, min) < 0) || (max !== undefined && compare(date, max) > 0));
5
+ }
6
+ export function makeDay(grid, ctx) {
7
+ const { date } = grid;
8
+ return {
9
+ ...grid,
10
+ key: toIsoString(date),
11
+ inRange: ctx.inRangeOf === null ? false : isDateInRange(date, ctx.inRangeOf ?? ctx.range),
12
+ hidden: ctx.hiddenDays.includes(grid.dayOfWeek),
13
+ disabled: isOutside(date, ctx.min, ctx.max),
14
+ focused: isSameDay(date, ctx.focusedDate),
15
+ selected: ctx.selectedDate !== undefined && isSameDay(date, ctx.selectedDate),
16
+ highlighted: ctx.isHighlighted?.(date) ?? false,
17
+ marked: ctx.isMarked?.(date) ?? false,
18
+ };
19
+ }
20
+ /** Every visible (not hidden) day of `ctx.range`, as the time grid and the agenda list them. */
21
+ export function visibleDays(ctx) {
22
+ const days = [];
23
+ for (const date of eachDay(ctx.range)) {
24
+ const weekday = dayOfWeek(date);
25
+ const day = makeDay({
26
+ date,
27
+ dayOfWeek: weekday,
28
+ outsideMonth: false,
29
+ weekend: ctx.weekInfo.weekend.includes(weekday),
30
+ today: isSameDay(date, ctx.today),
31
+ }, ctx);
32
+ if (!day.hidden)
33
+ days.push(day);
34
+ }
35
+ return days;
36
+ }
@@ -0,0 +1,8 @@
1
+ import { type CalendarDay } from "./day.js";
2
+ import type { LayoutContext } from "./month-layout.js";
3
+ export type ListLayout = {
4
+ kind: "list";
5
+ days: CalendarDay[];
6
+ };
7
+ /** Agenda: one entry per visible day of the range. Events arrive in stage 3. */
8
+ export declare function getListLayout(ctx: LayoutContext): ListLayout;
@@ -0,0 +1,5 @@
1
+ import { visibleDays } from "./day.js";
2
+ /** Agenda: one entry per visible day of the range. Events arrive in stage 3. */
3
+ export function getListLayout(ctx) {
4
+ return { kind: "list", days: visibleDays(ctx) };
5
+ }