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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +624 -2
  3. package/dist/calendar/components.d.ts +346 -0
  4. package/dist/calendar/components.js +245 -0
  5. package/dist/calendar/context.d.ts +636 -0
  6. package/dist/calendar/context.js +21 -0
  7. package/dist/calendar/index.d.ts +6 -0
  8. package/dist/calendar/index.js +6 -0
  9. package/dist/calendar/mini-calendar.d.ts +60 -0
  10. package/dist/calendar/mini-calendar.js +50 -0
  11. package/dist/calendar/options.d.ts +4 -0
  12. package/dist/calendar/options.js +98 -0
  13. package/dist/calendar/use-calendar.d.ts +340 -0
  14. package/dist/calendar/use-calendar.js +156 -0
  15. package/dist/calendar/use-mini-calendar.d.ts +302 -0
  16. package/dist/calendar/use-mini-calendar.js +56 -0
  17. package/dist/calendar/utilities.d.ts +9 -0
  18. package/dist/calendar/utilities.js +8 -0
  19. package/dist/date/bind-panel.d.ts +30 -0
  20. package/dist/date/bind-panel.js +125 -0
  21. package/dist/date/components.d.ts +197 -0
  22. package/dist/date/components.js +202 -0
  23. package/dist/date/context.d.ts +34 -0
  24. package/dist/date/context.js +19 -0
  25. package/dist/date/index.d.ts +4 -0
  26. package/dist/date/index.js +4 -0
  27. package/dist/date/options.d.ts +7 -0
  28. package/dist/date/options.js +91 -0
  29. package/dist/date/use-date-input.d.ts +43 -0
  30. package/dist/date/use-date-input.js +138 -0
  31. package/dist/date/use-date-panel.d.ts +81 -0
  32. package/dist/date/use-date-panel.js +21 -0
  33. package/dist/date/utilities.d.ts +4 -0
  34. package/dist/date/utilities.js +4 -0
  35. package/dist/datetime/components.d.ts +121 -0
  36. package/dist/datetime/components.js +169 -0
  37. package/dist/datetime/context.d.ts +8 -0
  38. package/dist/datetime/context.js +18 -0
  39. package/dist/datetime/index.d.ts +4 -0
  40. package/dist/datetime/index.js +4 -0
  41. package/dist/datetime/options.d.ts +5 -0
  42. package/dist/datetime/options.js +99 -0
  43. package/dist/datetime/use-datetime-input.d.ts +44 -0
  44. package/dist/datetime/use-datetime-input.js +145 -0
  45. package/dist/datetime/use-datetime-panel.d.ts +128 -0
  46. package/dist/datetime/use-datetime-panel.js +60 -0
  47. package/dist/datetime/utilities.d.ts +4 -0
  48. package/dist/datetime/utilities.js +4 -0
  49. package/dist/index.d.ts +4 -0
  50. package/dist/index.js +4 -0
  51. package/dist/shared/merge-props.d.ts +9 -0
  52. package/dist/shared/merge-props.js +33 -0
  53. package/dist/shared/modifiers.d.ts +7 -0
  54. package/dist/shared/modifiers.js +6 -0
  55. package/dist/shared/part.d.ts +10 -0
  56. package/dist/shared/part.js +9 -0
  57. package/dist/shared/slot.d.ts +12 -0
  58. package/dist/shared/slot.js +60 -0
  59. package/dist/shared/style-properties.d.ts +8 -0
  60. package/dist/shared/style-properties.js +13 -0
  61. package/dist/shared/to-react-props.d.ts +11 -0
  62. package/dist/shared/to-react-props.js +27 -0
  63. package/dist/time/bind-panel.d.ts +19 -0
  64. package/dist/time/bind-panel.js +97 -0
  65. package/dist/time/components.d.ts +183 -0
  66. package/dist/time/components.js +174 -0
  67. package/dist/time/context.d.ts +24 -0
  68. package/dist/time/context.js +19 -0
  69. package/dist/time/index.d.ts +4 -0
  70. package/dist/time/index.js +4 -0
  71. package/dist/time/options.d.ts +5 -0
  72. package/dist/time/options.js +85 -0
  73. package/dist/time/use-time-input.d.ts +43 -0
  74. package/dist/time/use-time-input.js +138 -0
  75. package/dist/time/use-time-panel.d.ts +37 -0
  76. package/dist/time/use-time-panel.js +18 -0
  77. package/dist/time/utilities.d.ts +4 -0
  78. package/dist/time/utilities.js +4 -0
  79. package/dist/vendor/core/calendar/availability.d.ts +39 -0
  80. package/dist/vendor/core/calendar/availability.js +74 -0
  81. package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
  82. package/dist/vendor/core/calendar/controllers/calendar-controller.js +1448 -0
  83. package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
  84. package/dist/vendor/core/calendar/controllers/drag-engine.js +382 -0
  85. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
  86. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +170 -0
  87. package/dist/vendor/core/calendar/controllers/shared.d.ts +29 -0
  88. package/dist/vendor/core/calendar/controllers/shared.js +82 -0
  89. package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
  90. package/dist/vendor/core/calendar/events/agenda-layout.js +71 -0
  91. package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
  92. package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
  93. package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
  94. package/dist/vendor/core/calendar/events/background-layout.js +107 -0
  95. package/dist/vendor/core/calendar/events/index.d.ts +17 -0
  96. package/dist/vendor/core/calendar/events/index.js +8 -0
  97. package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
  98. package/dist/vendor/core/calendar/events/month-layout.js +156 -0
  99. package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
  100. package/dist/vendor/core/calendar/events/normalize.js +159 -0
  101. package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
  102. package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
  103. package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
  104. package/dist/vendor/core/calendar/events/overflow.js +112 -0
  105. package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
  106. package/dist/vendor/core/calendar/events/sort.js +35 -0
  107. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
  108. package/dist/vendor/core/calendar/events/time-grid-layout.js +184 -0
  109. package/dist/vendor/core/calendar/events/types.d.ts +141 -0
  110. package/dist/vendor/core/calendar/events/types.js +1 -0
  111. package/dist/vendor/core/calendar/index.d.ts +70 -0
  112. package/dist/vendor/core/calendar/index.js +37 -0
  113. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +19 -0
  114. package/dist/vendor/core/calendar/interaction/auto-scroll.js +64 -0
  115. package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
  116. package/dist/vendor/core/calendar/interaction/drag-geometry.js +125 -0
  117. package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
  118. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +56 -0
  119. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +23 -0
  120. package/dist/vendor/core/calendar/interaction/drag-pointer.js +203 -0
  121. package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
  122. package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
  123. package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
  124. package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
  125. package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
  126. package/dist/vendor/core/calendar/interaction/pending.js +17 -0
  127. package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
  128. package/dist/vendor/core/calendar/interaction/pointer.js +119 -0
  129. package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
  130. package/dist/vendor/core/calendar/interaction/selection.js +47 -0
  131. package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
  132. package/dist/vendor/core/calendar/internal/equal.js +43 -0
  133. package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
  134. package/dist/vendor/core/calendar/navigation/navigate.js +83 -0
  135. package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
  136. package/dist/vendor/core/calendar/navigation/range.js +52 -0
  137. package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
  138. package/dist/vendor/core/calendar/navigation/title.js +39 -0
  139. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
  140. package/dist/vendor/core/calendar/navigation/view-definition.js +61 -0
  141. package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
  142. package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
  143. package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
  144. package/dist/vendor/core/calendar/recurrence/apply.js +207 -0
  145. package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
  146. package/dist/vendor/core/calendar/recurrence/expand.js +302 -0
  147. package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
  148. package/dist/vendor/core/calendar/recurrence/pack.js +251 -0
  149. package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
  150. package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
  151. package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
  152. package/dist/vendor/core/calendar/recurrence/rrule.js +288 -0
  153. package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
  154. package/dist/vendor/core/calendar/recurrence/series.js +165 -0
  155. package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
  156. package/dist/vendor/core/calendar/recurrence/types.js +1 -0
  157. package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
  158. package/dist/vendor/core/calendar/resources/keys.js +2 -0
  159. package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
  160. package/dist/vendor/core/calendar/resources/resource-time-grid.js +130 -0
  161. package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
  162. package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
  163. package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
  164. package/dist/vendor/core/calendar/resources/timeline-layout.js +111 -0
  165. package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
  166. package/dist/vendor/core/calendar/resources/tree.js +86 -0
  167. package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
  168. package/dist/vendor/core/calendar/resources/types.js +1 -0
  169. package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
  170. package/dist/vendor/core/calendar/resources/views.js +45 -0
  171. package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
  172. package/dist/vendor/core/calendar/resources/windowing.js +17 -0
  173. package/dist/vendor/core/calendar/views/day.d.ts +37 -0
  174. package/dist/vendor/core/calendar/views/day.js +39 -0
  175. package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
  176. package/dist/vendor/core/calendar/views/list-layout.js +5 -0
  177. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
  178. package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
  179. package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
  180. package/dist/vendor/core/calendar/views/month-layout.js +63 -0
  181. package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
  182. package/dist/vendor/core/calendar/views/time-grid-layout.js +30 -0
  183. package/dist/vendor/core/date/index.d.ts +9 -0
  184. package/dist/vendor/core/date/index.js +9 -0
  185. package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
  186. package/dist/vendor/core/date/input/date-input-controller.js +478 -0
  187. package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
  188. package/dist/vendor/core/date/input/date-range-input-controller.js +189 -0
  189. package/dist/vendor/core/date/input/parse.d.ts +22 -0
  190. package/dist/vendor/core/date/input/parse.js +84 -0
  191. package/dist/vendor/core/date/input/validity.d.ts +6 -0
  192. package/dist/vendor/core/date/input/validity.js +13 -0
  193. package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
  194. package/dist/vendor/core/date/panel/panel-controller.js +726 -0
  195. package/dist/vendor/core/date/presets.d.ts +22 -0
  196. package/dist/vendor/core/date/presets.js +104 -0
  197. package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
  198. package/dist/vendor/core/date/selection/multiple.js +32 -0
  199. package/dist/vendor/core/date/selection/range.d.ts +29 -0
  200. package/dist/vendor/core/date/selection/range.js +39 -0
  201. package/dist/vendor/core/date/types.d.ts +12 -0
  202. package/dist/vendor/core/date/types.js +1 -0
  203. package/dist/vendor/core/datetime/compose.d.ts +24 -0
  204. package/dist/vendor/core/datetime/compose.js +49 -0
  205. package/dist/vendor/core/datetime/constraints.d.ts +42 -0
  206. package/dist/vendor/core/datetime/constraints.js +56 -0
  207. package/dist/vendor/core/datetime/index.d.ts +9 -0
  208. package/dist/vendor/core/datetime/index.js +9 -0
  209. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
  210. package/dist/vendor/core/datetime/input/datetime-input-controller.js +395 -0
  211. package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
  212. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +182 -0
  213. package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
  214. package/dist/vendor/core/datetime/input/parse.js +59 -0
  215. package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
  216. package/dist/vendor/core/datetime/panel/controller.js +197 -0
  217. package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
  218. package/dist/vendor/core/datetime/panel/range-controller.js +217 -0
  219. package/dist/vendor/core/datetime/types.d.ts +12 -0
  220. package/dist/vendor/core/datetime/types.js +1 -0
  221. package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
  222. package/dist/vendor/core/datetime/zone/day-instants.js +54 -0
  223. package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
  224. package/dist/vendor/core/datetime/zone/resolve.js +26 -0
  225. package/dist/vendor/core/foundation/a11y/announcer.d.ts +7 -0
  226. package/dist/vendor/core/foundation/a11y/announcer.js +36 -0
  227. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
  228. package/dist/vendor/core/foundation/a11y/grid-navigation.js +86 -0
  229. package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
  230. package/dist/vendor/core/foundation/a11y/index.js +5 -0
  231. package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
  232. package/dist/vendor/core/foundation/a11y/labels.js +43 -0
  233. package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
  234. package/dist/vendor/core/foundation/a11y/messages.js +74 -0
  235. package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
  236. package/dist/vendor/core/foundation/a11y/roving-focus.js +52 -0
  237. package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
  238. package/dist/vendor/core/foundation/constraints/availability-rules.js +66 -0
  239. package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
  240. package/dist/vendor/core/foundation/constraints/availability.js +490 -0
  241. package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
  242. package/dist/vendor/core/foundation/constraints/date.js +41 -0
  243. package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
  244. package/dist/vendor/core/foundation/constraints/index.js +4 -0
  245. package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
  246. package/dist/vendor/core/foundation/constraints/range.js +70 -0
  247. package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
  248. package/dist/vendor/core/foundation/constraints/time.js +56 -0
  249. package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
  250. package/dist/vendor/core/foundation/grid/index.js +4 -0
  251. package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
  252. package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
  253. package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
  254. package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
  255. package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
  256. package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
  257. package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
  258. package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
  259. package/dist/vendor/core/foundation/index.d.ts +8 -0
  260. package/dist/vendor/core/foundation/index.js +8 -0
  261. package/dist/vendor/core/foundation/input/form.d.ts +7 -0
  262. package/dist/vendor/core/foundation/input/form.js +10 -0
  263. package/dist/vendor/core/foundation/input/index.d.ts +6 -0
  264. package/dist/vendor/core/foundation/input/index.js +3 -0
  265. package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
  266. package/dist/vendor/core/foundation/input/segment-engine.js +49 -0
  267. package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
  268. package/dist/vendor/core/foundation/input/tokenize.js +24 -0
  269. package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
  270. package/dist/vendor/core/foundation/locale/digits.js +35 -0
  271. package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
  272. package/dist/vendor/core/foundation/locale/direction.js +37 -0
  273. package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
  274. package/dist/vendor/core/foundation/locale/format.js +79 -0
  275. package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
  276. package/dist/vendor/core/foundation/locale/hour-cycle.js +45 -0
  277. package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
  278. package/dist/vendor/core/foundation/locale/index.js +8 -0
  279. package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
  280. package/dist/vendor/core/foundation/locale/names.js +30 -0
  281. package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
  282. package/dist/vendor/core/foundation/locale/resolve.js +29 -0
  283. package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
  284. package/dist/vendor/core/foundation/locale/week-info.js +61 -0
  285. package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
  286. package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
  287. package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
  288. package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
  289. package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
  290. package/dist/vendor/core/foundation/ranges/index.js +2 -0
  291. package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
  292. package/dist/vendor/core/foundation/ranges/interval.js +56 -0
  293. package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
  294. package/dist/vendor/core/foundation/store/attributes.js +43 -0
  295. package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
  296. package/dist/vendor/core/foundation/store/controllable.js +50 -0
  297. package/dist/vendor/core/foundation/store/env.d.ts +1 -0
  298. package/dist/vendor/core/foundation/store/env.js +3 -0
  299. package/dist/vendor/core/foundation/store/global-state.d.ts +1 -0
  300. package/dist/vendor/core/foundation/store/global-state.js +21 -0
  301. package/dist/vendor/core/foundation/store/ids.d.ts +2 -0
  302. package/dist/vendor/core/foundation/store/ids.js +7 -0
  303. package/dist/vendor/core/foundation/store/index.d.ts +11 -0
  304. package/dist/vendor/core/foundation/store/index.js +7 -0
  305. package/dist/vendor/core/foundation/store/store.d.ts +7 -0
  306. package/dist/vendor/core/foundation/store/store.js +25 -0
  307. package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
  308. package/dist/vendor/core/foundation/store/ticker.js +27 -0
  309. package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
  310. package/dist/vendor/core/foundation/values/clock.js +21 -0
  311. package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
  312. package/dist/vendor/core/foundation/values/compare.js +70 -0
  313. package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
  314. package/dist/vendor/core/foundation/values/convert.js +112 -0
  315. package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
  316. package/dist/vendor/core/foundation/values/epoch-day.js +47 -0
  317. package/dist/vendor/core/foundation/values/index.d.ts +14 -0
  318. package/dist/vendor/core/foundation/values/index.js +10 -0
  319. package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
  320. package/dist/vendor/core/foundation/values/iso.js +113 -0
  321. package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
  322. package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
  323. package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
  324. package/dist/vendor/core/foundation/values/plain-date.js +105 -0
  325. package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
  326. package/dist/vendor/core/foundation/values/plain-time.js +45 -0
  327. package/dist/vendor/core/foundation/values/types.d.ts +37 -0
  328. package/dist/vendor/core/foundation/values/types.js +1 -0
  329. package/dist/vendor/core/foundation/values/week.d.ts +9 -0
  330. package/dist/vendor/core/foundation/values/week.js +31 -0
  331. package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
  332. package/dist/vendor/core/foundation/values/year-month.js +19 -0
  333. package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
  334. package/dist/vendor/core/foundation/values/zoned.js +155 -0
  335. package/dist/vendor/core/index.d.ts +5 -0
  336. package/dist/vendor/core/index.js +5 -0
  337. package/dist/vendor/core/time/index.d.ts +8 -0
  338. package/dist/vendor/core/time/index.js +8 -0
  339. package/dist/vendor/core/time/input/parse.d.ts +19 -0
  340. package/dist/vendor/core/time/input/parse.js +84 -0
  341. package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
  342. package/dist/vendor/core/time/input/time-input-controller.js +562 -0
  343. package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
  344. package/dist/vendor/core/time/input/time-range-input-controller.js +185 -0
  345. package/dist/vendor/core/time/input/validity.d.ts +7 -0
  346. package/dist/vendor/core/time/input/validity.js +16 -0
  347. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
  348. package/dist/vendor/core/time/panel/time-panel-controller.js +839 -0
  349. package/dist/vendor/core/time/selection/range.d.ts +25 -0
  350. package/dist/vendor/core/time/selection/range.js +35 -0
  351. package/dist/vendor/core/time/selection/slots.d.ts +46 -0
  352. package/dist/vendor/core/time/selection/slots.js +78 -0
  353. package/dist/vendor/core/time/types.d.ts +11 -0
  354. package/dist/vendor/core/time/types.js +1 -0
  355. package/package.json +90 -4
