@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,27 @@
|
|
|
1
|
+
import { type DateRange, type PlainDateTime } from "../../foundation/index.js";
|
|
2
|
+
import type { RRule, RRuleError } from "./types.js";
|
|
3
|
+
export type RuleOccurrence = {
|
|
4
|
+
start: PlainDateTime;
|
|
5
|
+
end: PlainDateTime;
|
|
6
|
+
allDay: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type ExpandRuleOptions = {
|
|
9
|
+
/** DTSTART wall time in the display zone. */
|
|
10
|
+
start: PlainDateTime;
|
|
11
|
+
allDay: boolean;
|
|
12
|
+
timeZone: string;
|
|
13
|
+
/** The series is zoned (wall time follows the zone, DST gaps use "compatible"). */
|
|
14
|
+
zoned: boolean;
|
|
15
|
+
/** Timed series: wall-time duration in seconds. */
|
|
16
|
+
durationSeconds: number;
|
|
17
|
+
/** All-day series: length in days (end is exclusive). */
|
|
18
|
+
durationDays: number;
|
|
19
|
+
range: DateRange;
|
|
20
|
+
onError?: ((error: RRuleError) => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Expand a parsed rule inside `range` (plan 12 RR4/RR5). DTSTART is always the
|
|
24
|
+
* first occurrence and counts toward COUNT. Occurrences keep DTSTART's wall
|
|
25
|
+
* time; zoned series resolve it through `toZoned(..., "compatible")`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function expandRule(rule: RRule, options: ExpandRuleOptions): RuleOccurrence[];
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { addDays, compare, dayOfWeek, daysInMonth, fromEpochDay, fromSecondOfDay, plainDate, plainDateTime, startOfWeek, toEpochDay, toInstant, toSecondOfDay, toZoned, } from "../../foundation/index.js";
|
|
2
|
+
import { rruleError } from "./types.js";
|
|
3
|
+
const SECONDS_PER_DAY = 86400;
|
|
4
|
+
const DEFAULT_WKST = 1;
|
|
5
|
+
/** Iterations (periods), not produced occurrences (plan 12 §13.5). */
|
|
6
|
+
const ITERATION_CAP = 10_000;
|
|
7
|
+
const wallSeconds = (value) => toEpochDay(value) * SECONDS_PER_DAY + toSecondOfDay(value);
|
|
8
|
+
const fromWallSeconds = (seconds) => {
|
|
9
|
+
const day = Math.floor(seconds / SECONDS_PER_DAY);
|
|
10
|
+
const rest = seconds - day * SECONDS_PER_DAY;
|
|
11
|
+
return plainDateTime(fromEpochDay(day), fromSecondOfDay(rest));
|
|
12
|
+
};
|
|
13
|
+
const datePart = (value) => plainDate(value.year, value.month, value.day);
|
|
14
|
+
const datePartOf = (value) => plainDate(value.year, value.month, value.day);
|
|
15
|
+
const timePart = (value) => plainDateTime(plainDate(1970, 1, 1), {
|
|
16
|
+
hour: value.hour,
|
|
17
|
+
minute: value.minute,
|
|
18
|
+
second: value.second,
|
|
19
|
+
});
|
|
20
|
+
/** `2TU` / `-1FR` inside a month. */
|
|
21
|
+
function nthWeekday(year, month, day, ordinal) {
|
|
22
|
+
const limit = daysInMonth(year, month);
|
|
23
|
+
if (ordinal > 0) {
|
|
24
|
+
const offset = (day - dayOfWeek(plainDate(year, month, 1)) + 7) % 7;
|
|
25
|
+
const result = 1 + offset + (ordinal - 1) * 7;
|
|
26
|
+
return result <= limit ? result : null;
|
|
27
|
+
}
|
|
28
|
+
const offset = (dayOfWeek(plainDate(year, month, limit)) - day + 7) % 7;
|
|
29
|
+
const result = limit - offset + (ordinal + 1) * 7;
|
|
30
|
+
return result >= 1 ? result : null;
|
|
31
|
+
}
|
|
32
|
+
function dayMatchesByDay(year, month, day, entry) {
|
|
33
|
+
if (dayOfWeek(plainDate(year, month, day)) !== entry.day) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (entry.ordinal === undefined) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (entry.ordinal > 0) {
|
|
40
|
+
const first = nthWeekday(year, month, entry.day, 1);
|
|
41
|
+
return first !== null && Math.floor((day - first) / 7) + 1 === entry.ordinal;
|
|
42
|
+
}
|
|
43
|
+
const last = nthWeekday(year, month, entry.day, -1);
|
|
44
|
+
return last !== null && -Math.floor((last - day) / 7) - 1 === entry.ordinal;
|
|
45
|
+
}
|
|
46
|
+
/** Days of one month selected by BYMONTHDAY / BYDAY, or DTSTART's day. */
|
|
47
|
+
function daysInMonthFor(year, month, defaultDay, rule) {
|
|
48
|
+
const limit = daysInMonth(year, month);
|
|
49
|
+
const result = new Set();
|
|
50
|
+
const byDay = rule.byDay;
|
|
51
|
+
if (rule.byMonthDay !== undefined) {
|
|
52
|
+
for (const entry of rule.byMonthDay) {
|
|
53
|
+
const day = entry > 0 ? entry : limit + 1 + entry;
|
|
54
|
+
if (day >= 1 &&
|
|
55
|
+
day <= limit &&
|
|
56
|
+
(!byDay || byDay.some((item) => dayMatchesByDay(year, month, day, item)))) {
|
|
57
|
+
result.add(day);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return [...result].sort((a, b) => a - b);
|
|
61
|
+
}
|
|
62
|
+
if (byDay !== undefined) {
|
|
63
|
+
for (const entry of byDay) {
|
|
64
|
+
if (entry.ordinal === undefined) {
|
|
65
|
+
for (let day = 1; day <= limit; day += 1) {
|
|
66
|
+
if (dayOfWeek(plainDate(year, month, day)) === entry.day) {
|
|
67
|
+
result.add(day);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const day = nthWeekday(year, month, entry.day, entry.ordinal);
|
|
73
|
+
if (day !== null) {
|
|
74
|
+
result.add(day);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [...result].sort((a, b) => a - b);
|
|
79
|
+
}
|
|
80
|
+
if (defaultDay <= limit) {
|
|
81
|
+
result.add(defaultDay);
|
|
82
|
+
}
|
|
83
|
+
return [...result];
|
|
84
|
+
}
|
|
85
|
+
function matchesMonthFilters(date, rule) {
|
|
86
|
+
if (rule.byMonth !== undefined && !rule.byMonth.includes(date.month)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (rule.byMonthDay !== undefined) {
|
|
90
|
+
const limit = daysInMonth(date.year, date.month);
|
|
91
|
+
const days = rule.byMonthDay.map((entry) => (entry > 0 ? entry : limit + 1 + entry));
|
|
92
|
+
if (!days.includes(date.day)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (rule.byDay !== undefined) {
|
|
97
|
+
const weekday = dayOfWeek(date);
|
|
98
|
+
if (!rule.byDay.some((entry) => entry.day === weekday)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
function periodOf(rule, startDate, index) {
|
|
105
|
+
const interval = rule.interval ?? 1;
|
|
106
|
+
if (rule.freq === "DAILY") {
|
|
107
|
+
const date = addDays(startDate, index * interval);
|
|
108
|
+
return {
|
|
109
|
+
anchor: date,
|
|
110
|
+
dates: matchesMonthFilters(date, rule) ? [date] : [],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (rule.freq === "WEEKLY") {
|
|
114
|
+
const wkst = rule.wkst ?? DEFAULT_WKST;
|
|
115
|
+
const weekStart = startOfWeek(startDate, wkst);
|
|
116
|
+
const anchor = addDays(weekStart, index * interval * 7);
|
|
117
|
+
const days = rule.byDay === undefined ? [dayOfWeek(startDate)] : rule.byDay.map((entry) => entry.day);
|
|
118
|
+
const dates = [];
|
|
119
|
+
for (const day of days) {
|
|
120
|
+
const date = addDays(anchor, (day - wkst + 7) % 7);
|
|
121
|
+
if (compare(date, startDate) < 0) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (rule.byMonth !== undefined && !rule.byMonth.includes(date.month)) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (rule.byMonthDay !== undefined) {
|
|
128
|
+
const limit = daysInMonth(date.year, date.month);
|
|
129
|
+
const wanted = rule.byMonthDay.map((entry) => (entry > 0 ? entry : limit + 1 + entry));
|
|
130
|
+
if (!wanted.includes(date.day)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
dates.push(date);
|
|
135
|
+
}
|
|
136
|
+
dates.sort((a, b) => compare(a, b));
|
|
137
|
+
return { anchor, dates };
|
|
138
|
+
}
|
|
139
|
+
if (rule.freq === "MONTHLY") {
|
|
140
|
+
const index0 = startDate.year * 12 + (startDate.month - 1) + index * interval;
|
|
141
|
+
const year = Math.floor(index0 / 12);
|
|
142
|
+
const month = index0 - year * 12 + 1;
|
|
143
|
+
const anchor = plainDate(year, month, 1);
|
|
144
|
+
if (rule.byMonth !== undefined && !rule.byMonth.includes(month)) {
|
|
145
|
+
return { anchor, dates: [] };
|
|
146
|
+
}
|
|
147
|
+
const dates = daysInMonthFor(year, month, startDate.day, rule).map((day) => plainDate(year, month, day));
|
|
148
|
+
return { anchor, dates };
|
|
149
|
+
}
|
|
150
|
+
const year = startDate.year + index * interval;
|
|
151
|
+
const months = rule.byMonth ?? [startDate.month];
|
|
152
|
+
const dates = [];
|
|
153
|
+
for (const month of months) {
|
|
154
|
+
for (const day of daysInMonthFor(year, month, startDate.day, rule)) {
|
|
155
|
+
dates.push(plainDate(year, month, day));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
dates.sort((a, b) => compare(a, b));
|
|
159
|
+
return { anchor: plainDate(year, 1, 1), dates };
|
|
160
|
+
}
|
|
161
|
+
function pastUntil(candidate, rule, timeZone, zoned) {
|
|
162
|
+
const until = rule.until;
|
|
163
|
+
if (until === undefined) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
if (until.hour === undefined) {
|
|
167
|
+
return compare(datePart(candidate), until) > 0;
|
|
168
|
+
}
|
|
169
|
+
if (zoned && until.timeZone !== undefined) {
|
|
170
|
+
return toInstant(toZoned(candidate, timeZone)) > toInstant(until);
|
|
171
|
+
}
|
|
172
|
+
return compare(candidate, until) > 0;
|
|
173
|
+
}
|
|
174
|
+
function firstPeriodIndex(rule, startDate, target) {
|
|
175
|
+
const interval = rule.interval ?? 1;
|
|
176
|
+
if (rule.freq === "DAILY") {
|
|
177
|
+
return Math.floor((toEpochDay(target) - toEpochDay(startDate)) / interval);
|
|
178
|
+
}
|
|
179
|
+
if (rule.freq === "WEEKLY") {
|
|
180
|
+
const wkst = rule.wkst ?? DEFAULT_WKST;
|
|
181
|
+
const from = startOfWeek(startDate, wkst);
|
|
182
|
+
const to = startOfWeek(target, wkst);
|
|
183
|
+
return Math.floor((toEpochDay(to) - toEpochDay(from)) / (7 * interval));
|
|
184
|
+
}
|
|
185
|
+
if (rule.freq === "MONTHLY") {
|
|
186
|
+
const from = startDate.year * 12 + (startDate.month - 1);
|
|
187
|
+
const to = target.year * 12 + (target.month - 1);
|
|
188
|
+
return Math.floor((to - from) / interval);
|
|
189
|
+
}
|
|
190
|
+
return Math.floor((target.year - startDate.year) / interval);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Expand a parsed rule inside `range` (plan 12 RR4/RR5). DTSTART is always the
|
|
194
|
+
* first occurrence and counts toward COUNT. Occurrences keep DTSTART's wall
|
|
195
|
+
* time; zoned series resolve it through `toZoned(..., "compatible")`.
|
|
196
|
+
*/
|
|
197
|
+
export function expandRule(rule, options) {
|
|
198
|
+
const { start, allDay, timeZone, zoned, range } = options;
|
|
199
|
+
const startDate = datePart(start);
|
|
200
|
+
const rangeStart = plainDateTime(datePartOf(range.start), {
|
|
201
|
+
hour: 0,
|
|
202
|
+
minute: 0,
|
|
203
|
+
second: 0,
|
|
204
|
+
});
|
|
205
|
+
const rangeEnd = plainDateTime(datePartOf(range.end), {
|
|
206
|
+
hour: 23,
|
|
207
|
+
minute: 59,
|
|
208
|
+
second: 59,
|
|
209
|
+
});
|
|
210
|
+
const rangeEndDay = toEpochDay(range.end);
|
|
211
|
+
const lookbackDays = allDay
|
|
212
|
+
? options.durationDays
|
|
213
|
+
: Math.ceil(options.durationSeconds / SECONDS_PER_DAY);
|
|
214
|
+
// Periods before this cannot reach the range, even for a multi-day occurrence.
|
|
215
|
+
const windowStart = addDays(datePartOf(range.start), -(lookbackDays + 1));
|
|
216
|
+
const dates = new Map();
|
|
217
|
+
const seen = new Set();
|
|
218
|
+
let generated = 0;
|
|
219
|
+
const resolve = (candidate) => {
|
|
220
|
+
if (!zoned) {
|
|
221
|
+
return candidate;
|
|
222
|
+
}
|
|
223
|
+
const resolved = toZoned(candidate, timeZone, "compatible");
|
|
224
|
+
return plainDateTime(plainDate(resolved.year, resolved.month, resolved.day), {
|
|
225
|
+
hour: resolved.hour,
|
|
226
|
+
minute: resolved.minute,
|
|
227
|
+
second: resolved.second,
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const overlaps = (occurrence) => {
|
|
231
|
+
if (compare(occurrence.start, occurrence.end) === 0) {
|
|
232
|
+
return compare(occurrence.start, rangeStart) >= 0 && compare(occurrence.start, rangeEnd) <= 0;
|
|
233
|
+
}
|
|
234
|
+
return compare(occurrence.start, rangeEnd) <= 0 && compare(occurrence.end, rangeStart) > 0;
|
|
235
|
+
};
|
|
236
|
+
const add = (candidate, force = false) => {
|
|
237
|
+
const key = wallSeconds(candidate);
|
|
238
|
+
if (seen.has(key)) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
if (!force) {
|
|
242
|
+
if (rule.count !== undefined && generated >= rule.count) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
if (pastUntil(candidate, rule, timeZone, zoned)) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
seen.add(key);
|
|
250
|
+
generated += 1;
|
|
251
|
+
const occurrenceStart = resolve(candidate);
|
|
252
|
+
const occurrenceEnd = allDay
|
|
253
|
+
? plainDateTime(addDays(occurrenceStart, options.durationDays), {
|
|
254
|
+
hour: 0,
|
|
255
|
+
minute: 0,
|
|
256
|
+
second: 0,
|
|
257
|
+
})
|
|
258
|
+
: fromWallSeconds(wallSeconds(occurrenceStart) + options.durationSeconds);
|
|
259
|
+
const occurrence = {
|
|
260
|
+
start: occurrenceStart,
|
|
261
|
+
end: occurrenceEnd,
|
|
262
|
+
allDay,
|
|
263
|
+
};
|
|
264
|
+
if (overlaps(occurrence)) {
|
|
265
|
+
dates.set(key, occurrence);
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
};
|
|
269
|
+
add(start, true);
|
|
270
|
+
if (rule.count !== undefined && generated >= rule.count) {
|
|
271
|
+
return [...dates.values()];
|
|
272
|
+
}
|
|
273
|
+
const jumpTo = rule.count === undefined ? Math.max(0, firstPeriodIndex(rule, startDate, windowStart) - 1) : 0;
|
|
274
|
+
for (let step = jumpTo; step <= ITERATION_CAP + jumpTo; step += 1) {
|
|
275
|
+
const iterations = step - jumpTo + 1;
|
|
276
|
+
if (iterations > ITERATION_CAP) {
|
|
277
|
+
options.onError?.(rruleError("iteration-cap", `The rule needed more than ${ITERATION_CAP} periods; expansion stopped.`, "FREQ"));
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
const period = periodOf(rule, startDate, step);
|
|
281
|
+
if (toEpochDay(period.anchor) > rangeEndDay + 1) {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
for (const date of period.dates) {
|
|
285
|
+
const candidate = plainDateTime(date, timePart(start));
|
|
286
|
+
if (compare(candidate, start) < 0) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (!add(candidate)) {
|
|
290
|
+
return [...dates.values()];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (rule.count !== undefined && generated >= rule.count) {
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return [...dates.values()].sort((a, b) => compare(a.start, b.start));
|
|
298
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { addDays, compare, plainDateTime, toEpochDay, toIsoString, } from "../../foundation/index.js";
|
|
2
|
+
import { normalizeEventInput, normalizeEvents, warnOnce } from "../events/normalize.js";
|
|
3
|
+
import { expandRecurrence, overrideInfo, overrideOf, recurrenceWall } from "./series.js";
|
|
4
|
+
const CACHE_LIMIT = 500;
|
|
5
|
+
const cache = new Map();
|
|
6
|
+
/** Once per series object and error code (plan 12 R5). */
|
|
7
|
+
const reported = new WeakMap();
|
|
8
|
+
function report(event, onError, error) {
|
|
9
|
+
let codes = reported.get(event);
|
|
10
|
+
if (!codes) {
|
|
11
|
+
codes = new Set();
|
|
12
|
+
reported.set(event, codes);
|
|
13
|
+
}
|
|
14
|
+
if (codes.has(error.code)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
codes.add(error.code);
|
|
18
|
+
onError?.(event, error);
|
|
19
|
+
}
|
|
20
|
+
function cacheSet(key, value) {
|
|
21
|
+
cache.set(key, value);
|
|
22
|
+
if (cache.size > CACHE_LIMIT) {
|
|
23
|
+
const first = cache.keys().next().value;
|
|
24
|
+
if (first !== undefined) {
|
|
25
|
+
cache.delete(first);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function overlaps(start, end, range) {
|
|
30
|
+
const from = plainDateTime(range.start, {
|
|
31
|
+
hour: 0,
|
|
32
|
+
minute: 0,
|
|
33
|
+
second: 0,
|
|
34
|
+
});
|
|
35
|
+
const last = plainDateTime(range.end, {
|
|
36
|
+
hour: 23,
|
|
37
|
+
minute: 59,
|
|
38
|
+
second: 59,
|
|
39
|
+
});
|
|
40
|
+
if (compare(start, end) === 0) {
|
|
41
|
+
return compare(start, from) >= 0 && compare(start, last) <= 0;
|
|
42
|
+
}
|
|
43
|
+
return compare(start, last) <= 0 && compare(end, from) > 0;
|
|
44
|
+
}
|
|
45
|
+
/** Widen the expansion so overrides can be matched wherever they sit. */
|
|
46
|
+
function bounds(visibleRange, overrides) {
|
|
47
|
+
let start = visibleRange.start;
|
|
48
|
+
let end = visibleRange.end;
|
|
49
|
+
for (const occurrence of overrides) {
|
|
50
|
+
const date = {
|
|
51
|
+
calendar: "gregory",
|
|
52
|
+
year: occurrence.year,
|
|
53
|
+
month: occurrence.month,
|
|
54
|
+
day: occurrence.day,
|
|
55
|
+
};
|
|
56
|
+
if (toEpochDay(date) < toEpochDay(start)) {
|
|
57
|
+
start = addDays(date, -1);
|
|
58
|
+
}
|
|
59
|
+
if (toEpochDay(date) > toEpochDay(end)) {
|
|
60
|
+
end = date;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { start, end };
|
|
64
|
+
}
|
|
65
|
+
function valueKey(value) {
|
|
66
|
+
if (typeof value === "string") {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
if (value === null || value === undefined) {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
if (typeof value === "object") {
|
|
73
|
+
return JSON.stringify(value);
|
|
74
|
+
}
|
|
75
|
+
return String(value);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Expand series and resolve overrides for normalization (plan 12 RR2/RR6).
|
|
79
|
+
* Without this pack, `normalizeEvents` shows an event with `rrule` once.
|
|
80
|
+
*/
|
|
81
|
+
function expand(events, options) {
|
|
82
|
+
const { visibleRange, timeZone, onRecurrenceError } = options;
|
|
83
|
+
const series = [];
|
|
84
|
+
const overrides = [];
|
|
85
|
+
const plain = [];
|
|
86
|
+
for (const event of events) {
|
|
87
|
+
if (overrideOf(event, timeZone)) {
|
|
88
|
+
overrides.push(event);
|
|
89
|
+
}
|
|
90
|
+
else if (event.rrule !== undefined) {
|
|
91
|
+
series.push(event);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
plain.push(event);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const parsed = new Map();
|
|
98
|
+
const overrideStarts = new Map();
|
|
99
|
+
const seriesById = new Map();
|
|
100
|
+
for (const value of series) {
|
|
101
|
+
parsed.set(value, normalizeEventInput(value, timeZone));
|
|
102
|
+
seriesById.set(String(value.id), value);
|
|
103
|
+
}
|
|
104
|
+
for (const value of overrides) {
|
|
105
|
+
parsed.set(value, normalizeEventInput(value, timeZone));
|
|
106
|
+
const override = overrideOf(value, timeZone);
|
|
107
|
+
if (override) {
|
|
108
|
+
overrideStarts.set(value, override.occurrenceStart);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const overridesBySeries = new Map();
|
|
112
|
+
for (const event of overrides) {
|
|
113
|
+
const override = overrideOf(event, timeZone);
|
|
114
|
+
if (!override) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const key = String(override.recurringId);
|
|
118
|
+
const list = overridesBySeries.get(key) ?? [];
|
|
119
|
+
list.push({ event, start: override.occurrenceStart });
|
|
120
|
+
overridesBySeries.set(key, list);
|
|
121
|
+
}
|
|
122
|
+
const output = new Map();
|
|
123
|
+
const matched = new Set();
|
|
124
|
+
for (const value of series) {
|
|
125
|
+
const shape = value;
|
|
126
|
+
const own = overridesBySeries.get(String(value.id)) ?? [];
|
|
127
|
+
const range = bounds(visibleRange, own.map((entry) => entry.start));
|
|
128
|
+
const parsedSeries = parsed.get(value);
|
|
129
|
+
const exdates = new Set((shape.exdates ?? []).map((exdate) => toIsoString(recurrenceWall(exdate, parsedSeries.allDay, timeZone))));
|
|
130
|
+
const key = [
|
|
131
|
+
String(value.id),
|
|
132
|
+
valueKey(shape.rrule),
|
|
133
|
+
toIsoString(parsedSeries.start),
|
|
134
|
+
toIsoString(parsedSeries.end),
|
|
135
|
+
parsedSeries.allDay ? "d" : "",
|
|
136
|
+
timeZone,
|
|
137
|
+
toIsoString(range.start),
|
|
138
|
+
toIsoString(range.end),
|
|
139
|
+
(shape.exdates ?? []).map(valueKey).join(","),
|
|
140
|
+
(shape.rdates ?? []).map(valueKey).join(","),
|
|
141
|
+
].join("|");
|
|
142
|
+
let cached = cache.get(key);
|
|
143
|
+
if (!cached) {
|
|
144
|
+
cached = expandRecurrence(value, range, {
|
|
145
|
+
timeZone,
|
|
146
|
+
onError: (error) => report(value, onRecurrenceError, error),
|
|
147
|
+
});
|
|
148
|
+
cacheSet(key, cached);
|
|
149
|
+
}
|
|
150
|
+
const occurrences = cached.map((occurrence) => ({
|
|
151
|
+
...occurrence,
|
|
152
|
+
event: value,
|
|
153
|
+
recurrence: occurrence.recurrence ? { ...occurrence.recurrence, series: value } : undefined,
|
|
154
|
+
}));
|
|
155
|
+
const byStart = new Map();
|
|
156
|
+
for (const entry of own) {
|
|
157
|
+
byStart.set(toIsoString(entry.start), entry.event);
|
|
158
|
+
}
|
|
159
|
+
const list = [];
|
|
160
|
+
for (const occurrence of occurrences) {
|
|
161
|
+
const occurrenceKey = toIsoString(occurrence.start);
|
|
162
|
+
const override = byStart.get(occurrenceKey);
|
|
163
|
+
if (override) {
|
|
164
|
+
matched.add(override);
|
|
165
|
+
const info = parsed.get(override);
|
|
166
|
+
if (overlaps(info.start, info.end, visibleRange)) {
|
|
167
|
+
list.push({
|
|
168
|
+
event: override,
|
|
169
|
+
start: info.start,
|
|
170
|
+
end: info.end,
|
|
171
|
+
allDay: info.allDay,
|
|
172
|
+
key: `${String(value.id)}:${occurrenceKey}`,
|
|
173
|
+
recurrence: overrideInfo(value, occurrence.start),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if (overlaps(occurrence.start, occurrence.end, visibleRange)) {
|
|
178
|
+
list.push(occurrence);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
output.set(value, list);
|
|
182
|
+
for (const entry of own) {
|
|
183
|
+
if (matched.has(entry.event)) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const occurrenceKey = toIsoString(entry.start);
|
|
187
|
+
warnOnce(exdates.has(occurrenceKey)
|
|
188
|
+
? `[chrono] Override "${String(entry.event.id)}" targets an excluded occurrence; ignored.`
|
|
189
|
+
: `[chrono] Override "${String(entry.event.id)}" does not match an occurrence; ignored.`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const plainNormalized = normalizeEvents(plain, {
|
|
193
|
+
visibleRange,
|
|
194
|
+
timeZone,
|
|
195
|
+
});
|
|
196
|
+
const plainByEvent = new Map();
|
|
197
|
+
for (const occurrence of plainNormalized) {
|
|
198
|
+
const list = plainByEvent.get(occurrence.event) ?? [];
|
|
199
|
+
list.push(occurrence);
|
|
200
|
+
plainByEvent.set(occurrence.event, list);
|
|
201
|
+
}
|
|
202
|
+
const orphans = new Map();
|
|
203
|
+
for (const event of overrides) {
|
|
204
|
+
const shape = event;
|
|
205
|
+
if (matched.has(event) ||
|
|
206
|
+
(shape.recurringId !== undefined && seriesById.has(String(shape.recurringId)))) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const info = parsed.get(event);
|
|
210
|
+
if (!overlaps(info.start, info.end, visibleRange)) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
// Pre-expanded data may carry an override without its series.
|
|
214
|
+
orphans.set(event, {
|
|
215
|
+
event,
|
|
216
|
+
start: info.start,
|
|
217
|
+
end: info.end,
|
|
218
|
+
allDay: info.allDay,
|
|
219
|
+
key: info.key,
|
|
220
|
+
recurrence: {
|
|
221
|
+
recurringId: shape.recurringId,
|
|
222
|
+
occurrenceStart: overrideStarts.get(event),
|
|
223
|
+
isOverride: true,
|
|
224
|
+
series: event,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
const result = [];
|
|
229
|
+
for (const event of events) {
|
|
230
|
+
const seriesOutput = output.get(event);
|
|
231
|
+
if (seriesOutput) {
|
|
232
|
+
result.push(...seriesOutput);
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
const orphan = orphans.get(event);
|
|
236
|
+
if (orphan) {
|
|
237
|
+
result.push(orphan);
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const list = plainByEvent.get(event);
|
|
241
|
+
if (list) {
|
|
242
|
+
result.push(...list);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
/** The opt-in recurrence pack (plan 12 RR2). */
|
|
248
|
+
export const recurrence = { expand };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DayOfWeek, PlainDate, PlainDateTime, ZonedDateTime } from "../../foundation/index.js";
|
|
2
|
+
/** Frequencies the recurrence engine supports (plan 12 RR3). */
|
|
3
|
+
export type RRuleFreq = "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY";
|
|
4
|
+
/** One `BYDAY` entry: a weekday, optionally the nth of a month (`2TU`, `-1FR`). */
|
|
5
|
+
export type RRuleByDay = {
|
|
6
|
+
day: DayOfWeek;
|
|
7
|
+
ordinal?: number;
|
|
8
|
+
};
|
|
9
|
+
/** `UNTIL` keeps the form it was written in: date, floating date-time or UTC instant. */
|
|
10
|
+
export type RRuleUntil = PlainDate | PlainDateTime | ZonedDateTime;
|
|
11
|
+
/** The supported RFC 5545 subset (plan 12 RR3). */
|
|
12
|
+
export type RRule = {
|
|
13
|
+
freq: RRuleFreq;
|
|
14
|
+
interval?: number;
|
|
15
|
+
count?: number;
|
|
16
|
+
until?: RRuleUntil;
|
|
17
|
+
byDay?: readonly RRuleByDay[];
|
|
18
|
+
/** `-31…-1` and `1…31`. */
|
|
19
|
+
byMonthDay?: readonly number[];
|
|
20
|
+
/** `1…12`. */
|
|
21
|
+
byMonth?: readonly number[];
|
|
22
|
+
wkst?: DayOfWeek;
|
|
23
|
+
};
|
|
24
|
+
export type RRuleErrorCode = "unsupported-part" | "invalid-value" | "conflict" | "iteration-cap";
|
|
25
|
+
/** A rule error carries the failing part so apps can point at it in their editor. */
|
|
26
|
+
export type RRuleError = Error & {
|
|
27
|
+
code: RRuleErrorCode;
|
|
28
|
+
part?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function rruleError(code: RRuleErrorCode, message: string, part?: string): RRuleError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RRule } from "./rrule-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parse an RFC 5545 `RRULE` value (with or without the `RRULE:` prefix) or
|
|
4
|
+
* validate a rule object. Unsupported parts throw an {@link RRuleError}.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseRRule(input: string | RRule): RRule;
|
|
7
|
+
/**
|
|
8
|
+
* Serialize a rule in the fixed part order `FREQ, INTERVAL, COUNT, UNTIL,
|
|
9
|
+
* BYMONTH, BYMONTHDAY, BYDAY, WKST`; `parseRRule(stringifyRRule(rule))` equals
|
|
10
|
+
* `rule`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stringifyRRule(rule: RRule): string;
|