@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,64 @@
1
+ import { type Attributes, type Availability, type AvailabilitySpec, type DateTimeInput, type Messages, type PlainDate, type PlainTime } from "../../foundation/index.js";
2
+ import { type PanelController, type DatePanelOptions, type PanelState } from "../../date/index.js";
3
+ import { type TimePanelController, type TimePanelOptions, type TimePanelState } from "../../time/index.js";
4
+ import { type Draft, type Zone } from "../compose.js";
5
+ import type { DateTimeValue } from "../types.js";
6
+ type Inner<T> = Omit<T, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | "min" | "max">;
7
+ export type DateTimePanelOptions = {
8
+ id?: string;
9
+ value?: DateTimeValue;
10
+ defaultValue?: DateTimeValue;
11
+ onValueChange?: (value: DateTimeValue, info: {
12
+ adjusted: boolean;
13
+ }) => void;
14
+ /** Fires when the time part commits while a date is chosen and the value is valid (X8). */
15
+ onValueCommit?: (value: NonNullable<DateTimeValue>) => void;
16
+ /** The zone the user sees and edits. Without it values are plain wall times. */
17
+ timeZone?: string;
18
+ /** The zone of the emitted value (the same instant). */
19
+ valueTimeZone?: string;
20
+ disambiguation?: Zone["disambiguation"];
21
+ /** Fills the time when a date is picked first. */
22
+ defaultTime?: DateTimeInput | string;
23
+ min?: DateTimeInput;
24
+ max?: DateTimeInput;
25
+ disablePast?: boolean;
26
+ isDateDisabled?: (date: PlainDate) => boolean;
27
+ isDateUnavailable?: (date: PlainDate) => boolean;
28
+ isTimeDisabled?: (time: PlainTime, date: PlainDate) => boolean;
29
+ isTimeUnavailable?: (time: PlainTime, date: PlainDate) => boolean;
30
+ /** Availability model (plan 11 V7–V8): dates and times of the selected day. */
31
+ availability?: AvailabilitySpec | Availability;
32
+ date?: Inner<DatePanelOptions>;
33
+ time?: Inner<TimePanelOptions>;
34
+ locale?: string;
35
+ now?: number;
36
+ readOnly?: boolean;
37
+ disabled?: boolean;
38
+ autoFocus?: boolean;
39
+ messages?: Partial<Messages>;
40
+ };
41
+ export type DateTimePanelState = {
42
+ id: string;
43
+ value: DateTimeValue;
44
+ draft: Draft;
45
+ adjusted: boolean;
46
+ nonexistent: boolean;
47
+ date: PanelState;
48
+ time: TimePanelState;
49
+ messages: Messages;
50
+ };
51
+ export type DateTimePanelController = {
52
+ getState(): DateTimePanelState;
53
+ subscribe(listener: (state: DateTimePanelState) => void): () => void;
54
+ setOptions(options: Partial<DateTimePanelOptions>): void;
55
+ getDate(): PanelController<unknown, DatePanelOptions>;
56
+ getTime(): TimePanelController<unknown, TimePanelOptions>;
57
+ clear(): void;
58
+ commit(): void;
59
+ getRootAttributes(): Attributes;
60
+ destroy(): void;
61
+ };
62
+ /** Date and time panels composed by one controller (plan 08 X6–X8). */
63
+ export declare function createDateTimePanelController(initial?: DateTimePanelOptions): DateTimePanelController;
64
+ export {};
@@ -0,0 +1,191 @@
1
+ import { compare, compileAvailability, createControllable, createId, defaultMessages, mergeMessages, toPlainTime, } from "../../foundation/index.js";
2
+ import { createDatePanelController, } from "../../date/index.js";
3
+ import { createTimePanelController, } from "../../time/index.js";
4
+ import { compose, decompose, sameDateTime, } from "../compose.js";
5
+ import { getBounds, isDayDisabled, timeBoundsFor } from "../constraints.js";
6
+ /** Date and time panels composed by one controller (plan 08 X6–X8). */
7
+ export function createDateTimePanelController(initial = {}) {
8
+ let options = initial;
9
+ const id = options.id ?? createId("chrono-datetime-panel");
10
+ const zone = () => ({
11
+ timeZone: options.timeZone,
12
+ valueTimeZone: options.valueTimeZone,
13
+ disambiguation: options.disambiguation,
14
+ });
15
+ const bounds = () => getBounds({
16
+ min: options.min,
17
+ max: options.max,
18
+ disablePast: options.disablePast,
19
+ timeZone: options.timeZone,
20
+ now: options.now,
21
+ });
22
+ const control = createControllable({
23
+ value: options.value,
24
+ defaultValue: options.defaultValue ?? null,
25
+ onChange: (value) => options.onValueChange?.(value, { adjusted: lastAdjusted }),
26
+ equals: sameDateTime,
27
+ });
28
+ let lastAdjusted = false;
29
+ let draft = decompose(control.get(), zone());
30
+ let composed = compose(draft, zone());
31
+ /** A time is allowed on a date when the bounds and the app's rule accept it. */
32
+ const timeAllowed = (date, time) => {
33
+ const limit = timeBoundsFor(date, bounds());
34
+ if (limit.min && compare(time, limit.min) < 0)
35
+ return false;
36
+ if (limit.max && compare(time, limit.max) > 0)
37
+ return false;
38
+ return !options.isTimeDisabled?.(time, date);
39
+ };
40
+ const defaultTime = () => options.defaultTime === undefined ? null : toPlainTime(options.defaultTime);
41
+ const availabilityOf = () => options.availability === undefined
42
+ ? undefined
43
+ : compileAvailability(options.availability, {
44
+ timeZone: options.timeZone,
45
+ now: options.now,
46
+ });
47
+ const dateOptions = () => {
48
+ const b = bounds();
49
+ return {
50
+ ...options.date,
51
+ id: `${id}-date`,
52
+ locale: options.locale,
53
+ timeZone: options.timeZone ?? options.date?.timeZone,
54
+ now: options.now,
55
+ min: b.min,
56
+ max: b.max,
57
+ isDateDisabled: (date) => isDayDisabled(date, b) || (options.isDateDisabled?.(date) ?? false),
58
+ isDateUnavailable: options.isDateUnavailable,
59
+ availability: options.availability,
60
+ value: draft.date,
61
+ onValueChange: (date) => setDate(date),
62
+ readOnly: options.readOnly,
63
+ disabled: options.disabled,
64
+ autoFocus: options.autoFocus,
65
+ messages: options.messages,
66
+ };
67
+ };
68
+ const timeOptions = () => {
69
+ const limit = draft.date ? timeBoundsFor(draft.date, bounds()) : {};
70
+ const date = draft.date;
71
+ return {
72
+ ...options.time,
73
+ id: `${id}-time`,
74
+ locale: options.locale,
75
+ timeZone: options.timeZone ?? options.time?.timeZone,
76
+ now: options.now,
77
+ min: limit.min,
78
+ max: limit.max,
79
+ isTimeDisabled: date ? (time) => options.isTimeDisabled?.(time, date) ?? false : undefined,
80
+ isTimeUnavailable: date
81
+ ? (time) => {
82
+ const availability = availabilityOf();
83
+ return ((options.isTimeUnavailable?.(time, date) ?? false) ||
84
+ (availability ? !availability.isTimeAvailable(date, time) : false));
85
+ }
86
+ : undefined,
87
+ value: draft.time,
88
+ onValueChange: (time) => setTime(time),
89
+ onValueCommit: () => commitNow(),
90
+ readOnly: options.readOnly,
91
+ disabled: options.disabled,
92
+ messages: options.messages,
93
+ };
94
+ };
95
+ const dateCtl = createDatePanelController(dateOptions());
96
+ const timeCtl = createTimePanelController(timeOptions());
97
+ let state;
98
+ const listeners = new Set();
99
+ const compute = () => ({
100
+ id,
101
+ value: control.get(),
102
+ draft,
103
+ adjusted: composed.adjusted,
104
+ nonexistent: composed.nonexistent,
105
+ date: dateCtl.getState(),
106
+ time: timeCtl.getState(),
107
+ messages: mergeMessages(defaultMessages, options.messages),
108
+ });
109
+ const emit = () => {
110
+ const next = compute();
111
+ if (state && JSON.stringify(state) === JSON.stringify(next))
112
+ return;
113
+ state = next;
114
+ for (const listener of [...listeners])
115
+ listener(state);
116
+ };
117
+ /** Push the draft into the composed controllers and the value. */
118
+ const update = () => {
119
+ dateCtl.setOptions(dateOptions());
120
+ timeCtl.setOptions(timeOptions());
121
+ composed = compose(draft, zone());
122
+ const allowed = draft.date && draft.time ? timeAllowed(draft.date, draft.time) : false;
123
+ const value = allowed ? composed.value : null;
124
+ if (!sameDateTime(control.get(), value)) {
125
+ lastAdjusted = composed.adjusted;
126
+ control.set(value);
127
+ }
128
+ emit();
129
+ };
130
+ function setDate(date) {
131
+ draft = { date, time: draft.time };
132
+ if (date && !draft.time) {
133
+ const fill = defaultTime();
134
+ if (fill)
135
+ draft = { date, time: fill };
136
+ }
137
+ update();
138
+ }
139
+ function setTime(time) {
140
+ draft = { date: draft.date, time };
141
+ update();
142
+ }
143
+ function commitNow() {
144
+ const value = control.get();
145
+ if (value && draft.date)
146
+ options.onValueCommit?.(value);
147
+ }
148
+ state = compute();
149
+ dateCtl.subscribe(emit);
150
+ timeCtl.subscribe(emit);
151
+ return {
152
+ getState: () => state,
153
+ subscribe(listener) {
154
+ listeners.add(listener);
155
+ return () => {
156
+ listeners.delete(listener);
157
+ };
158
+ },
159
+ setOptions(next) {
160
+ options = { ...options, ...next };
161
+ control.sync({ value: options.value });
162
+ const current = control.get();
163
+ if (!sameDateTime(composed.value, current)) {
164
+ draft = current ? decompose(current, zone()) : { date: null, time: null };
165
+ }
166
+ update();
167
+ },
168
+ getDate: () => dateCtl,
169
+ getTime: () => timeCtl,
170
+ clear() {
171
+ if (options.disabled || options.readOnly)
172
+ return;
173
+ draft = { date: null, time: null };
174
+ timeCtl.clear();
175
+ update();
176
+ },
177
+ commit: commitNow,
178
+ getRootAttributes: () => ({
179
+ role: "group",
180
+ "data-chrono-datetime-panel": true,
181
+ "data-adjusted": state.adjusted,
182
+ "data-disabled": options.disabled ?? false,
183
+ "data-readonly": options.readOnly ?? false,
184
+ }),
185
+ destroy() {
186
+ listeners.clear();
187
+ dateCtl.destroy();
188
+ timeCtl.destroy();
189
+ },
190
+ };
191
+ }
@@ -0,0 +1,71 @@
1
+ import { type Attributes, type DateTimeInput, type Messages, type PlainDate, type PlainDateTime, type PlainTime, type ZonedDateTime } from "../../foundation/index.js";
2
+ import { type DateRangePanelOptions, type DateRangeValue, type PanelController, type PanelState } from "../../date/index.js";
3
+ import { type TimePanelController, type TimePanelOptions, type TimePanelState } from "../../time/index.js";
4
+ import { type Zone } from "../compose.js";
5
+ import { type DateTimeRangeReason } from "../constraints.js";
6
+ import type { DateTimeRangeValue } from "../types.js";
7
+ type Inner<T> = Omit<T, "value" | "defaultValue" | "onValueChange" | "onValueCommit" | "min" | "max">;
8
+ type Value = PlainDateTime | ZonedDateTime;
9
+ export type DateTimeRangePanelOptions = {
10
+ id?: string;
11
+ value?: DateTimeRangeValue;
12
+ defaultValue?: DateTimeRangeValue;
13
+ onValueChange?: (value: DateTimeRangeValue) => void;
14
+ /** Fires when the end time commits and the range is valid (X9). */
15
+ onValueCommit?: (value: {
16
+ start: Value;
17
+ end: Value;
18
+ }) => void;
19
+ timeZone?: string;
20
+ valueTimeZone?: string;
21
+ disambiguation?: Zone["disambiguation"];
22
+ /** Minutes. */
23
+ minDuration?: number;
24
+ maxDuration?: number;
25
+ min?: DateTimeInput;
26
+ max?: DateTimeInput;
27
+ disablePast?: boolean;
28
+ isDateDisabled?: (date: PlainDate) => boolean;
29
+ isDateUnavailable?: (date: PlainDate) => boolean;
30
+ isTimeDisabled?: (time: PlainTime, date: PlainDate) => boolean;
31
+ date?: Inner<DateRangePanelOptions>;
32
+ startTime?: Inner<TimePanelOptions>;
33
+ endTime?: Inner<TimePanelOptions>;
34
+ onInvalidRange?: (reason: DateTimeRangeReason) => void;
35
+ locale?: string;
36
+ now?: number;
37
+ readOnly?: boolean;
38
+ disabled?: boolean;
39
+ autoFocus?: boolean;
40
+ messages?: Partial<Messages>;
41
+ };
42
+ export type DateTimeRangePanelState = {
43
+ id: string;
44
+ value: DateTimeRangeValue;
45
+ draft: {
46
+ range: DateRangeValue;
47
+ startTime: PlainTime | null;
48
+ endTime: PlainTime | null;
49
+ };
50
+ validity: "empty" | "incomplete" | "valid" | DateTimeRangeReason;
51
+ duration: number | null;
52
+ date: PanelState;
53
+ startTime: TimePanelState;
54
+ endTime: TimePanelState;
55
+ messages: Messages;
56
+ };
57
+ export type DateTimeRangePanelController = {
58
+ getState(): DateTimeRangePanelState;
59
+ subscribe(listener: (state: DateTimeRangePanelState) => void): () => void;
60
+ setOptions(options: Partial<DateTimeRangePanelOptions>): void;
61
+ getDate(): PanelController<unknown, DateRangePanelOptions>;
62
+ getStartTime(): TimePanelController<unknown, TimePanelOptions>;
63
+ getEndTime(): TimePanelController<unknown, TimePanelOptions>;
64
+ clear(): void;
65
+ commit(): void;
66
+ getRootAttributes(): Attributes;
67
+ destroy(): void;
68
+ };
69
+ /** A date range panel and two time panels composed by one controller (plan 08 X9). */
70
+ export declare function createDateTimeRangePanelController(initial?: DateTimeRangePanelOptions): DateTimeRangePanelController;
71
+ export {};
@@ -0,0 +1,205 @@
1
+ import { createControllable, createId, defaultMessages, mergeMessages, } from "../../foundation/index.js";
2
+ import { createDateRangePanelController, } from "../../date/index.js";
3
+ import { createTimePanelController, } from "../../time/index.js";
4
+ import { compose, decompose, sameDateTime } from "../compose.js";
5
+ import { checkDateTimeRange, getBounds, isDayDisabled, timeBoundsFor, } from "../constraints.js";
6
+ const sameRange = (a, b) => a === b ||
7
+ (a !== null && b !== null && sameDateTime(a.start, b.start) && sameDateTime(a.end, b.end));
8
+ /** A date range panel and two time panels composed by one controller (plan 08 X9). */
9
+ export function createDateTimeRangePanelController(initial = {}) {
10
+ let options = initial;
11
+ const id = options.id ?? createId("chrono-datetime-range-panel");
12
+ const zone = () => ({
13
+ timeZone: options.timeZone,
14
+ valueTimeZone: options.valueTimeZone,
15
+ disambiguation: options.disambiguation,
16
+ });
17
+ const bounds = () => getBounds({
18
+ min: options.min,
19
+ max: options.max,
20
+ disablePast: options.disablePast,
21
+ timeZone: options.timeZone,
22
+ now: options.now,
23
+ });
24
+ const control = createControllable({
25
+ value: options.value,
26
+ defaultValue: options.defaultValue ?? null,
27
+ onChange: (value) => options.onValueChange?.(value),
28
+ equals: sameRange,
29
+ });
30
+ const initialDraft = (value) => {
31
+ const start = decompose(value?.start ?? null, zone());
32
+ const end = decompose(value?.end ?? null, zone());
33
+ return {
34
+ range: value ? { start: start.date, end: end.date } : null,
35
+ startTime: start.time,
36
+ endTime: end.time,
37
+ };
38
+ };
39
+ let draft = initialDraft(control.get());
40
+ const composeBoth = () => {
41
+ const start = compose({ date: draft.range?.start ?? null, time: draft.startTime }, zone()).value;
42
+ const end = compose({ date: draft.range?.end ?? null, time: draft.endTime }, zone()).value;
43
+ return { start, end };
44
+ };
45
+ const checkNow = (start, end) => checkDateTimeRange(start, end, {
46
+ minDuration: options.minDuration,
47
+ maxDuration: options.maxDuration,
48
+ bounds: bounds(),
49
+ });
50
+ /** The end time options that would break the range are disabled (X9). */
51
+ const endBreaks = (time) => {
52
+ const date = draft.range?.end;
53
+ const { start } = composeBoth();
54
+ if (!date || !start)
55
+ return false;
56
+ const end = compose({ date, time }, zone()).value;
57
+ return end ? !checkNow(start, end).valid : false;
58
+ };
59
+ const timeOpts = (kind, date, time, user) => {
60
+ const limit = date ? timeBoundsFor(date, bounds()) : {};
61
+ return {
62
+ ...user,
63
+ id: `${id}-${kind}-time`,
64
+ locale: options.locale,
65
+ timeZone: options.timeZone,
66
+ now: options.now,
67
+ min: limit.min,
68
+ max: limit.max,
69
+ isTimeDisabled: (t) => (date ? options.isTimeDisabled?.(t, date) : false) || (kind === "end" && endBreaks(t)),
70
+ value: time,
71
+ onValueChange: (next) => {
72
+ draft = kind === "start" ? { ...draft, startTime: next } : { ...draft, endTime: next };
73
+ update();
74
+ },
75
+ onValueCommit: kind === "end" ? () => commitNow() : undefined,
76
+ readOnly: options.readOnly,
77
+ disabled: options.disabled,
78
+ messages: options.messages,
79
+ };
80
+ };
81
+ const dateOpts = () => {
82
+ const b = bounds();
83
+ return {
84
+ ...options.date,
85
+ id: `${id}-date`,
86
+ locale: options.locale,
87
+ timeZone: options.timeZone,
88
+ now: options.now,
89
+ min: b.min,
90
+ max: b.max,
91
+ isDateDisabled: (d) => isDayDisabled(d, b) || (options.isDateDisabled?.(d) ?? false),
92
+ isDateUnavailable: options.isDateUnavailable,
93
+ value: draft.range,
94
+ onValueChange: (range) => {
95
+ draft = { ...draft, range };
96
+ update();
97
+ },
98
+ readOnly: options.readOnly,
99
+ disabled: options.disabled,
100
+ autoFocus: options.autoFocus,
101
+ messages: options.messages,
102
+ };
103
+ };
104
+ const dateCtl = createDateRangePanelController(dateOpts());
105
+ const startCtl = createTimePanelController(timeOpts("start", draft.range?.start, draft.startTime, options.startTime));
106
+ const endCtl = createTimePanelController(timeOpts("end", draft.range?.end, draft.endTime, options.endTime));
107
+ let state;
108
+ const listeners = new Set();
109
+ const evaluate = () => {
110
+ const { start, end } = composeBoth();
111
+ const filled = [draft.range?.start, draft.range?.end, draft.startTime, draft.endTime].filter(Boolean).length;
112
+ if (filled === 0)
113
+ return { value: null, validity: "empty", duration: null };
114
+ if (!start || !end)
115
+ return { value: null, validity: "incomplete", duration: null };
116
+ const check = checkNow(start, end);
117
+ return check.valid
118
+ ? { value: { start, end }, validity: "valid", duration: check.duration }
119
+ : { value: null, validity: check.reason, duration: null };
120
+ };
121
+ let current = evaluate();
122
+ const compute = () => ({
123
+ id,
124
+ value: control.get(),
125
+ draft,
126
+ validity: current.validity,
127
+ duration: current.duration,
128
+ date: dateCtl.getState(),
129
+ startTime: startCtl.getState(),
130
+ endTime: endCtl.getState(),
131
+ messages: mergeMessages(defaultMessages, options.messages),
132
+ });
133
+ const emit = () => {
134
+ const next = compute();
135
+ if (state && JSON.stringify(state) === JSON.stringify(next))
136
+ return;
137
+ state = next;
138
+ for (const listener of [...listeners])
139
+ listener(state);
140
+ };
141
+ function update() {
142
+ dateCtl.setOptions(dateOpts());
143
+ startCtl.setOptions(timeOpts("start", draft.range?.start, draft.startTime, options.startTime));
144
+ endCtl.setOptions(timeOpts("end", draft.range?.end, draft.endTime, options.endTime));
145
+ current = evaluate();
146
+ if (!sameRange(control.get(), current.value))
147
+ control.set(current.value);
148
+ emit();
149
+ }
150
+ function commitNow() {
151
+ const value = control.get();
152
+ if (value?.start && value.end) {
153
+ options.onValueCommit?.({ start: value.start, end: value.end });
154
+ }
155
+ else if (current.validity !== "empty" &&
156
+ current.validity !== "incomplete" &&
157
+ current.validity !== "valid") {
158
+ options.onInvalidRange?.(current.validity);
159
+ }
160
+ }
161
+ state = compute();
162
+ dateCtl.subscribe(emit);
163
+ startCtl.subscribe(emit);
164
+ endCtl.subscribe(emit);
165
+ return {
166
+ getState: () => state,
167
+ subscribe(listener) {
168
+ listeners.add(listener);
169
+ return () => {
170
+ listeners.delete(listener);
171
+ };
172
+ },
173
+ setOptions(next) {
174
+ options = { ...options, ...next };
175
+ control.sync({ value: options.value });
176
+ if (!sameRange(current.value, control.get()))
177
+ draft = initialDraft(control.get());
178
+ update();
179
+ },
180
+ getDate: () => dateCtl,
181
+ getStartTime: () => startCtl,
182
+ getEndTime: () => endCtl,
183
+ clear() {
184
+ if (options.disabled || options.readOnly)
185
+ return;
186
+ draft = { range: null, startTime: null, endTime: null };
187
+ startCtl.clear();
188
+ endCtl.clear();
189
+ update();
190
+ },
191
+ commit: commitNow,
192
+ getRootAttributes: () => ({
193
+ role: "group",
194
+ "data-chrono-datetime-panel": "range",
195
+ "data-disabled": options.disabled ?? false,
196
+ "data-readonly": options.readOnly ?? false,
197
+ }),
198
+ destroy() {
199
+ listeners.clear();
200
+ dateCtl.destroy();
201
+ startCtl.destroy();
202
+ endCtl.destroy();
203
+ },
204
+ };
205
+ }
@@ -0,0 +1,12 @@
1
+ import type { PlainDateTime, ZonedDateTime } from "../foundation/index.js";
2
+ /**
3
+ * `PlainDateTime` when no `timeZone` is set, `ZonedDateTime` when one is (plan 08 X1).
4
+ * Never a string or a `Date`.
5
+ */
6
+ export type DateTimeValueOf<Z> = Z extends string ? ZonedDateTime : PlainDateTime;
7
+ export type DateTimeValue = PlainDateTime | ZonedDateTime | null;
8
+ /** Half-open `[start, end)`. */
9
+ export type DateTimeRangeValue = {
10
+ start: PlainDateTime | ZonedDateTime | null;
11
+ end: PlainDateTime | ZonedDateTime | null;
12
+ } | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { type PlainDate, type PlainTime } from "../../foundation/index.js";
2
+ export type DayInstant = {
3
+ /** `HH:mm`, or `HH:mm#2` for the second occurrence of a repeated time. */
4
+ key: string;
5
+ time: PlainTime;
6
+ /** Minutes east of UTC. */
7
+ offset: number;
8
+ /** Epoch milliseconds: the identity of the entry. */
9
+ instant: number;
10
+ /** 1, or 2 for the repeated hour. */
11
+ ordinal: 1 | 2;
12
+ };
13
+ /** `+07:00` for an offset in minutes. */
14
+ export declare function formatOffset(minutes: number): string;
15
+ /**
16
+ * Wall-aligned entries of one day (plan 08 X4): times in a gap are left out, times in
17
+ * the repeated hour appear twice (earlier first), each with its offset.
18
+ */
19
+ export declare function getDayInstants(date: PlainDate, timeZone: string, stepMinutes: number): DayInstant[];
@@ -0,0 +1,52 @@
1
+ import { fromSecondOfDay, plainDateTime, toInstant, toZoned, } from "../../foundation/index.js";
2
+ const wallEquals = (zoned, time) => zoned.hour === time.hour && zoned.minute === time.minute && zoned.second === time.second;
3
+ const pad = (n) => String(n).padStart(2, "0");
4
+ /** `+07:00` for an offset in minutes. */
5
+ export function formatOffset(minutes) {
6
+ const abs = Math.abs(minutes);
7
+ return `${minutes < 0 ? "-" : "+"}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
8
+ }
9
+ /**
10
+ * Wall-aligned entries of one day (plan 08 X4): times in a gap are left out, times in
11
+ * the repeated hour appear twice (earlier first), each with its offset.
12
+ */
13
+ export function getDayInstants(date, timeZone, stepMinutes) {
14
+ const entries = [];
15
+ const step = Math.max(1, stepMinutes) * 60;
16
+ for (let at = 0; at < 86400; at += step) {
17
+ const time = fromSecondOfDay(at);
18
+ const wall = plainDateTime(date, time);
19
+ const earlier = toZoned(wall, timeZone, "earlier");
20
+ const later = toZoned(wall, timeZone, "later");
21
+ const keep = (zoned) => wallEquals(zoned, time);
22
+ const key = `${pad(time.hour)}:${pad(time.minute)}`;
23
+ if (!keep(earlier) && !keep(later))
24
+ continue; // gap
25
+ if (keep(earlier) && keep(later) && earlier.offset !== later.offset) {
26
+ entries.push({
27
+ key,
28
+ time,
29
+ offset: earlier.offset,
30
+ instant: toInstant(earlier),
31
+ ordinal: 1,
32
+ }, {
33
+ key: `${key}#2`,
34
+ time,
35
+ offset: later.offset,
36
+ instant: toInstant(later),
37
+ ordinal: 2,
38
+ });
39
+ }
40
+ else {
41
+ const zoned = keep(earlier) ? earlier : later;
42
+ entries.push({
43
+ key,
44
+ time,
45
+ offset: zoned.offset,
46
+ instant: toInstant(zoned),
47
+ ordinal: 1,
48
+ });
49
+ }
50
+ }
51
+ return entries;
52
+ }
@@ -0,0 +1,16 @@
1
+ import { type Disambiguation, type PlainDateTime, type ZonedDateTime } from "../../foundation/index.js";
2
+ export type ResolvedWall = {
3
+ zoned: ZonedDateTime;
4
+ /** The resolved wall fields differ from the typed ones (a DST gap was crossed). */
5
+ adjusted: boolean;
6
+ /** The wall time happens twice (a DST overlap). */
7
+ ambiguous: boolean;
8
+ };
9
+ /**
10
+ * Pin a wall time to a zone (plan 08 X3). A gap resolves per `disambiguation` and sets
11
+ * `adjusted`; an overlap resolves per `disambiguation` and sets `ambiguous`. With
12
+ * `"reject"` both throw a `RangeError`.
13
+ */
14
+ export declare function resolveWall(wall: PlainDateTime, zone: string, disambiguation?: Disambiguation): ResolvedWall;
15
+ /** The same instant in the zone the app stores values in (plan 08 X2). */
16
+ export declare const toValueZone: (zoned: ZonedDateTime, valueTimeZone: string | undefined) => ZonedDateTime;
@@ -0,0 +1,24 @@
1
+ import { toZoned, withTimeZone, } from "../../foundation/index.js";
2
+ const sameWall = (a, b) => a.year === b.year &&
3
+ a.month === b.month &&
4
+ a.day === b.day &&
5
+ a.hour === b.hour &&
6
+ a.minute === b.minute &&
7
+ a.second === b.second;
8
+ /**
9
+ * Pin a wall time to a zone (plan 08 X3). A gap resolves per `disambiguation` and sets
10
+ * `adjusted`; an overlap resolves per `disambiguation` and sets `ambiguous`. With
11
+ * `"reject"` both throw a `RangeError`.
12
+ */
13
+ export function resolveWall(wall, zone, disambiguation = "compatible") {
14
+ const zoned = toZoned(wall, zone, disambiguation);
15
+ const earlier = toZoned(wall, zone, "earlier");
16
+ const later = toZoned(wall, zone, "later");
17
+ return {
18
+ zoned,
19
+ adjusted: !sameWall(zoned, wall),
20
+ ambiguous: earlier.offset !== later.offset && sameWall(earlier, wall) && sameWall(later, wall),
21
+ };
22
+ }
23
+ /** The same instant in the zone the app stores values in (plan 08 X2). */
24
+ export const toValueZone = (zoned, valueTimeZone) => (valueTimeZone === undefined ? zoned : withTimeZone(zoned, valueTimeZone));