@@ -0,0 +1,49 @@
1
+ export const emptySegment = Object.freeze({
2
+ value: null,
3
+ buffer: "",
4
+ });
5
+ export const segmentOf = (value) => ({
6
+ value,
7
+ buffer: "",
8
+ });
9
+ /**
10
+ * Type one digit. A buffer that would exceed `max` restarts with the digit
11
+ * (typing `3` then `5` in a month yields `5`). `advance` is true when the
12
+ * part cannot take another digit.
13
+ */
14
+ export function typeDigit(def, segment, digit) {
15
+ let buffer = segment.buffer.length >= def.maxDigits
16
+ ? String(digit)
17
+ : segment.buffer + digit;
18
+ if (Number(buffer) > def.max) {
19
+ buffer = String(digit);
20
+ }
21
+ const n = Number(buffer);
22
+ if (n < def.min && buffer.length >= def.maxDigits) {
23
+ // "00" in a day or month: nothing valid can follow, start over.
24
+ return { segment: { value: null, buffer: "" }, advance: false };
25
+ }
26
+ return {
27
+ segment: { value: n >= def.min ? n : null, buffer },
28
+ advance: n >= def.min &&
29
+ (buffer.length >= def.maxDigits ||
30
+ (def.maxDigits === 2 && n * 10 > def.max)),
31
+ };
32
+ }
33
+ /** Step by `delta`, wrapping inside `[min, max]`. An empty part starts at `start`. */
34
+ export function stepSegment(def, segment, delta, start) {
35
+ if (segment.value === null) {
36
+ return segmentOf(Math.min(def.max, Math.max(def.min, start)));
37
+ }
38
+ const range = def.max - def.min + 1;
39
+ const offset = (((segment.value - def.min + delta) % range) + range) % range;
40
+ return segmentOf(def.min + offset);
41
+ }
42
+ /** Backspace: drop the last typed digit, or clear a part that has no buffer. */
43
+ export function backspace(segment) {
44
+ if (segment.buffer.length > 1) {
45
+ const buffer = segment.buffer.slice(0, -1);
46
+ return { value: Number(buffer) || null, buffer };
47
+ }
48
+ return emptySegment;
49
+ }
@@ -0,0 +1,19 @@
1
+ export type Token = {
2
+ type: "number";
3
+ text: string;
4
+ value: number;
5
+ } | {
6
+ type: "word";
7
+ text: string;
8
+ } | {
9
+ type: "separator";
10
+ text: string;
11
+ };
12
+ /**
13
+ * Split text into numbers, words and separators. Digits of any supported
14
+ * script count as numbers; every other character (including the CJK date
15
+ * marks 年月日) separates.
16
+ */
17
+ export declare function tokenize(text: string, locale?: string): Token[];
18
+ /** Lower-case and strip accents, so `März` matches `marz`. */
19
+ export declare const fold: (text: string) => string;
@@ -0,0 +1,24 @@
1
+ import { toLatinDigits } from "../locale/digits.js";
2
+ /**
3
+ * Split text into numbers, words and separators. Digits of any supported
4
+ * script count as numbers; every other character (including the CJK date
5
+ * marks 年月日) separates.
6
+ */
7
+ export function tokenize(text, locale) {
8
+ const tokens = [];
9
+ const pattern = /(\d+)|(\p{L}[\p{L}\p{M}'’.]*)|([^\d\p{L}]+)/gu;
10
+ for (const match of toLatinDigits(text, locale).matchAll(pattern)) {
11
+ if (match[1] !== undefined) {
12
+ tokens.push({ type: "number", text: match[1], value: Number(match[1]) });
13
+ }
14
+ else if (match[2] !== undefined && !/^[年月日]$/u.test(match[2])) {
15
+ tokens.push({ type: "word", text: match[2].replace(/\.$/, "") });
16
+ }
17
+ else {
18
+ tokens.push({ type: "separator", text: match[0] });
19
+ }
20
+ }
21
+ return tokens;
22
+ }
23
+ /** Lower-case and strip accents, so `März` matches `marz`. */
24
+ export const fold = (text) => text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
@@ -0,0 +1,6 @@
1
+ /** The ten digit characters a locale writes (`ar-EG` gives Arabic-Indic digits). */
2
+ export declare function getLocaleDigits(locale?: string): readonly string[];
3
+ /** Latin digits for any Arabic-Indic, Persian, Devanagari, Bengali or full-width digit. */
4
+ export declare function toLatinDigits(text: string, locale?: string): string;
5
+ /** Display a number with the locale's digits. */
6
+ export declare function toLocaleDigits(text: string, locale?: string): string;
@@ -0,0 +1,35 @@
1
+ const cache = new Map();
2
+ /** The ten digit characters a locale writes (`ar-EG` gives Arabic-Indic digits). */
3
+ export function getLocaleDigits(locale) {
4
+ const key = locale ?? "";
5
+ let digits = cache.get(key);
6
+ if (!digits) {
7
+ const format = new Intl.NumberFormat(locale, { useGrouping: false });
8
+ digits = Object.freeze(Array.from({ length: 10 }, (_, index) => format.format(index)));
9
+ cache.set(key, digits);
10
+ }
11
+ return digits;
12
+ }
13
+ /** Zero code points of common non-Latin decimal digit blocks. */
14
+ const ZEROS = [0x660, 0x6f0, 0x966, 0x9e6, 0xff10];
15
+ /** Latin digits for any Arabic-Indic, Persian, Devanagari, Bengali or full-width digit. */
16
+ export function toLatinDigits(text, locale) {
17
+ const local = getLocaleDigits(locale);
18
+ let result = "";
19
+ for (const char of text) {
20
+ const index = local.indexOf(char);
21
+ if (index > 0) {
22
+ result += String(index);
23
+ continue;
24
+ }
25
+ const code = char.codePointAt(0);
26
+ const zero = ZEROS.find((start) => code >= start && code < start + 10);
27
+ result += zero === undefined ? char : String(code - zero);
28
+ }
29
+ return result;
30
+ }
31
+ /** Display a number with the locale's digits. */
32
+ export function toLocaleDigits(text, locale) {
33
+ const local = getLocaleDigits(locale);
34
+ return text.replace(/\d/g, (digit) => local[Number(digit)]);
35
+ }
@@ -0,0 +1 @@
1
+ export declare function getTextDirection(locale?: string): "ltr" | "rtl";
@@ -0,0 +1,37 @@
1
+ import { resolveLocale } from "./resolve.js";
2
+ const RTL_SCRIPTS = new Set([
3
+ "Arab",
4
+ "Hebr",
5
+ "Thaa",
6
+ "Syrc",
7
+ "Nkoo",
8
+ "Adlm",
9
+ "Rohg",
10
+ "Mand",
11
+ "Samr",
12
+ ]);
13
+ const RTL_LANGUAGES = new Set([
14
+ "ar",
15
+ "he",
16
+ "fa",
17
+ "ur",
18
+ "ps",
19
+ "sd",
20
+ "ug",
21
+ "yi",
22
+ "dv",
23
+ "ckb",
24
+ "ku",
25
+ ]);
26
+ export function getTextDirection(locale) {
27
+ const parsed = new Intl.Locale(resolveLocale(locale));
28
+ const direction = parsed.getTextInfo?.().direction ?? parsed.textInfo?.direction;
29
+ if (direction === "rtl" || direction === "ltr") {
30
+ return direction;
31
+ }
32
+ const script = parsed.script ?? parsed.maximize().script;
33
+ if (script) {
34
+ return RTL_SCRIPTS.has(script) ? "rtl" : "ltr";
35
+ }
36
+ return RTL_LANGUAGES.has(parsed.language) ? "rtl" : "ltr";
37
+ }
@@ -0,0 +1,31 @@
1
+ import type { PlainDate, PlainDateTime, PlainTime } from "../values/types.js";
2
+ import type { Messages } from "../a11y/messages.js";
3
+ /** Intl options minus the two the library controls (UTC wall time, Gregorian). */
4
+ export type FormatOptions = Omit<Intl.DateTimeFormatOptions, "timeZone" | "calendar">;
5
+ /** Plain values are formatted as UTC, so the host zone never shifts them. */
6
+ export declare function formatDate(date: PlainDate, locale?: string, options?: FormatOptions): string;
7
+ export declare function formatTime(time: PlainTime, locale?: string, options?: FormatOptions): string;
8
+ export declare function formatDateTime(value: PlainDateTime, locale?: string, options?: FormatOptions): string;
9
+ export declare function formatDateRange(range: {
10
+ start: PlainDate;
11
+ end: PlainDate;
12
+ }, locale?: string, options?: FormatOptions): string;
13
+ /** Same as {@link formatDate} but split into typed parts, for apps that style pieces. */
14
+ export declare function formatDateToParts(date: PlainDate, locale?: string, options?: FormatOptions): Intl.DateTimeFormatPart[];
15
+ export declare function formatDateRangeToParts(range: {
16
+ start: PlainDate;
17
+ end: PlainDate;
18
+ }, locale?: string, options?: FormatOptions): Intl.DateTimeFormatPart[];
19
+ export type DatePartName = "day" | "month" | "year";
20
+ export type DatePartOrder = {
21
+ order: readonly DatePartName[];
22
+ /** Text between the first and second part, and between the second and third. */
23
+ separators: readonly [string, string];
24
+ /** Text before the first part and after the last part (for example the trailing "." in ko-KR). */
25
+ prefix: string;
26
+ suffix: string;
27
+ };
28
+ /** Order and separators of a numeric date, for segmented inputs and placeholders. */
29
+ export declare function getDatePartOrder(locale?: string): DatePartOrder;
30
+ /** A text-mode hint such as `dd/mm/yyyy`, from the locale's part order and the placeholder messages. */
31
+ export declare function getDateFormatPattern(locale: string | undefined, messages: Pick<Messages, "placeholderDay" | "placeholderMonth" | "placeholderYear">): string;
@@ -0,0 +1,79 @@
1
+ import { toEpochDay } from "../values/plain-date.js";
2
+ import { toSecondOfDay } from "../values/plain-time.js";
3
+ import { wallSeconds } from "../values/plain-date-time.js";
4
+ import { getFormatter } from "./resolve.js";
5
+ const DAY_MS = 86400000;
6
+ const DATE_DEFAULT = {
7
+ year: "numeric",
8
+ month: "numeric",
9
+ day: "numeric",
10
+ };
11
+ const TIME_DEFAULT = { hour: "numeric", minute: "2-digit" };
12
+ const DATE_TIME_DEFAULT = { ...DATE_DEFAULT, ...TIME_DEFAULT };
13
+ function utc(options) {
14
+ return { ...options, timeZone: "UTC" };
15
+ }
16
+ /** Plain values are formatted as UTC, so the host zone never shifts them. */
17
+ export function formatDate(date, locale, options = DATE_DEFAULT) {
18
+ return getFormatter(locale, utc(options)).format(toEpochDay(date) * DAY_MS);
19
+ }
20
+ export function formatTime(time, locale, options = TIME_DEFAULT) {
21
+ return getFormatter(locale, utc(options)).format(toSecondOfDay(time) * 1000);
22
+ }
23
+ export function formatDateTime(value, locale, options = DATE_TIME_DEFAULT) {
24
+ return getFormatter(locale, utc(options)).format(wallSeconds(value) * 1000);
25
+ }
26
+ export function formatDateRange(range, locale, options = DATE_DEFAULT) {
27
+ return getFormatter(locale, utc(options)).formatRange(toEpochDay(range.start) * DAY_MS, toEpochDay(range.end) * DAY_MS);
28
+ }
29
+ /** Same as {@link formatDate} but split into typed parts, for apps that style pieces. */
30
+ export function formatDateToParts(date, locale, options = DATE_DEFAULT) {
31
+ return getFormatter(locale, utc(options)).formatToParts(toEpochDay(date) * DAY_MS);
32
+ }
33
+ export function formatDateRangeToParts(range, locale, options = DATE_DEFAULT) {
34
+ return getFormatter(locale, utc(options)).formatRangeToParts(toEpochDay(range.start) * DAY_MS, toEpochDay(range.end) * DAY_MS);
35
+ }
36
+ /** Order and separators of a numeric date, for segmented inputs and placeholders. */
37
+ export function getDatePartOrder(locale) {
38
+ const parts = getFormatter(locale, utc({ year: "numeric", month: "numeric", day: "numeric" })).formatToParts(toEpochDay(plainDateTimeSample()) * DAY_MS);
39
+ const order = [];
40
+ const literals = [];
41
+ let prefix = "";
42
+ let pending = "";
43
+ for (const part of parts) {
44
+ if (part.type === "literal") {
45
+ pending += part.value;
46
+ }
47
+ else if (part.type === "day" ||
48
+ part.type === "month" ||
49
+ part.type === "year") {
50
+ if (order.length === 0) {
51
+ prefix = pending;
52
+ }
53
+ else {
54
+ literals.push(pending);
55
+ }
56
+ pending = "";
57
+ order.push(part.type);
58
+ }
59
+ }
60
+ return {
61
+ order,
62
+ separators: [literals[0] ?? "", literals[1] ?? ""],
63
+ prefix,
64
+ suffix: pending,
65
+ };
66
+ }
67
+ function plainDateTimeSample() {
68
+ return { calendar: "gregory", year: 2033, month: 11, day: 22 };
69
+ }
70
+ /** A text-mode hint such as `dd/mm/yyyy`, from the locale's part order and the placeholder messages. */
71
+ export function getDateFormatPattern(locale, messages) {
72
+ const { order, separators, prefix, suffix } = getDatePartOrder(locale);
73
+ const words = {
74
+ day: messages.placeholderDay,
75
+ month: messages.placeholderMonth,
76
+ year: messages.placeholderYear,
77
+ };
78
+ return `${prefix}${words[order[0]]}${separators[0]}${words[order[1]]}${separators[1]}${words[order[2]]}${suffix}`;
79
+ }
@@ -0,0 +1,12 @@
1
+ /** `h11`/`h12` fold into `"h12"`, `h23`/`h24` into `"h23"`. */
2
+ export declare function getHourCycle(locale?: string): "h12" | "h23";
3
+ /** Localized AM and PM markers. */
4
+ export declare function getDayPeriodNames(locale?: string): {
5
+ am: string;
6
+ pm: string;
7
+ };
8
+ /**
9
+ * The day-period words around a time ("in the morning"), from `Intl`; falls back
10
+ * to the AM/PM names for locales that have no flexible day periods.
11
+ */
12
+ export declare function getDayPeriodLabel(hour: number, locale?: string): string;
@@ -0,0 +1,45 @@
1
+ import { getFormatter } from "./resolve.js";
2
+ /** `h11`/`h12` fold into `"h12"`, `h23`/`h24` into `"h23"`. */
3
+ export function getHourCycle(locale) {
4
+ const formatter = getFormatter(locale, { hour: "numeric", timeZone: "UTC" });
5
+ const cycle = formatter.resolvedOptions().hourCycle;
6
+ if (cycle === "h11" || cycle === "h12") {
7
+ return "h12";
8
+ }
9
+ if (cycle === "h23" || cycle === "h24") {
10
+ return "h23";
11
+ }
12
+ return formatter.formatToParts(0).some((part) => part.type === "dayPeriod")
13
+ ? "h12"
14
+ : "h23";
15
+ }
16
+ /** Localized AM and PM markers. */
17
+ export function getDayPeriodNames(locale) {
18
+ const formatter = getFormatter(locale, {
19
+ hour: "numeric",
20
+ hourCycle: "h12",
21
+ timeZone: "UTC",
22
+ });
23
+ const period = (hour) => formatter
24
+ .formatToParts(hour * 3600000)
25
+ .find((part) => part.type === "dayPeriod")?.value ?? "";
26
+ return { am: period(1), pm: period(13) };
27
+ }
28
+ /**
29
+ * The day-period words around a time ("in the morning"), from `Intl`; falls back
30
+ * to the AM/PM names for locales that have no flexible day periods.
31
+ */
32
+ export function getDayPeriodLabel(hour, locale) {
33
+ const formatter = getFormatter(locale, {
34
+ hour: "numeric",
35
+ dayPeriod: "long",
36
+ timeZone: "UTC",
37
+ });
38
+ const part = formatter
39
+ .formatToParts(hour * 3600000)
40
+ .find((item) => item.type === "dayPeriod")?.value;
41
+ if (part)
42
+ return part;
43
+ const names = getDayPeriodNames(locale);
44
+ return hour < 12 ? names.am : names.pm;
45
+ }
@@ -0,0 +1,10 @@
1
+ export { resolveLocale } from "./resolve.js";
2
+ export { getWeekInfo } from "./week-info.js";
3
+ export { getMonthNames, getWeekdayNames } from "./names.js";
4
+ export type { NameWidth } from "./names.js";
5
+ export { getDayPeriodLabel, getDayPeriodNames, getHourCycle, } from "./hour-cycle.js";
6
+ export { getTextDirection } from "./direction.js";
7
+ export { formatDate, formatDateRange, formatDateRangeToParts, formatDateToParts, formatDateTime, formatTime, getDatePartOrder, getDateFormatPattern, } from "./format.js";
8
+ export type { DatePartName, DatePartOrder, FormatOptions } from "./format.js";
9
+ export { getLocaleDigits, toLatinDigits, toLocaleDigits } from "./digits.js";
10
+ export { getTimeZoneLabel } from "./zone-label.js";
@@ -0,0 +1,8 @@
1
+ export { resolveLocale } from "./resolve.js";
2
+ export { getWeekInfo } from "./week-info.js";
3
+ export { getMonthNames, getWeekdayNames } from "./names.js";
4
+ export { getDayPeriodLabel, getDayPeriodNames, getHourCycle, } from "./hour-cycle.js";
5
+ export { getTextDirection } from "./direction.js";
6
+ export { formatDate, formatDateRange, formatDateRangeToParts, formatDateToParts, formatDateTime, formatTime, getDatePartOrder, getDateFormatPattern, } from "./format.js";
7
+ export { getLocaleDigits, toLatinDigits, toLocaleDigits } from "./digits.js";
8
+ export { getTimeZoneLabel } from "./zone-label.js";
@@ -0,0 +1,6 @@
1
+ import type { DayOfWeek } from "../values/types.js";
2
+ export type NameWidth = "long" | "short" | "narrow";
3
+ /** Twelve month names, January first. */
4
+ export declare function getMonthNames(locale: string | undefined, width: NameWidth): readonly string[];
5
+ /** Seven weekday names starting at `firstDay` (default: the locale's first day). */
6
+ export declare function getWeekdayNames(locale: string | undefined, width: NameWidth, firstDay?: DayOfWeek): readonly string[];
@@ -0,0 +1,30 @@
1
+ import { toEpochDay, plainDate } from "../values/plain-date.js";
2
+ import { getFormatter } from "./resolve.js";
3
+ import { getWeekInfo } from "./week-info.js";
4
+ const DAY_MS = 86400000;
5
+ const cache = new Map();
6
+ function memo(key, create) {
7
+ let names = cache.get(key);
8
+ if (!names) {
9
+ names = Object.freeze(create());
10
+ cache.set(key, names);
11
+ }
12
+ return names;
13
+ }
14
+ /** Twelve month names, January first. */
15
+ export function getMonthNames(locale, width) {
16
+ return memo(`m|${locale ?? ""}|${width}`, () => {
17
+ const formatter = getFormatter(locale, { month: width, timeZone: "UTC" });
18
+ return Array.from({ length: 12 }, (_, index) => formatter.format(toEpochDay(plainDate(2021, index + 1, 15)) * DAY_MS));
19
+ });
20
+ }
21
+ /** Seven weekday names starting at `firstDay` (default: the locale's first day). */
22
+ export function getWeekdayNames(locale, width, firstDay) {
23
+ const start = firstDay ?? getWeekInfo(locale).firstDay;
24
+ return memo(`w|${locale ?? ""}|${width}|${start}`, () => {
25
+ const formatter = getFormatter(locale, { weekday: width, timeZone: "UTC" });
26
+ // 2021-01-04 was a Monday.
27
+ const monday = toEpochDay(plainDate(2021, 1, 4));
28
+ return Array.from({ length: 7 }, (_, index) => formatter.format((monday + ((start - 1 + index) % 7)) * DAY_MS));
29
+ });
30
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Canonical BCP 47 tag. `undefined` means the runtime default (D11); SSR apps
3
+ * should pass a locale explicitly because server and browser defaults differ.
4
+ */
5
+ export declare function resolveLocale(locale?: string): string;
6
+ /** Cached formatter. Always Gregorian: Chrono has no other calendars in v1. */
7
+ export declare function getFormatter(locale: string | undefined, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
@@ -0,0 +1,29 @@
1
+ /** Internal: locale resolution and a lazy `Intl.DateTimeFormat` cache (plan 03 §3.2). */
2
+ const formatters = new Map();
3
+ function runtimeLocale() {
4
+ return new Intl.DateTimeFormat().resolvedOptions().locale;
5
+ }
6
+ /**
7
+ * Canonical BCP 47 tag. `undefined` means the runtime default (D11); SSR apps
8
+ * should pass a locale explicitly because server and browser defaults differ.
9
+ */
10
+ export function resolveLocale(locale) {
11
+ if (locale === undefined || locale === "") {
12
+ return runtimeLocale();
13
+ }
14
+ return Intl.getCanonicalLocales(locale)[0] ?? runtimeLocale();
15
+ }
16
+ /** Cached formatter. Always Gregorian: Chrono has no other calendars in v1. */
17
+ export function getFormatter(locale, options) {
18
+ const resolved = resolveLocale(locale);
19
+ const key = `${resolved}|${JSON.stringify(options)}`;
20
+ let formatter = formatters.get(key);
21
+ if (!formatter) {
22
+ formatter = new Intl.DateTimeFormat(resolved, {
23
+ ...options,
24
+ calendar: "gregory",
25
+ });
26
+ formatters.set(key, formatter);
27
+ }
28
+ return formatter;
29
+ }
@@ -0,0 +1,5 @@
1
+ import type { WeekInfo } from "../values/types.js";
2
+ /** The built-in table only, for tests that check it against `Intl`. */
3
+ export declare function getFallbackWeekInfo(region: string | undefined): WeekInfo;
4
+ /** First day, weekend and minimal days of a locale's week (D12). */
5
+ export declare function getWeekInfo(locale?: string): WeekInfo;
@@ -0,0 +1,61 @@
1
+ import { resolveLocale } from "./resolve.js";
2
+ /**
3
+ * CLDR `weekData` for regions that differ from Monday / Sat-Sun (D12). Used
4
+ * only when the runtime has no `Intl.Locale` week info. A test compares it
5
+ * with `Intl` where available.
6
+ */
7
+ const FIRST_DAY_AND_WEEKEND = [
8
+ [
9
+ "AG AS BD BR BS BT BU BW BZ CA CO DM DO ET GT GU HK HN ID IS JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY RH SG SV TH TT TW UM US VE VI WS ZA ZW",
10
+ 7,
11
+ [6, 7],
12
+ ],
13
+ ["IL SA YD YE", 7, [5, 6]],
14
+ ["IN", 7, [7]],
15
+ ["BH DZ EG IQ JO KW LY OM QA SD SY", 6, [5, 6]],
16
+ ["DJ", 6, [6, 7]],
17
+ ["AF", 6, [4, 5]],
18
+ ["IR", 6, [5]],
19
+ ["MV", 5, [6, 7]],
20
+ ["UG", 1, [7]],
21
+ ];
22
+ /** Regions whose first week needs 4 days in the year (ISO-like); everyone else uses 1. */
23
+ const MINIMAL_DAYS_4 = new Set("AD AN AT AX BE BG CH CZ DE DK EE ES FI FJ FO FR GB GF GG GI GP GR HU IE IM IS IT JE LI LT LU MC MQ NL NO PL RE RU SE SJ SK SM VA".split(" "));
24
+ const byRegion = new Map();
25
+ function regionTable() {
26
+ if (byRegion.size === 0) {
27
+ for (const [regions, firstDay, weekend] of FIRST_DAY_AND_WEEKEND) {
28
+ for (const region of regions.split(" ")) {
29
+ byRegion.set(region, { firstDay, weekend });
30
+ }
31
+ }
32
+ }
33
+ return byRegion;
34
+ }
35
+ function regionOf(locale) {
36
+ return locale.region ?? locale.maximize().region;
37
+ }
38
+ /** The built-in table only, for tests that check it against `Intl`. */
39
+ export function getFallbackWeekInfo(region) {
40
+ const row = region ? regionTable().get(region) : undefined;
41
+ return {
42
+ firstDay: row?.firstDay ?? 1,
43
+ weekend: row?.weekend ?? [6, 7],
44
+ minimalDays: region && MINIMAL_DAYS_4.has(region) ? 4 : 1,
45
+ };
46
+ }
47
+ /** First day, weekend and minimal days of a locale's week (D12). */
48
+ export function getWeekInfo(locale) {
49
+ const parsed = new Intl.Locale(resolveLocale(locale));
50
+ const fallback = getFallbackWeekInfo(regionOf(parsed));
51
+ const native = parsed.getWeekInfo?.() ?? parsed.weekInfo;
52
+ if (!native) {
53
+ return fallback;
54
+ }
55
+ return {
56
+ firstDay: native.firstDay,
57
+ weekend: native.weekend,
58
+ minimalDays: (native.minimalDays ??
59
+ fallback.minimalDays),
60
+ };
61
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A readable name for a display zone ("Vietnam Time"), for the time-zone label
3
+ * (plan 08 X11). Falls back from `shortGeneric` to `long`, `short` and the zone
4
+ * id itself; never throws.
5
+ */
6
+ export declare function getTimeZoneLabel(timeZone: string, locale?: string, at?: number): string;
@@ -0,0 +1,24 @@
1
+ import { getFormatter } from "./resolve.js";
2
+ /**
3
+ * A readable name for a display zone ("Vietnam Time"), for the time-zone label
4
+ * (plan 08 X11). Falls back from `shortGeneric` to `long`, `short` and the zone
5
+ * id itself; never throws.
6
+ */
7
+ export function getTimeZoneLabel(timeZone, locale, at = 0) {
8
+ for (const style of ["shortGeneric", "long", "short"]) {
9
+ try {
10
+ const part = getFormatter(locale, {
11
+ timeZone,
12
+ timeZoneName: style,
13
+ })
14
+ .formatToParts(at)
15
+ .find((item) => item.type === "timeZoneName")?.value;
16
+ if (part)
17
+ return part;
18
+ }
19
+ catch {
20
+ // Try the next style.
21
+ }
22
+ }
23
+ return timeZone;
24
+ }
@@ -0,0 +1,18 @@
1
+ import type { PlainDate } from "../values/types.js";
2
+ /** Inclusive on both ends (D9). */
3
+ export type DateRange = {
4
+ start: PlainDate;
5
+ end: PlainDate;
6
+ };
7
+ /** Swap so that `start <= end` (F13 auto-swap). */
8
+ export declare function normalizeDateRange(a: PlainDate, b: PlainDate): DateRange;
9
+ export declare function isDateInRange(date: PlainDate, range: DateRange): boolean;
10
+ /** Number of days, both ends included. */
11
+ export declare function dateRangeLength(range: DateRange): number;
12
+ export declare function dateRangesOverlap(a: DateRange, b: DateRange): boolean;
13
+ /** The shared days of two ranges, or `null`. */
14
+ export declare function intersectDateRanges(a: DateRange, b: DateRange): DateRange | null;
15
+ /** Pull a date into the range. */
16
+ export declare function clampDate(date: PlainDate, range: DateRange): PlainDate;
17
+ /** Every day of the range, in order. */
18
+ export declare function eachDay(range: DateRange): Generator<PlainDate, void, undefined>;
@@ -0,0 +1,40 @@
1
+ import { fromEpochDay, toEpochDay } from "../values/plain-date.js";
2
+ import { compare } from "../values/compare.js";
3
+ /** Swap so that `start <= end` (F13 auto-swap). */
4
+ export function normalizeDateRange(a, b) {
5
+ return compare(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a };
6
+ }
7
+ export function isDateInRange(date, range) {
8
+ return compare(date, range.start) >= 0 && compare(date, range.end) <= 0;
9
+ }
10
+ /** Number of days, both ends included. */
11
+ export function dateRangeLength(range) {
12
+ return toEpochDay(range.end) - toEpochDay(range.start) + 1;
13
+ }
14
+ export function dateRangesOverlap(a, b) {
15
+ return compare(a.start, b.end) <= 0 && compare(b.start, a.end) <= 0;
16
+ }
17
+ /** The shared days of two ranges, or `null`. */
18
+ export function intersectDateRanges(a, b) {
19
+ if (!dateRangesOverlap(a, b)) {
20
+ return null;
21
+ }
22
+ return {
23
+ start: compare(a.start, b.start) >= 0 ? a.start : b.start,
24
+ end: compare(a.end, b.end) <= 0 ? a.end : b.end,
25
+ };
26
+ }
27
+ /** Pull a date into the range. */
28
+ export function clampDate(date, range) {
29
+ if (compare(date, range.start) < 0) {
30
+ return range.start;
31
+ }
32
+ return compare(date, range.end) > 0 ? range.end : date;
33
+ }
34
+ /** Every day of the range, in order. */
35
+ export function* eachDay(range) {
36
+ const last = toEpochDay(range.end);
37
+ for (let day = toEpochDay(range.start); day <= last; day += 1) {
38
+ yield fromEpochDay(day);
39
+ }
40
+ }
@@ -0,0 +1,4 @@
1
+ export { clampDate, dateRangeLength, dateRangesOverlap, eachDay, intersectDateRanges, isDateInRange, normalizeDateRange, } from "./date-range.js";
2
+ export type { DateRange } from "./date-range.js";
3
+ export { intervalDuration, intervalsOverlap, splitIntervalByDay, } from "./interval.js";
4
+ export type { Interval, IntervalPiece } from "./interval.js";
@@ -0,0 +1,2 @@
1
+ export { clampDate, dateRangeLength, dateRangesOverlap, eachDay, intersectDateRanges, isDateInRange, normalizeDateRange, } from "./date-range.js";
2
+ export { intervalDuration, intervalsOverlap, splitIntervalByDay, } from "./interval.js";
@@ -0,0 +1,24 @@
1
+ import type { PlainDate, PlainDateTime, ZonedDateTime } from "../values/types.js";
2
+ /** Half-open `[start, end)` (D9). Both ends are the same kind of value. */
3
+ export type Interval<T extends PlainDateTime | ZonedDateTime = PlainDateTime | ZonedDateTime> = {
4
+ start: T;
5
+ end: T;
6
+ };
7
+ export type IntervalPiece<T extends PlainDateTime | ZonedDateTime> = {
8
+ date: PlainDate;
9
+ start: T;
10
+ end: T;
11
+ /** The interval started on an earlier day. */
12
+ continuesBefore: boolean;
13
+ /** The interval ends on a later day. */
14
+ continuesAfter: boolean;
15
+ };
16
+ export declare function intervalsOverlap<T extends PlainDateTime | ZonedDateTime>(a: Interval<T>, b: Interval<T>): boolean;
17
+ /** Length in milliseconds: elapsed time for zoned values, wall-clock for plain ones. */
18
+ export declare function intervalDuration(interval: Interval): number;
19
+ /**
20
+ * Split an interval at midnight. Zoned intervals are split at local midnight
21
+ * in `timeZone` (default: the start's zone), so 23 and 25 hour days come out
22
+ * with their real length. Empty or reversed intervals return no pieces.
23
+ */
24
+ export declare function splitIntervalByDay<T extends PlainDateTime | ZonedDateTime>(interval: Interval<T>, timeZone?: string): IntervalPiece<T>[];