@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.
- package/LICENSE +21 -0
- package/README.md +625 -2
- package/dist/calendar/components.d.ts +346 -0
- package/dist/calendar/components.js +243 -0
- package/dist/calendar/context.d.ts +636 -0
- package/dist/calendar/context.js +21 -0
- package/dist/calendar/index.d.ts +6 -0
- package/dist/calendar/index.js +6 -0
- package/dist/calendar/mini-calendar.d.ts +60 -0
- package/dist/calendar/mini-calendar.js +51 -0
- package/dist/calendar/options.d.ts +4 -0
- package/dist/calendar/options.js +98 -0
- package/dist/calendar/use-calendar.d.ts +340 -0
- package/dist/calendar/use-calendar.js +154 -0
- package/dist/calendar/use-mini-calendar.d.ts +302 -0
- package/dist/calendar/use-mini-calendar.js +56 -0
- package/dist/calendar/utilities.d.ts +9 -0
- package/dist/calendar/utilities.js +8 -0
- package/dist/date/bind-panel.d.ts +30 -0
- package/dist/date/bind-panel.js +125 -0
- package/dist/date/components.d.ts +197 -0
- package/dist/date/components.js +193 -0
- package/dist/date/context.d.ts +34 -0
- package/dist/date/context.js +19 -0
- package/dist/date/index.d.ts +4 -0
- package/dist/date/index.js +4 -0
- package/dist/date/options.d.ts +7 -0
- package/dist/date/options.js +91 -0
- package/dist/date/use-date-input.d.ts +43 -0
- package/dist/date/use-date-input.js +138 -0
- package/dist/date/use-date-panel.d.ts +81 -0
- package/dist/date/use-date-panel.js +21 -0
- package/dist/date/utilities.d.ts +4 -0
- package/dist/date/utilities.js +4 -0
- package/dist/datetime/components.d.ts +121 -0
- package/dist/datetime/components.js +164 -0
- package/dist/datetime/context.d.ts +8 -0
- package/dist/datetime/context.js +18 -0
- package/dist/datetime/index.d.ts +4 -0
- package/dist/datetime/index.js +4 -0
- package/dist/datetime/options.d.ts +5 -0
- package/dist/datetime/options.js +99 -0
- package/dist/datetime/use-datetime-input.d.ts +44 -0
- package/dist/datetime/use-datetime-input.js +145 -0
- package/dist/datetime/use-datetime-panel.d.ts +128 -0
- package/dist/datetime/use-datetime-panel.js +60 -0
- package/dist/datetime/utilities.d.ts +4 -0
- package/dist/datetime/utilities.js +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/shared/defined-options.d.ts +18 -0
- package/dist/shared/defined-options.js +9 -0
- package/dist/shared/merge-props.d.ts +9 -0
- package/dist/shared/merge-props.js +31 -0
- package/dist/shared/modifiers.d.ts +7 -0
- package/dist/shared/modifiers.js +6 -0
- package/dist/shared/part.d.ts +10 -0
- package/dist/shared/part.js +9 -0
- package/dist/shared/slot.d.ts +12 -0
- package/dist/shared/slot.js +57 -0
- package/dist/shared/style-properties.d.ts +8 -0
- package/dist/shared/style-properties.js +13 -0
- package/dist/shared/to-react-props.d.ts +11 -0
- package/dist/shared/to-react-props.js +27 -0
- package/dist/time/bind-panel.d.ts +19 -0
- package/dist/time/bind-panel.js +97 -0
- package/dist/time/components.d.ts +183 -0
- package/dist/time/components.js +169 -0
- package/dist/time/context.d.ts +24 -0
- package/dist/time/context.js +19 -0
- package/dist/time/index.d.ts +4 -0
- package/dist/time/index.js +4 -0
- package/dist/time/options.d.ts +5 -0
- package/dist/time/options.js +85 -0
- package/dist/time/use-time-input.d.ts +43 -0
- package/dist/time/use-time-input.js +138 -0
- package/dist/time/use-time-panel.d.ts +37 -0
- package/dist/time/use-time-panel.js +18 -0
- package/dist/time/utilities.d.ts +4 -0
- package/dist/time/utilities.js +4 -0
- package/dist/vendor/core/calendar/availability.d.ts +39 -0
- package/dist/vendor/core/calendar/availability.js +73 -0
- package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
- package/dist/vendor/core/calendar/controllers/calendar-controller.js +1396 -0
- package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
- package/dist/vendor/core/calendar/controllers/drag-engine.js +363 -0
- package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
- package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +171 -0
- package/dist/vendor/core/calendar/controllers/shared.d.ts +33 -0
- package/dist/vendor/core/calendar/controllers/shared.js +82 -0
- package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
- package/dist/vendor/core/calendar/events/agenda-layout.js +72 -0
- package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
- package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
- package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
- package/dist/vendor/core/calendar/events/background-layout.js +106 -0
- package/dist/vendor/core/calendar/events/index.d.ts +17 -0
- package/dist/vendor/core/calendar/events/index.js +8 -0
- package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
- package/dist/vendor/core/calendar/events/month-layout.js +157 -0
- package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
- package/dist/vendor/core/calendar/events/normalize.js +156 -0
- package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
- package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
- package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
- package/dist/vendor/core/calendar/events/overflow.js +112 -0
- package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
- package/dist/vendor/core/calendar/events/sort.js +35 -0
- package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
- package/dist/vendor/core/calendar/events/time-grid-layout.js +177 -0
- package/dist/vendor/core/calendar/events/types.d.ts +141 -0
- package/dist/vendor/core/calendar/events/types.js +1 -0
- package/dist/vendor/core/calendar/index.d.ts +70 -0
- package/dist/vendor/core/calendar/index.js +37 -0
- package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +11 -0
- package/dist/vendor/core/calendar/interaction/auto-scroll.js +37 -0
- package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
- package/dist/vendor/core/calendar/interaction/drag-geometry.js +122 -0
- package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
- package/dist/vendor/core/calendar/interaction/drag-keyboard.js +53 -0
- package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +24 -0
- package/dist/vendor/core/calendar/interaction/drag-pointer.js +43 -0
- package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
- package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
- package/dist/vendor/core/calendar/interaction/gesture-handle.d.ts +17 -0
- package/dist/vendor/core/calendar/interaction/gesture-handle.js +26 -0
- package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
- package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
- package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
- package/dist/vendor/core/calendar/interaction/pending.js +17 -0
- package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
- package/dist/vendor/core/calendar/interaction/pointer.js +169 -0
- package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
- package/dist/vendor/core/calendar/interaction/selection.js +47 -0
- package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
- package/dist/vendor/core/calendar/internal/equal.js +43 -0
- package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
- package/dist/vendor/core/calendar/navigation/navigate.js +81 -0
- package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
- package/dist/vendor/core/calendar/navigation/range.js +52 -0
- package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
- package/dist/vendor/core/calendar/navigation/title.js +39 -0
- package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
- package/dist/vendor/core/calendar/navigation/view-definition.js +62 -0
- package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
- package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
- package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
- package/dist/vendor/core/calendar/recurrence/apply.js +206 -0
- package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
- package/dist/vendor/core/calendar/recurrence/expand.js +298 -0
- package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
- package/dist/vendor/core/calendar/recurrence/pack.js +248 -0
- package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
- package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
- package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
- package/dist/vendor/core/calendar/recurrence/rrule.js +278 -0
- package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
- package/dist/vendor/core/calendar/recurrence/series.js +163 -0
- package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
- package/dist/vendor/core/calendar/recurrence/types.js +1 -0
- package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
- package/dist/vendor/core/calendar/resources/keys.js +2 -0
- package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/resource-time-grid.js +129 -0
- package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
- package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
- package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/timeline-layout.js +109 -0
- package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
- package/dist/vendor/core/calendar/resources/tree.js +86 -0
- package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
- package/dist/vendor/core/calendar/resources/types.js +1 -0
- package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
- package/dist/vendor/core/calendar/resources/views.js +45 -0
- package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
- package/dist/vendor/core/calendar/resources/windowing.js +17 -0
- package/dist/vendor/core/calendar/views/day.d.ts +37 -0
- package/dist/vendor/core/calendar/views/day.js +36 -0
- package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
- package/dist/vendor/core/calendar/views/list-layout.js +5 -0
- package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
- package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
- package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
- package/dist/vendor/core/calendar/views/month-layout.js +63 -0
- package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
- package/dist/vendor/core/calendar/views/time-grid-layout.js +27 -0
- package/dist/vendor/core/date/index.d.ts +9 -0
- package/dist/vendor/core/date/index.js +9 -0
- package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
- package/dist/vendor/core/date/input/date-input-controller.js +466 -0
- package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
- package/dist/vendor/core/date/input/date-range-input-controller.js +186 -0
- package/dist/vendor/core/date/input/parse.d.ts +22 -0
- package/dist/vendor/core/date/input/parse.js +78 -0
- package/dist/vendor/core/date/input/validity.d.ts +6 -0
- package/dist/vendor/core/date/input/validity.js +13 -0
- package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
- package/dist/vendor/core/date/panel/panel-controller.js +704 -0
- package/dist/vendor/core/date/presets.d.ts +22 -0
- package/dist/vendor/core/date/presets.js +103 -0
- package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
- package/dist/vendor/core/date/selection/multiple.js +29 -0
- package/dist/vendor/core/date/selection/range.d.ts +29 -0
- package/dist/vendor/core/date/selection/range.js +35 -0
- package/dist/vendor/core/date/types.d.ts +12 -0
- package/dist/vendor/core/date/types.js +1 -0
- package/dist/vendor/core/datetime/compose.d.ts +24 -0
- package/dist/vendor/core/datetime/compose.js +49 -0
- package/dist/vendor/core/datetime/constraints.d.ts +42 -0
- package/dist/vendor/core/datetime/constraints.js +56 -0
- package/dist/vendor/core/datetime/index.d.ts +9 -0
- package/dist/vendor/core/datetime/index.js +9 -0
- package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
- package/dist/vendor/core/datetime/input/datetime-input-controller.js +380 -0
- package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
- package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +171 -0
- package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
- package/dist/vendor/core/datetime/input/parse.js +56 -0
- package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
- package/dist/vendor/core/datetime/panel/controller.js +191 -0
- package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
- package/dist/vendor/core/datetime/panel/range-controller.js +205 -0
- package/dist/vendor/core/datetime/types.d.ts +12 -0
- package/dist/vendor/core/datetime/types.js +1 -0
- package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
- package/dist/vendor/core/datetime/zone/day-instants.js +52 -0
- package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
- package/dist/vendor/core/datetime/zone/resolve.js +24 -0
- package/dist/vendor/core/dom/auto-scroll.d.ts +37 -0
- package/dist/vendor/core/dom/auto-scroll.js +57 -0
- package/dist/vendor/core/dom/drag-session.d.ts +25 -0
- package/dist/vendor/core/dom/drag-session.js +257 -0
- package/dist/vendor/core/foundation/a11y/announcer.d.ts +12 -0
- package/dist/vendor/core/foundation/a11y/announcer.js +24 -0
- package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
- package/dist/vendor/core/foundation/a11y/grid-navigation.js +76 -0
- package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
- package/dist/vendor/core/foundation/a11y/index.js +5 -0
- package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
- package/dist/vendor/core/foundation/a11y/labels.js +43 -0
- package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
- package/dist/vendor/core/foundation/a11y/messages.js +74 -0
- package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
- package/dist/vendor/core/foundation/a11y/roving-focus.js +73 -0
- package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
- package/dist/vendor/core/foundation/constraints/availability-rules.js +64 -0
- package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
- package/dist/vendor/core/foundation/constraints/availability.js +480 -0
- package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
- package/dist/vendor/core/foundation/constraints/date.js +41 -0
- package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
- package/dist/vendor/core/foundation/constraints/index.js +4 -0
- package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
- package/dist/vendor/core/foundation/constraints/range.js +70 -0
- package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
- package/dist/vendor/core/foundation/constraints/time.js +56 -0
- package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
- package/dist/vendor/core/foundation/grid/index.js +4 -0
- package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
- package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
- package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
- package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
- package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
- package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
- package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
- package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
- package/dist/vendor/core/foundation/index.d.ts +8 -0
- package/dist/vendor/core/foundation/index.js +8 -0
- package/dist/vendor/core/foundation/input/form.d.ts +7 -0
- package/dist/vendor/core/foundation/input/form.js +10 -0
- package/dist/vendor/core/foundation/input/index.d.ts +6 -0
- package/dist/vendor/core/foundation/input/index.js +3 -0
- package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
- package/dist/vendor/core/foundation/input/segment-engine.js +45 -0
- package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
- package/dist/vendor/core/foundation/input/tokenize.js +24 -0
- package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/digits.js +35 -0
- package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
- package/dist/vendor/core/foundation/locale/direction.js +25 -0
- package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
- package/dist/vendor/core/foundation/locale/format.js +77 -0
- package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
- package/dist/vendor/core/foundation/locale/hour-cycle.js +41 -0
- package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
- package/dist/vendor/core/foundation/locale/index.js +8 -0
- package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/names.js +30 -0
- package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
- package/dist/vendor/core/foundation/locale/resolve.js +39 -0
- package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
- package/dist/vendor/core/foundation/locale/week-info.js +60 -0
- package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
- package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
- package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
- package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
- package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
- package/dist/vendor/core/foundation/ranges/index.js +2 -0
- package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
- package/dist/vendor/core/foundation/ranges/interval.js +54 -0
- package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
- package/dist/vendor/core/foundation/store/attributes.js +43 -0
- package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
- package/dist/vendor/core/foundation/store/controllable.js +50 -0
- package/dist/vendor/core/foundation/store/env.d.ts +1 -0
- package/dist/vendor/core/foundation/store/env.js +3 -0
- package/dist/vendor/core/foundation/store/ids.d.ts +9 -0
- package/dist/vendor/core/foundation/store/ids.js +12 -0
- package/dist/vendor/core/foundation/store/index.d.ts +11 -0
- package/dist/vendor/core/foundation/store/index.js +7 -0
- package/dist/vendor/core/foundation/store/store.d.ts +7 -0
- package/dist/vendor/core/foundation/store/store.js +25 -0
- package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
- package/dist/vendor/core/foundation/store/ticker.js +27 -0
- package/dist/vendor/core/foundation/store/with-optional.d.ts +15 -0
- package/dist/vendor/core/foundation/store/with-optional.js +3 -0
- package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
- package/dist/vendor/core/foundation/values/clock.js +21 -0
- package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
- package/dist/vendor/core/foundation/values/compare.js +70 -0
- package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
- package/dist/vendor/core/foundation/values/convert.js +108 -0
- package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
- package/dist/vendor/core/foundation/values/epoch-day.js +43 -0
- package/dist/vendor/core/foundation/values/index.d.ts +14 -0
- package/dist/vendor/core/foundation/values/index.js +10 -0
- package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
- package/dist/vendor/core/foundation/values/iso.js +111 -0
- package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
- package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
- package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
- package/dist/vendor/core/foundation/values/plain-date.js +105 -0
- package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
- package/dist/vendor/core/foundation/values/plain-time.js +43 -0
- package/dist/vendor/core/foundation/values/types.d.ts +37 -0
- package/dist/vendor/core/foundation/values/types.js +1 -0
- package/dist/vendor/core/foundation/values/week.d.ts +9 -0
- package/dist/vendor/core/foundation/values/week.js +31 -0
- package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
- package/dist/vendor/core/foundation/values/year-month.js +19 -0
- package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
- package/dist/vendor/core/foundation/values/zoned.js +152 -0
- package/dist/vendor/core/index.d.ts +5 -0
- package/dist/vendor/core/index.js +5 -0
- package/dist/vendor/core/time/index.d.ts +8 -0
- package/dist/vendor/core/time/index.js +8 -0
- package/dist/vendor/core/time/input/parse.d.ts +19 -0
- package/dist/vendor/core/time/input/parse.js +82 -0
- package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
- package/dist/vendor/core/time/input/time-input-controller.js +547 -0
- package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
- package/dist/vendor/core/time/input/time-range-input-controller.js +178 -0
- package/dist/vendor/core/time/input/validity.d.ts +7 -0
- package/dist/vendor/core/time/input/validity.js +16 -0
- package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
- package/dist/vendor/core/time/panel/time-panel-controller.js +809 -0
- package/dist/vendor/core/time/selection/range.d.ts +25 -0
- package/dist/vendor/core/time/selection/range.js +35 -0
- package/dist/vendor/core/time/selection/slots.d.ts +46 -0
- package/dist/vendor/core/time/selection/slots.js +76 -0
- package/dist/vendor/core/time/types.d.ts +11 -0
- package/dist/vendor/core/time/types.js +1 -0
- package/package.json +83 -4
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { fromInstant, isValidDate, plainDate, plainDateTime, plainTime, toInstant, toZoned, } from "../../foundation/index.js";
|
|
2
|
+
import { rruleError, } from "./rrule-types.js";
|
|
3
|
+
const FREQS = ["DAILY", "WEEKLY", "MONTHLY", "YEARLY"];
|
|
4
|
+
const DAY_CODES = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
|
|
5
|
+
const DAY_NUMBERS = {
|
|
6
|
+
MO: 1,
|
|
7
|
+
TU: 2,
|
|
8
|
+
WE: 3,
|
|
9
|
+
TH: 4,
|
|
10
|
+
FR: 5,
|
|
11
|
+
SA: 6,
|
|
12
|
+
SU: 7,
|
|
13
|
+
};
|
|
14
|
+
const SUPPORTED = new Set([
|
|
15
|
+
"FREQ",
|
|
16
|
+
"INTERVAL",
|
|
17
|
+
"COUNT",
|
|
18
|
+
"UNTIL",
|
|
19
|
+
"BYDAY",
|
|
20
|
+
"BYMONTHDAY",
|
|
21
|
+
"BYMONTH",
|
|
22
|
+
"WKST",
|
|
23
|
+
]);
|
|
24
|
+
const pad = (value, length = 2) => String(value).padStart(length, "0");
|
|
25
|
+
function isFreq(value) {
|
|
26
|
+
return FREQS.includes(value);
|
|
27
|
+
}
|
|
28
|
+
function dayOf(code, part) {
|
|
29
|
+
const day = DAY_NUMBERS[code];
|
|
30
|
+
if (day === undefined) {
|
|
31
|
+
throw rruleError("invalid-value", `Unknown weekday "${code}".`, part);
|
|
32
|
+
}
|
|
33
|
+
return day;
|
|
34
|
+
}
|
|
35
|
+
function isZoned(value) {
|
|
36
|
+
return value.timeZone !== undefined;
|
|
37
|
+
}
|
|
38
|
+
function isDateTime(value) {
|
|
39
|
+
return value.hour !== undefined;
|
|
40
|
+
}
|
|
41
|
+
function parseUntil(value) {
|
|
42
|
+
const match = /^(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})(Z)?)?$/.exec(value);
|
|
43
|
+
if (!match) {
|
|
44
|
+
throw rruleError("invalid-value", `UNTIL "${value}" must be YYYYMMDD, YYYYMMDDTHHMMSS or YYYYMMDDTHHMMSSZ.`, "UNTIL");
|
|
45
|
+
}
|
|
46
|
+
const year = Number(match[1]);
|
|
47
|
+
const month = Number(match[2]);
|
|
48
|
+
const day = Number(match[3]);
|
|
49
|
+
if (!isValidDate(year, month, day)) {
|
|
50
|
+
throw rruleError("invalid-value", `UNTIL "${value}" is not a real date.`, "UNTIL");
|
|
51
|
+
}
|
|
52
|
+
if (match[4] === undefined) {
|
|
53
|
+
return plainDate(year, month, day);
|
|
54
|
+
}
|
|
55
|
+
const hour = Number(match[4]);
|
|
56
|
+
const minute = Number(match[5]);
|
|
57
|
+
const second = Number(match[6]);
|
|
58
|
+
if (hour > 23 || minute > 59 || second > 59) {
|
|
59
|
+
throw rruleError("invalid-value", `UNTIL "${value}" is not a real time.`, "UNTIL");
|
|
60
|
+
}
|
|
61
|
+
const wall = plainDateTime(plainDate(year, month, day), plainTime(hour, minute, second));
|
|
62
|
+
return match[7] === "Z" ? toZoned(wall, "UTC") : wall;
|
|
63
|
+
}
|
|
64
|
+
function parseNumber(value, part) {
|
|
65
|
+
if (!/^[+-]?\d+$/.test(value)) {
|
|
66
|
+
throw rruleError("invalid-value", `${part} must be an integer, got "${value}".`, part);
|
|
67
|
+
}
|
|
68
|
+
return Number(value);
|
|
69
|
+
}
|
|
70
|
+
function parseByDay(value) {
|
|
71
|
+
return value.split(",").map((entry) => {
|
|
72
|
+
const match = /^([+-]?\d{1,2})?(MO|TU|WE|TH|FR|SA|SU)$/.exec(entry);
|
|
73
|
+
if (!match) {
|
|
74
|
+
throw rruleError("invalid-value", `BYDAY entry "${entry}" must be a weekday with an optional ordinal.`, "BYDAY");
|
|
75
|
+
}
|
|
76
|
+
const day = dayOf(match[2], "BYDAY");
|
|
77
|
+
if (match[1] === undefined) {
|
|
78
|
+
return { day };
|
|
79
|
+
}
|
|
80
|
+
const ordinal = Number(match[1]);
|
|
81
|
+
if (ordinal === 0 || Math.abs(ordinal) > 53) {
|
|
82
|
+
throw rruleError("invalid-value", `BYDAY ordinal "${match[1]}" must be between 1 and 53 or -53 and -1.`, "BYDAY");
|
|
83
|
+
}
|
|
84
|
+
return { day, ordinal };
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function parseString(text) {
|
|
88
|
+
const value = text.trim().replace(/^RRULE:/i, "");
|
|
89
|
+
if (value === "") {
|
|
90
|
+
throw rruleError("invalid-value", "An RRULE cannot be empty.", "FREQ");
|
|
91
|
+
}
|
|
92
|
+
const parts = new Map();
|
|
93
|
+
for (const entry of value.split(";")) {
|
|
94
|
+
if (entry === "") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const at = entry.indexOf("=");
|
|
98
|
+
if (at <= 0) {
|
|
99
|
+
throw rruleError("invalid-value", `RRULE part "${entry}" must be KEY=VALUE.`);
|
|
100
|
+
}
|
|
101
|
+
const key = entry.slice(0, at).toUpperCase();
|
|
102
|
+
if (!SUPPORTED.has(key)) {
|
|
103
|
+
throw rruleError("unsupported-part", `${key} is not supported (plan 12 supports FREQ, INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH and WKST).`, key);
|
|
104
|
+
}
|
|
105
|
+
if (parts.has(key)) {
|
|
106
|
+
throw rruleError("conflict", `${key} appears twice.`, key);
|
|
107
|
+
}
|
|
108
|
+
parts.set(key, entry.slice(at + 1));
|
|
109
|
+
}
|
|
110
|
+
const freqText = parts.get("FREQ");
|
|
111
|
+
if (freqText === undefined) {
|
|
112
|
+
throw rruleError("invalid-value", "RRULE needs FREQ.", "FREQ");
|
|
113
|
+
}
|
|
114
|
+
if (!isFreq(freqText)) {
|
|
115
|
+
throw rruleError("unsupported-part", `FREQ=${freqText} is not supported (DAILY, WEEKLY, MONTHLY or YEARLY).`, "FREQ");
|
|
116
|
+
}
|
|
117
|
+
const rule = { freq: freqText };
|
|
118
|
+
const interval = parts.get("INTERVAL");
|
|
119
|
+
if (interval !== undefined) {
|
|
120
|
+
rule.interval = parseNumber(interval, "INTERVAL");
|
|
121
|
+
}
|
|
122
|
+
const count = parts.get("COUNT");
|
|
123
|
+
if (count !== undefined) {
|
|
124
|
+
rule.count = parseNumber(count, "COUNT");
|
|
125
|
+
}
|
|
126
|
+
const until = parts.get("UNTIL");
|
|
127
|
+
if (until !== undefined) {
|
|
128
|
+
rule.until = parseUntil(until);
|
|
129
|
+
}
|
|
130
|
+
const byDay = parts.get("BYDAY");
|
|
131
|
+
if (byDay !== undefined) {
|
|
132
|
+
rule.byDay = parseByDay(byDay);
|
|
133
|
+
}
|
|
134
|
+
const byMonthDay = parts.get("BYMONTHDAY");
|
|
135
|
+
if (byMonthDay !== undefined) {
|
|
136
|
+
rule.byMonthDay = byMonthDay.split(",").map((entry) => parseNumber(entry, "BYMONTHDAY"));
|
|
137
|
+
}
|
|
138
|
+
const byMonth = parts.get("BYMONTH");
|
|
139
|
+
if (byMonth !== undefined) {
|
|
140
|
+
rule.byMonth = byMonth.split(",").map((entry) => parseNumber(entry, "BYMONTH"));
|
|
141
|
+
}
|
|
142
|
+
const wkst = parts.get("WKST");
|
|
143
|
+
if (wkst !== undefined) {
|
|
144
|
+
rule.wkst = dayOf(wkst, "WKST");
|
|
145
|
+
}
|
|
146
|
+
return parseRRule(rule);
|
|
147
|
+
}
|
|
148
|
+
function validate(rule) {
|
|
149
|
+
if (!isFreq(rule.freq)) {
|
|
150
|
+
throw rruleError("unsupported-part", `FREQ=${String(rule.freq)} is not supported.`, "FREQ");
|
|
151
|
+
}
|
|
152
|
+
if (rule.interval !== undefined && (!Number.isInteger(rule.interval) || rule.interval < 1)) {
|
|
153
|
+
throw rruleError("invalid-value", "INTERVAL must be a positive integer.", "INTERVAL");
|
|
154
|
+
}
|
|
155
|
+
if (rule.count !== undefined) {
|
|
156
|
+
if (!Number.isInteger(rule.count) || rule.count < 1) {
|
|
157
|
+
throw rruleError("invalid-value", "COUNT must be a positive integer.", "COUNT");
|
|
158
|
+
}
|
|
159
|
+
if (rule.until !== undefined) {
|
|
160
|
+
throw rruleError("conflict", "COUNT and UNTIL cannot appear together.", "COUNT");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (rule.until !== undefined) {
|
|
164
|
+
const until = rule.until;
|
|
165
|
+
if (!Number.isInteger(until.year) || until.month === undefined) {
|
|
166
|
+
throw rruleError("invalid-value", "UNTIL must be a date, a date-time or a UTC date-time.", "UNTIL");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (rule.byMonth !== undefined) {
|
|
170
|
+
if (rule.byMonth.length === 0) {
|
|
171
|
+
throw rruleError("invalid-value", "BYMONTH cannot be empty.", "BYMONTH");
|
|
172
|
+
}
|
|
173
|
+
for (const month of rule.byMonth) {
|
|
174
|
+
if (!Number.isInteger(month) || month < 1 || month > 12) {
|
|
175
|
+
throw rruleError("invalid-value", "BYMONTH values must be 1–12.", "BYMONTH");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (rule.byMonthDay !== undefined) {
|
|
180
|
+
if (rule.byMonthDay.length === 0) {
|
|
181
|
+
throw rruleError("invalid-value", "BYMONTHDAY cannot be empty.", "BYMONTHDAY");
|
|
182
|
+
}
|
|
183
|
+
for (const day of rule.byMonthDay) {
|
|
184
|
+
if (!Number.isInteger(day) || day === 0 || Math.abs(day) > 31) {
|
|
185
|
+
throw rruleError("invalid-value", "BYMONTHDAY values must be -31…-1 or 1…31.", "BYMONTHDAY");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (rule.byDay !== undefined) {
|
|
190
|
+
if (rule.byDay.length === 0) {
|
|
191
|
+
throw rruleError("invalid-value", "BYDAY cannot be empty.", "BYDAY");
|
|
192
|
+
}
|
|
193
|
+
for (const entry of rule.byDay) {
|
|
194
|
+
if (!Number.isInteger(entry.day) ||
|
|
195
|
+
entry.day < 1 ||
|
|
196
|
+
entry.day > 7 ||
|
|
197
|
+
(entry.ordinal !== undefined &&
|
|
198
|
+
(!Number.isInteger(entry.ordinal) || entry.ordinal === 0 || Math.abs(entry.ordinal) > 53))) {
|
|
199
|
+
throw rruleError("invalid-value", "Invalid BYDAY entry.", "BYDAY");
|
|
200
|
+
}
|
|
201
|
+
if (entry.ordinal === undefined) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (rule.freq !== "MONTHLY" && rule.freq !== "YEARLY") {
|
|
205
|
+
throw rruleError("invalid-value", "A BYDAY ordinal is only valid with MONTHLY or YEARLY.", "BYDAY");
|
|
206
|
+
}
|
|
207
|
+
if (rule.freq === "YEARLY" && rule.byMonth === undefined) {
|
|
208
|
+
throw rruleError("unsupported-part", "A YEARLY BYDAY ordinal needs BYMONTH (plan 12 subset).", "BYDAY");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (rule.wkst !== undefined && (!Number.isInteger(rule.wkst) || rule.wkst < 1 || rule.wkst > 7)) {
|
|
213
|
+
throw rruleError("invalid-value", "WKST must be a weekday.", "WKST");
|
|
214
|
+
}
|
|
215
|
+
const copy = { freq: rule.freq };
|
|
216
|
+
if (rule.interval !== undefined)
|
|
217
|
+
copy.interval = rule.interval;
|
|
218
|
+
if (rule.count !== undefined)
|
|
219
|
+
copy.count = rule.count;
|
|
220
|
+
if (rule.until !== undefined)
|
|
221
|
+
copy.until = rule.until;
|
|
222
|
+
if (rule.byDay !== undefined) {
|
|
223
|
+
copy.byDay = rule.byDay.map((entry) => ({ ...entry }));
|
|
224
|
+
}
|
|
225
|
+
if (rule.byMonthDay !== undefined)
|
|
226
|
+
copy.byMonthDay = [...rule.byMonthDay];
|
|
227
|
+
if (rule.byMonth !== undefined)
|
|
228
|
+
copy.byMonth = [...rule.byMonth];
|
|
229
|
+
if (rule.wkst !== undefined)
|
|
230
|
+
copy.wkst = rule.wkst;
|
|
231
|
+
return copy;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Parse an RFC 5545 `RRULE` value (with or without the `RRULE:` prefix) or
|
|
235
|
+
* validate a rule object. Unsupported parts throw an {@link RRuleError}.
|
|
236
|
+
*/
|
|
237
|
+
export function parseRRule(input) {
|
|
238
|
+
return typeof input === "string" ? parseString(input) : validate(input);
|
|
239
|
+
}
|
|
240
|
+
function untilText(until) {
|
|
241
|
+
const date = `${pad(until.year, 4)}${pad(until.month)}${pad(until.day)}`;
|
|
242
|
+
if (!isDateTime(until)) {
|
|
243
|
+
return date;
|
|
244
|
+
}
|
|
245
|
+
const wall = isZoned(until) ? fromInstant(toInstant(until), "UTC") : until;
|
|
246
|
+
const time = `${pad(wall.hour)}${pad(wall.minute)}${pad(wall.second)}`;
|
|
247
|
+
return `${date}T${time}${isZoned(until) ? "Z" : ""}`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Serialize a rule in the fixed part order `FREQ, INTERVAL, COUNT, UNTIL,
|
|
251
|
+
* BYMONTH, BYMONTHDAY, BYDAY, WKST`; `parseRRule(stringifyRRule(rule))` equals
|
|
252
|
+
* `rule`.
|
|
253
|
+
*/
|
|
254
|
+
export function stringifyRRule(rule) {
|
|
255
|
+
const valid = parseRRule(rule);
|
|
256
|
+
const parts = [`FREQ=${valid.freq}`];
|
|
257
|
+
if (valid.interval !== undefined)
|
|
258
|
+
parts.push(`INTERVAL=${valid.interval}`);
|
|
259
|
+
if (valid.count !== undefined)
|
|
260
|
+
parts.push(`COUNT=${valid.count}`);
|
|
261
|
+
if (valid.until !== undefined)
|
|
262
|
+
parts.push(`UNTIL=${untilText(valid.until)}`);
|
|
263
|
+
if (valid.byMonth !== undefined) {
|
|
264
|
+
parts.push(`BYMONTH=${valid.byMonth.join(",")}`);
|
|
265
|
+
}
|
|
266
|
+
if (valid.byMonthDay !== undefined) {
|
|
267
|
+
parts.push(`BYMONTHDAY=${valid.byMonthDay.join(",")}`);
|
|
268
|
+
}
|
|
269
|
+
if (valid.byDay !== undefined) {
|
|
270
|
+
parts.push(`BYDAY=${valid.byDay
|
|
271
|
+
.map((entry) => `${entry.ordinal === undefined ? "" : entry.ordinal}${DAY_CODES[(entry.day - 1)]}`)
|
|
272
|
+
.join(",")}`);
|
|
273
|
+
}
|
|
274
|
+
if (valid.wkst !== undefined) {
|
|
275
|
+
parts.push(`WKST=${DAY_CODES[(valid.wkst - 1)]}`);
|
|
276
|
+
}
|
|
277
|
+
return parts.join(";");
|
|
278
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type DateRange, type DateTimeInput, type DateInput, type PlainDateTime } from "../../foundation/index.js";
|
|
2
|
+
import type { CalendarEventInput, EventId } from "../events/types.js";
|
|
3
|
+
import type { RRuleError, RecurrenceInfo, RecurrenceOccurrence } from "./types.js";
|
|
4
|
+
export type ExpandRecurrenceOptions = {
|
|
5
|
+
/** Display zone. Defaults to `"UTC"`, never the host zone. */
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
onError?: (error: RRuleError) => void;
|
|
8
|
+
};
|
|
9
|
+
/** A value as wall time in the display zone (all-day: midnight of the date). */
|
|
10
|
+
export declare function recurrenceWall(value: DateTimeInput | DateInput, allDay: boolean, timeZone: string): PlainDateTime;
|
|
11
|
+
export declare function isZonedStart(value: DateTimeInput | DateInput): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Expand one series into the occurrences overlapping `range` (plan 12 RR4–RR5).
|
|
14
|
+
* The series' `start` is DTSTART and its `start`/`end` distance is the duration.
|
|
15
|
+
* EXDATE removes generated occurrences after COUNT; RDATE adds occurrences that
|
|
16
|
+
* are not subject to COUNT or UNTIL.
|
|
17
|
+
*/
|
|
18
|
+
export declare function expandRecurrence<T extends CalendarEventInput>(series: T, range: DateRange, options?: ExpandRecurrenceOptions): RecurrenceOccurrence<T>[];
|
|
19
|
+
/** The `(series id, original occurrence start)` an override replaces (RR6). */
|
|
20
|
+
export declare function overrideOf<T extends CalendarEventInput>(event: T, timeZone: string): {
|
|
21
|
+
recurringId: EventId;
|
|
22
|
+
occurrenceStart: PlainDateTime;
|
|
23
|
+
} | null;
|
|
24
|
+
/** The recurrence data for an override piece (RR6/RR7). */
|
|
25
|
+
export declare function overrideInfo<T extends CalendarEventInput>(series: T, occurrenceStart: PlainDateTime): RecurrenceInfo<T>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { compare, fromDate, fromEpochDay, fromSecondOfDay, parseIsoDate, plainDate, plainDateTime, toEpochDay, toIsoString, toPlainDate, toPlainDateTime, toSecondOfDay, } from "../../foundation/index.js";
|
|
2
|
+
import { normalizeEventInput } from "../events/normalize.js";
|
|
3
|
+
import { expandRule } from "./expand.js";
|
|
4
|
+
import { parseRRule } from "./rrule.js";
|
|
5
|
+
const SECONDS_PER_DAY = 86400;
|
|
6
|
+
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
const MIDNIGHT = { hour: 0, minute: 0, second: 0 };
|
|
8
|
+
const wallSeconds = (value) => toEpochDay(value) * SECONDS_PER_DAY + toSecondOfDay(value);
|
|
9
|
+
const fromWallSeconds = (seconds) => {
|
|
10
|
+
const day = Math.floor(seconds / SECONDS_PER_DAY);
|
|
11
|
+
return plainDateTime(fromEpochDay(day), fromSecondOfDay(seconds - day * SECONDS_PER_DAY));
|
|
12
|
+
};
|
|
13
|
+
/** A value as wall time in the display zone (all-day: midnight of the date). */
|
|
14
|
+
export function recurrenceWall(value, allDay, timeZone) {
|
|
15
|
+
if (typeof value === "string" && DATE_ONLY.test(value)) {
|
|
16
|
+
return plainDateTime(parseIsoDate(value), MIDNIGHT);
|
|
17
|
+
}
|
|
18
|
+
if (typeof value.getTime === "function") {
|
|
19
|
+
const zoned = fromDate(value, timeZone);
|
|
20
|
+
const date = plainDate(zoned.year, zoned.month, zoned.day);
|
|
21
|
+
return allDay
|
|
22
|
+
? plainDateTime(date, MIDNIGHT)
|
|
23
|
+
: plainDateTime(date, {
|
|
24
|
+
hour: zoned.hour,
|
|
25
|
+
minute: zoned.minute,
|
|
26
|
+
second: zoned.second,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (allDay) {
|
|
30
|
+
return plainDateTime(toPlainDate(value, timeZone), MIDNIGHT);
|
|
31
|
+
}
|
|
32
|
+
return toPlainDateTime(value, timeZone);
|
|
33
|
+
}
|
|
34
|
+
export function isZonedStart(value) {
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
return /(?:Z|[+-]\d{2}:?\d{2})(?:\[[^\]]+\])?$/.test(value);
|
|
37
|
+
}
|
|
38
|
+
return typeof value === "object" && value !== null && "timeZone" in value;
|
|
39
|
+
}
|
|
40
|
+
function overlaps(start, end, range) {
|
|
41
|
+
const from = plainDateTime(range.start, MIDNIGHT);
|
|
42
|
+
const last = plainDateTime(range.end, {
|
|
43
|
+
hour: 23,
|
|
44
|
+
minute: 59,
|
|
45
|
+
second: 59,
|
|
46
|
+
});
|
|
47
|
+
if (compare(start, end) === 0) {
|
|
48
|
+
return compare(start, from) >= 0 && compare(start, last) <= 0;
|
|
49
|
+
}
|
|
50
|
+
return compare(start, last) <= 0 && compare(end, from) > 0;
|
|
51
|
+
}
|
|
52
|
+
function singleOccurrence(series, start, end, allDay) {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
event: series,
|
|
56
|
+
start,
|
|
57
|
+
end,
|
|
58
|
+
allDay,
|
|
59
|
+
key: `${String(series.id)}:${toIsoString(start)}`,
|
|
60
|
+
recurrence: {
|
|
61
|
+
recurringId: series.id,
|
|
62
|
+
occurrenceStart: start,
|
|
63
|
+
isOverride: false,
|
|
64
|
+
series,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Expand one series into the occurrences overlapping `range` (plan 12 RR4–RR5).
|
|
71
|
+
* The series' `start` is DTSTART and its `start`/`end` distance is the duration.
|
|
72
|
+
* EXDATE removes generated occurrences after COUNT; RDATE adds occurrences that
|
|
73
|
+
* are not subject to COUNT or UNTIL.
|
|
74
|
+
*/
|
|
75
|
+
export function expandRecurrence(series, range, options = {}) {
|
|
76
|
+
if (series.rrule === undefined) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const timeZone = options.timeZone ?? "UTC";
|
|
80
|
+
const parsed = normalizeEventInput(series, timeZone);
|
|
81
|
+
const allDay = parsed.allDay;
|
|
82
|
+
const zoned = isZonedStart(series.start);
|
|
83
|
+
const durationSeconds = allDay
|
|
84
|
+
? 0
|
|
85
|
+
: Math.max(0, wallSeconds(parsed.end) - wallSeconds(parsed.start));
|
|
86
|
+
const durationDays = allDay ? Math.max(1, toEpochDay(parsed.end) - toEpochDay(parsed.start)) : 0;
|
|
87
|
+
let rule;
|
|
88
|
+
try {
|
|
89
|
+
rule = parseRRule(series.rrule);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
options.onError?.(error);
|
|
93
|
+
return overlaps(parsed.start, parsed.end, range)
|
|
94
|
+
? singleOccurrence(series, parsed.start, parsed.end, allDay)
|
|
95
|
+
: [];
|
|
96
|
+
}
|
|
97
|
+
const exdates = new Set((series.exdates ?? []).map((value) => toIsoString(recurrenceWall(value, allDay, timeZone))));
|
|
98
|
+
const generated = expandRule(rule, {
|
|
99
|
+
start: parsed.start,
|
|
100
|
+
allDay,
|
|
101
|
+
timeZone,
|
|
102
|
+
zoned,
|
|
103
|
+
durationSeconds,
|
|
104
|
+
durationDays,
|
|
105
|
+
range,
|
|
106
|
+
onError: options.onError,
|
|
107
|
+
});
|
|
108
|
+
const occurrences = new Map();
|
|
109
|
+
const startKey = (value) => toIsoString(value);
|
|
110
|
+
const push = (start, end) => {
|
|
111
|
+
const key = startKey(start);
|
|
112
|
+
if (occurrences.has(key) || exdates.has(key)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
occurrences.set(key, {
|
|
116
|
+
event: series,
|
|
117
|
+
start,
|
|
118
|
+
end,
|
|
119
|
+
allDay,
|
|
120
|
+
key: `${String(series.id)}:${key}`,
|
|
121
|
+
recurrence: {
|
|
122
|
+
recurringId: series.id,
|
|
123
|
+
occurrenceStart: start,
|
|
124
|
+
isOverride: false,
|
|
125
|
+
series,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
for (const occurrence of generated) {
|
|
130
|
+
push(occurrence.start, occurrence.end);
|
|
131
|
+
}
|
|
132
|
+
for (const value of series.rdates ?? []) {
|
|
133
|
+
const start = recurrenceWall(value, allDay, timeZone);
|
|
134
|
+
const end = allDay
|
|
135
|
+
? plainDateTime(fromEpochDay(toEpochDay(start) + durationDays), MIDNIGHT)
|
|
136
|
+
: fromWallSeconds(wallSeconds(start) + durationSeconds);
|
|
137
|
+
if (overlaps(start, end, range)) {
|
|
138
|
+
push(start, end);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return [...occurrences.values()].sort((a, b) => compare(a.start, b.start));
|
|
142
|
+
}
|
|
143
|
+
/** The `(series id, original occurrence start)` an override replaces (RR6). */
|
|
144
|
+
export function overrideOf(event, timeZone) {
|
|
145
|
+
const input = event;
|
|
146
|
+
if (input.recurringId === undefined || input.recurrenceId === undefined) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
const parsed = normalizeEventInput(event, timeZone);
|
|
150
|
+
return {
|
|
151
|
+
recurringId: input.recurringId,
|
|
152
|
+
occurrenceStart: recurrenceWall(input.recurrenceId, parsed.allDay, timeZone),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** The recurrence data for an override piece (RR6/RR7). */
|
|
156
|
+
export function overrideInfo(series, occurrenceStart) {
|
|
157
|
+
return {
|
|
158
|
+
recurringId: series.id,
|
|
159
|
+
occurrenceStart,
|
|
160
|
+
isOverride: true,
|
|
161
|
+
series,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DateRange, PlainDateTime } from "../../foundation/index.js";
|
|
2
|
+
import type { CalendarEventInput, RecurrenceInfo } from "../events/types.js";
|
|
3
|
+
import type { RRuleError } from "./rrule-types.js";
|
|
4
|
+
export type { RRule, RRuleByDay, RRuleError, RRuleErrorCode, RRuleFreq, RRuleUntil, } from "./rrule-types.js";
|
|
5
|
+
export { rruleError } from "./rrule-types.js";
|
|
6
|
+
export type { RecurrenceInfo } from "../events/types.js";
|
|
7
|
+
/** One expanded occurrence, before layout. */
|
|
8
|
+
export type RecurrenceOccurrence<TEvent extends CalendarEventInput> = {
|
|
9
|
+
event: TEvent;
|
|
10
|
+
start: PlainDateTime;
|
|
11
|
+
end: PlainDateTime;
|
|
12
|
+
allDay: boolean;
|
|
13
|
+
key: string;
|
|
14
|
+
recurrence?: RecurrenceInfo<TEvent>;
|
|
15
|
+
};
|
|
16
|
+
export type RecurrenceErrorHandler = (event: CalendarEventInput, error: RRuleError) => void;
|
|
17
|
+
export type RecurrenceExpandOptions = {
|
|
18
|
+
visibleRange: DateRange;
|
|
19
|
+
/** Display zone; the expansion keeps DTSTART's wall time in this zone. */
|
|
20
|
+
timeZone: string;
|
|
21
|
+
/** Called once per series object and error code (plan 12 R5). */
|
|
22
|
+
onRecurrenceError?: RecurrenceErrorHandler | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The opt-in recurrence pack (plan 12 RR2). A plain value: importing
|
|
26
|
+
* `recurrence` is what loads the engine.
|
|
27
|
+
*/
|
|
28
|
+
export type RecurrencePack = {
|
|
29
|
+
expand<TEvent extends CalendarEventInput>(events: readonly TEvent[], options: RecurrenceExpandOptions): RecurrenceOccurrence<TEvent>[];
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { rruleError } from "./rrule-types.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CalendarEventInput } from "../events/types.js";
|
|
2
|
+
import type { ResourceBuildContext, ResourceInput, ResourceTimeGridLayout } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The resource time grid (plan 10 R5): columns are visible days × leaf
|
|
5
|
+
* resources, each laid out independently with the stage-3 algorithm.
|
|
6
|
+
*/
|
|
7
|
+
export declare function layoutResourceTimeGrid<TEvent extends CalendarEventInput, TResource extends ResourceInput>(ctx: ResourceBuildContext<TEvent, TResource>): ResourceTimeGridLayout<TEvent, TResource>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { layoutAllDayRow } from "../events/all-day-row.js";
|
|
2
|
+
import { layoutTimeGridEvents } from "../events/time-grid-layout.js";
|
|
3
|
+
import { buildResourceTree } from "./tree.js";
|
|
4
|
+
import { clampWindow, windowInfo } from "./windowing.js";
|
|
5
|
+
const encode = (key) => encodeURIComponent(key);
|
|
6
|
+
/**
|
|
7
|
+
* The resource time grid (plan 10 R5): columns are visible days × leaf
|
|
8
|
+
* resources, each laid out independently with the stage-3 algorithm.
|
|
9
|
+
*/
|
|
10
|
+
export function layoutResourceTimeGrid(ctx) {
|
|
11
|
+
const { rows } = buildResourceTree(ctx.resources, ctx.collapsed, ctx.getLabel);
|
|
12
|
+
const leafRows = rows.filter((row) => !row.group);
|
|
13
|
+
const days = ctx.days;
|
|
14
|
+
const dayCount = days.length;
|
|
15
|
+
const totalColumns = leafRows.length * dayCount;
|
|
16
|
+
const slots = [];
|
|
17
|
+
if (ctx.grouping === "date-first") {
|
|
18
|
+
for (const day of days) {
|
|
19
|
+
for (const row of leafRows)
|
|
20
|
+
slots.push({ row, day });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (const row of leafRows) {
|
|
25
|
+
for (const day of days)
|
|
26
|
+
slots.push({ row, day });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const window = clampWindow(totalColumns, ctx.resourceWindow);
|
|
30
|
+
const visibleSlots = slots.slice(window.start, window.end);
|
|
31
|
+
const columns = visibleSlots.map((slot, i) => ({
|
|
32
|
+
key: `${slot.row.key}@${slot.day.key}`,
|
|
33
|
+
resourceKey: slot.row.key,
|
|
34
|
+
resourceId: slot.row.id,
|
|
35
|
+
resource: slot.row.resource,
|
|
36
|
+
label: slot.row.label,
|
|
37
|
+
day: slot.day,
|
|
38
|
+
index: window.start + i,
|
|
39
|
+
}));
|
|
40
|
+
const groups = [];
|
|
41
|
+
if (ctx.grouping === "resource-first") {
|
|
42
|
+
for (const row of rows) {
|
|
43
|
+
if (!row.group || !row.expanded)
|
|
44
|
+
continue;
|
|
45
|
+
const under = leafRows.filter((leaf) => isDescendant(row, leaf, rows));
|
|
46
|
+
if (under.length === 0)
|
|
47
|
+
continue;
|
|
48
|
+
const first = leafRows.indexOf(under[0]);
|
|
49
|
+
groups.push({
|
|
50
|
+
key: `group:${row.key}`,
|
|
51
|
+
resourceKey: row.key,
|
|
52
|
+
resource: row.resource,
|
|
53
|
+
label: row.label,
|
|
54
|
+
level: row.level,
|
|
55
|
+
startColumn: first * dayCount,
|
|
56
|
+
colSpan: under.length * dayCount,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const byResource = new Map();
|
|
61
|
+
for (const event of ctx.events) {
|
|
62
|
+
for (const id of event.resourceIds ?? []) {
|
|
63
|
+
const key = String(id);
|
|
64
|
+
const list = byResource.get(key) ?? [];
|
|
65
|
+
list.push(event);
|
|
66
|
+
byResource.set(key, list);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const pieces = [];
|
|
70
|
+
const allDay = [];
|
|
71
|
+
for (const column of columns) {
|
|
72
|
+
const events = byResource.get(column.resourceKey) ?? [];
|
|
73
|
+
if (events.length === 0)
|
|
74
|
+
continue;
|
|
75
|
+
const one = [column.day];
|
|
76
|
+
const options = {
|
|
77
|
+
dayStart: ctx.dayStart,
|
|
78
|
+
dayEnd: ctx.dayEnd,
|
|
79
|
+
minEventDuration: ctx.minEventDuration,
|
|
80
|
+
longEventsInAllDayRow: ctx.longEventsInAllDayRow,
|
|
81
|
+
now: ctx.now,
|
|
82
|
+
};
|
|
83
|
+
for (const segment of layoutTimeGridEvents(events, one, options)) {
|
|
84
|
+
pieces.push({
|
|
85
|
+
...segment,
|
|
86
|
+
key: `${segment.key}@${encode(column.resourceKey)}`,
|
|
87
|
+
resourceKey: column.resourceKey,
|
|
88
|
+
resourceId: column.resourceId,
|
|
89
|
+
columnKey: column.key,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const row = layoutAllDayRow(events, one, {
|
|
93
|
+
longEventsInAllDayRow: ctx.longEventsInAllDayRow,
|
|
94
|
+
now: ctx.now,
|
|
95
|
+
});
|
|
96
|
+
for (const segment of row.segments) {
|
|
97
|
+
allDay.push({
|
|
98
|
+
...segment,
|
|
99
|
+
key: `${segment.key}@${encode(column.resourceKey)}`,
|
|
100
|
+
resourceKey: column.resourceKey,
|
|
101
|
+
resourceId: column.resourceId,
|
|
102
|
+
columnKey: column.key,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const rowStart = leafRows.length
|
|
107
|
+
? Math.floor(window.start / Math.max(1, ctx.grouping === "date-first" ? leafRows.length : dayCount))
|
|
108
|
+
: 0;
|
|
109
|
+
return {
|
|
110
|
+
kind: "resource-time-grid",
|
|
111
|
+
grouping: ctx.grouping,
|
|
112
|
+
rows: leafRows,
|
|
113
|
+
columns,
|
|
114
|
+
groups,
|
|
115
|
+
pieces,
|
|
116
|
+
allDay,
|
|
117
|
+
window: windowInfo(leafRows.length, totalColumns, { start: rowStart }, { start: window.start }),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function isDescendant(ancestor, node, rows) {
|
|
121
|
+
const byKey = new Map(rows.map((row) => [row.key, row]));
|
|
122
|
+
let current = node.parentKey;
|
|
123
|
+
while (current !== null) {
|
|
124
|
+
if (current === ancestor.key)
|
|
125
|
+
return true;
|
|
126
|
+
current = byKey.get(current)?.parentKey ?? null;
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PlainDate, type PlainDateTime } from "../../foundation/index.js";
|
|
2
|
+
import type { TimelineAxis, TimelineSlotDuration, TimelineUnit } from "./types.js";
|
|
3
|
+
/** `YYYY-MM-DDTHH:mm` of a wall-time value (the slot key base, plan 10 IG4). */
|
|
4
|
+
export declare const slotKeyOf: (value: PlainDateTime) => string;
|
|
5
|
+
export declare function slotSeconds(duration: TimelineSlotDuration): number;
|
|
6
|
+
/**
|
|
7
|
+
* The timeline axis (plan 10 R6): wall-time slots over `days`, and header rows
|
|
8
|
+
* (coarser unit first) whose cells span the slots inside them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildTimelineAxis(first: PlainDate, dayCount: number, duration: TimelineSlotDuration, headerRows: readonly TimelineUnit[], locale: string | undefined): TimelineAxis;
|