@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,38 @@
|
|
|
1
|
+
/** Pure keyboard editing keys (plan 09 M10, §13.3). */
|
|
2
|
+
export type EditKind = "move" | "resize-start" | "resize-end";
|
|
3
|
+
export type Shortcuts = {
|
|
4
|
+
move: string;
|
|
5
|
+
resizeEnd: string;
|
|
6
|
+
resizeStart: string;
|
|
7
|
+
};
|
|
8
|
+
/** `R` resizes the end, `Shift+R` the start. */
|
|
9
|
+
export declare const DEFAULT_SHORTCUTS: Shortcuts;
|
|
10
|
+
export type KeyStep = {
|
|
11
|
+
type: "step";
|
|
12
|
+
days: number;
|
|
13
|
+
minutes: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: "drop";
|
|
16
|
+
} | {
|
|
17
|
+
type: "cancel";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The edit a shortcut starts, or `null`. Matched case-insensitively on `key`; ignored
|
|
21
|
+
* with Ctrl, Alt or Meta so browser shortcuts keep working.
|
|
22
|
+
*/
|
|
23
|
+
export declare function matchShortcut(key: string, modifiers: {
|
|
24
|
+
shift: boolean;
|
|
25
|
+
ctrl: boolean;
|
|
26
|
+
meta: boolean;
|
|
27
|
+
alt?: boolean;
|
|
28
|
+
}, shortcuts: Shortcuts | false): EditKind | null;
|
|
29
|
+
/**
|
|
30
|
+
* What a key does while editing. Time grid: ↑/↓ by `snap` minutes, ←/→ by a day;
|
|
31
|
+
* month and the all-day row: ←/→ by a day, ↑/↓ by a week (a move only: a resize moves
|
|
32
|
+
* its edge along one axis and the other axis moves nothing). `rtl` swaps ←/→.
|
|
33
|
+
*/
|
|
34
|
+
export declare function editStep(kind: EditKind, key: string, context: {
|
|
35
|
+
timeGrid: boolean;
|
|
36
|
+
snap: number;
|
|
37
|
+
rtl?: boolean;
|
|
38
|
+
}): KeyStep | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Pure keyboard editing keys (plan 09 M10, §13.3). */
|
|
2
|
+
/** `R` resizes the end, `Shift+R` the start. */
|
|
3
|
+
export const DEFAULT_SHORTCUTS = {
|
|
4
|
+
move: "m",
|
|
5
|
+
resizeEnd: "r",
|
|
6
|
+
resizeStart: "R",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The edit a shortcut starts, or `null`. Matched case-insensitively on `key`; ignored
|
|
10
|
+
* with Ctrl, Alt or Meta so browser shortcuts keep working.
|
|
11
|
+
*/
|
|
12
|
+
export function matchShortcut(key, modifiers, shortcuts) {
|
|
13
|
+
if (shortcuts === false || modifiers.ctrl || modifiers.meta || modifiers.alt) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const same = (a) => a.toLowerCase() === key.toLowerCase();
|
|
17
|
+
if (same(shortcuts.move) && !modifiers.shift)
|
|
18
|
+
return "move";
|
|
19
|
+
if (same(shortcuts.resizeEnd) && !modifiers.shift)
|
|
20
|
+
return "resize-end";
|
|
21
|
+
if (same(shortcuts.resizeStart) &&
|
|
22
|
+
(modifiers.shift || shortcuts.resizeStart !== shortcuts.resizeEnd)) {
|
|
23
|
+
return "resize-start";
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What a key does while editing. Time grid: ↑/↓ by `snap` minutes, ←/→ by a day;
|
|
29
|
+
* month and the all-day row: ←/→ by a day, ↑/↓ by a week (a move only: a resize moves
|
|
30
|
+
* its edge along one axis and the other axis moves nothing). `rtl` swaps ←/→.
|
|
31
|
+
*/
|
|
32
|
+
export function editStep(kind, key, context) {
|
|
33
|
+
if (key === "Enter")
|
|
34
|
+
return { type: "drop" };
|
|
35
|
+
if (key === "Escape")
|
|
36
|
+
return { type: "cancel" };
|
|
37
|
+
const horizontal = key === "ArrowLeft" ? -1 : key === "ArrowRight" ? 1 : 0;
|
|
38
|
+
const vertical = key === "ArrowUp" ? -1 : key === "ArrowDown" ? 1 : 0;
|
|
39
|
+
if (!horizontal && !vertical)
|
|
40
|
+
return null;
|
|
41
|
+
const side = context.rtl ? -horizontal : horizontal;
|
|
42
|
+
if (context.timeGrid) {
|
|
43
|
+
if (kind === "move") {
|
|
44
|
+
return { type: "step", days: side, minutes: vertical * context.snap };
|
|
45
|
+
}
|
|
46
|
+
// Resizing a time-grid event changes its edge vertically only.
|
|
47
|
+
return { type: "step", days: 0, minutes: vertical * context.snap };
|
|
48
|
+
}
|
|
49
|
+
if (kind === "move") {
|
|
50
|
+
return { type: "step", days: side + vertical * 7, minutes: 0 };
|
|
51
|
+
}
|
|
52
|
+
return { type: "step", days: side, minutes: 0 };
|
|
53
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HitPoint, type HitTarget } from "./hit-test.js";
|
|
2
|
+
import type { EditKind } from "./drag-keyboard.js";
|
|
3
|
+
export type DragPointerHandlers = {
|
|
4
|
+
/** The press landed on an event (`segmentKey`); can it start this edit? */
|
|
5
|
+
canStart(kind: EditKind, segmentKey: string): boolean;
|
|
6
|
+
/** The drag began on `target`. Return `false` to refuse it. */
|
|
7
|
+
begin(kind: EditKind, segmentKey: string, target: HitTarget): boolean;
|
|
8
|
+
update(target: HitTarget): void;
|
|
9
|
+
drop(): void;
|
|
10
|
+
cancel(): void;
|
|
11
|
+
hitTest?: ((point: HitPoint) => HitTarget | null) | undefined;
|
|
12
|
+
/** Scroll container for auto-scroll; `false` turns it off. */
|
|
13
|
+
scroll?: () => HTMLElement | null | false;
|
|
14
|
+
};
|
|
15
|
+
export type DragPointer = {
|
|
16
|
+
destroy(): void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Calendar wiring for the generic drag session (plan 08-2 Step 4): the session
|
|
20
|
+
* owns the mechanics (threshold, long press, claim, capture, Escape layer,
|
|
21
|
+
* frame loop, auto-scroll, interaction lock); this file only says what a drag
|
|
22
|
+
* means — which event/resize handle was pressed and which edit handlers run.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDragPointer(root: HTMLElement, handlers: DragPointerHandlers): DragPointer;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createDragSession } from "../../dom/drag-session.js";
|
|
2
|
+
import { hasForeignGestureHandle } from "./gesture-handle.js";
|
|
3
|
+
import { elementHitTest } from "./hit-test.js";
|
|
4
|
+
/**
|
|
5
|
+
* Calendar wiring for the generic drag session (plan 08-2 Step 4): the session
|
|
6
|
+
* owns the mechanics (threshold, long press, claim, capture, Escape layer,
|
|
7
|
+
* frame loop, auto-scroll, interaction lock); this file only says what a drag
|
|
8
|
+
* means — which event/resize handle was pressed and which edit handlers run.
|
|
9
|
+
*/
|
|
10
|
+
export function createDragPointer(root, handlers) {
|
|
11
|
+
const hitTest = handlers.hitTest ?? elementHitTest;
|
|
12
|
+
const session = createDragSession({
|
|
13
|
+
root,
|
|
14
|
+
gestureKind: "chrono-calendar-drag",
|
|
15
|
+
press: (event) => {
|
|
16
|
+
// E25: another owner's marked handle on the way to our root wins.
|
|
17
|
+
if (hasForeignGestureHandle(event, root, "chrono")) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const element = event.target?.closest?.("[data-chrono-event-key]");
|
|
21
|
+
if (!element || !root.contains(element)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const handle = event.target.closest?.("[data-chrono-resize]");
|
|
25
|
+
const edge = handle?.getAttribute("data-chrono-resize");
|
|
26
|
+
const kind = edge === "start" ? "resize-start" : edge === "end" ? "resize-end" : "move";
|
|
27
|
+
const key = element.getAttribute("data-chrono-event-key") ?? "";
|
|
28
|
+
return handlers.canStart(kind, key) ? { kind, key } : null;
|
|
29
|
+
},
|
|
30
|
+
hitTest,
|
|
31
|
+
begin: (pressed, hit) => {
|
|
32
|
+
if (!hit) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return handlers.begin(pressed.kind, pressed.key, hit);
|
|
36
|
+
},
|
|
37
|
+
update: (hit) => handlers.update(hit),
|
|
38
|
+
drop: handlers.drop,
|
|
39
|
+
cancel: handlers.cancel,
|
|
40
|
+
scroll: handlers.scroll,
|
|
41
|
+
});
|
|
42
|
+
return session;
|
|
43
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure keyboard focus model for the "interactive cell" pattern (plan 05 E11):
|
|
3
|
+
* the calendar is one tab stop; Enter/F2 enters a cell's events, Escape/F2
|
|
4
|
+
* returns to the owning cell. No DOM access — the controller applies the focus.
|
|
5
|
+
*/
|
|
6
|
+
export type FocusMode = "navigation" | "interaction";
|
|
7
|
+
export type FocusState = {
|
|
8
|
+
mode: FocusMode;
|
|
9
|
+
/** The owning cell key (`YYYY-MM-DD` or `YYYY-MM-DDTHH:mm`). */
|
|
10
|
+
cellKey: string;
|
|
11
|
+
/** The focused item key inside interaction mode (an event or "+N more"). */
|
|
12
|
+
itemKey?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Ordered focusable items of a cell: event keys, then the "+N more" key last. */
|
|
15
|
+
export type FocusItems = readonly string[];
|
|
16
|
+
/** Enter interaction mode on the first item of a cell (E11). */
|
|
17
|
+
export declare function enterCell(cellKey: string, items: FocusItems): FocusState;
|
|
18
|
+
/** Whether a key leaves interaction mode back to the owning cell (Escape / F2). */
|
|
19
|
+
export declare function isExitKey(key: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Move focus inside interaction mode (plan 05 §2.5). Returns the next state for
|
|
22
|
+
* ↓/Tab (next, wrapping), ↑/Shift+Tab (previous, wrapping), Home/End
|
|
23
|
+
* (first/last), Escape/F2 (back to navigation), or `null` when the key is not
|
|
24
|
+
* an interaction-movement key (Space/Enter are handled by the controller).
|
|
25
|
+
*/
|
|
26
|
+
export declare function stepFocus(focus: FocusState, key: string, modifiers: {
|
|
27
|
+
shift: boolean;
|
|
28
|
+
}, items: FocusItems): FocusState | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure keyboard focus model for the "interactive cell" pattern (plan 05 E11):
|
|
3
|
+
* the calendar is one tab stop; Enter/F2 enters a cell's events, Escape/F2
|
|
4
|
+
* returns to the owning cell. No DOM access — the controller applies the focus.
|
|
5
|
+
*/
|
|
6
|
+
/** Enter interaction mode on the first item of a cell (E11). */
|
|
7
|
+
export function enterCell(cellKey, items) {
|
|
8
|
+
return { mode: "interaction", cellKey, itemKey: items[0] };
|
|
9
|
+
}
|
|
10
|
+
/** Whether a key leaves interaction mode back to the owning cell (Escape / F2). */
|
|
11
|
+
export function isExitKey(key) {
|
|
12
|
+
return key === "Escape" || key === "F2";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Move focus inside interaction mode (plan 05 §2.5). Returns the next state for
|
|
16
|
+
* ↓/Tab (next, wrapping), ↑/Shift+Tab (previous, wrapping), Home/End
|
|
17
|
+
* (first/last), Escape/F2 (back to navigation), or `null` when the key is not
|
|
18
|
+
* an interaction-movement key (Space/Enter are handled by the controller).
|
|
19
|
+
*/
|
|
20
|
+
export function stepFocus(focus, key, modifiers, items) {
|
|
21
|
+
if (items.length === 0) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const index = Math.max(0, items.indexOf(focus.itemKey ?? ""));
|
|
25
|
+
if (key === "ArrowDown" || (key === "Tab" && !modifiers.shift)) {
|
|
26
|
+
return { ...focus, itemKey: items[(index + 1) % items.length] };
|
|
27
|
+
}
|
|
28
|
+
if (key === "ArrowUp" || (key === "Tab" && modifiers.shift)) {
|
|
29
|
+
return {
|
|
30
|
+
...focus,
|
|
31
|
+
itemKey: items[(index - 1 + items.length) % items.length],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (key === "Home") {
|
|
35
|
+
return { ...focus, itemKey: items[0] };
|
|
36
|
+
}
|
|
37
|
+
if (key === "End") {
|
|
38
|
+
return { ...focus, itemKey: items[items.length - 1] };
|
|
39
|
+
}
|
|
40
|
+
if (isExitKey(key)) {
|
|
41
|
+
return { mode: "navigation", cellKey: focus.cellKey };
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gesture-handle priority (E25, plan 08-2 NQ14).
|
|
3
|
+
*
|
|
4
|
+
* A component marks its own drag handle with
|
|
5
|
+
* `data-zealakit-gesture-handle="<owner>"`. A session skips a `pointerdown`
|
|
6
|
+
* whose composed path meets a handle of a **different** owner before the
|
|
7
|
+
* session's own root, so an outer title bar or pane separator wins over the
|
|
8
|
+
* content it contains.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Whether `event`'s path reaches another owner's marked handle before `root`.
|
|
12
|
+
*
|
|
13
|
+
* @param event The `pointerdown` event.
|
|
14
|
+
* @param root The session's own root element.
|
|
15
|
+
* @param owner This component's handle name (e.g. `"chrono"`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasForeignGestureHandle(event: PointerEvent, root: Element, owner: string): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gesture-handle priority (E25, plan 08-2 NQ14).
|
|
3
|
+
*
|
|
4
|
+
* A component marks its own drag handle with
|
|
5
|
+
* `data-zealakit-gesture-handle="<owner>"`. A session skips a `pointerdown`
|
|
6
|
+
* whose composed path meets a handle of a **different** owner before the
|
|
7
|
+
* session's own root, so an outer title bar or pane separator wins over the
|
|
8
|
+
* content it contains.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Whether `event`'s path reaches another owner's marked handle before `root`.
|
|
12
|
+
*
|
|
13
|
+
* @param event The `pointerdown` event.
|
|
14
|
+
* @param root The session's own root element.
|
|
15
|
+
* @param owner This component's handle name (e.g. `"chrono"`).
|
|
16
|
+
*/
|
|
17
|
+
export function hasForeignGestureHandle(event, root, owner) {
|
|
18
|
+
for (const node of event.composedPath?.() ?? []) {
|
|
19
|
+
if (node === root)
|
|
20
|
+
break;
|
|
21
|
+
const declared = node.getAttribute?.("data-zealakit-gesture-handle");
|
|
22
|
+
if (declared && declared !== owner)
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Pointer → cell hit testing (plan 05 E17): by element, never by geometry. */
|
|
2
|
+
export type HitPoint = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type HitTarget = {
|
|
7
|
+
cellKey: string;
|
|
8
|
+
/** The element is a time-grid all-day-row cell (`data-all-day-cell`). */
|
|
9
|
+
allDay?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The default hit test: the nearest `[data-chrono-key]` among the elements under
|
|
13
|
+
* the point (`document.elementsFromPoint`, so an event or column overlay drawn
|
|
14
|
+
* above the slots does not hide the cell below it). Works with any CSS,
|
|
15
|
+
* transform, zoom and RTL.
|
|
16
|
+
*/
|
|
17
|
+
export declare function elementHitTest(point: HitPoint): HitTarget | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Pointer → cell hit testing (plan 05 E17): by element, never by geometry. */
|
|
2
|
+
/**
|
|
3
|
+
* The default hit test: the nearest `[data-chrono-key]` among the elements under
|
|
4
|
+
* the point (`document.elementsFromPoint`, so an event or column overlay drawn
|
|
5
|
+
* above the slots does not hide the cell below it). Works with any CSS,
|
|
6
|
+
* transform, zoom and RTL.
|
|
7
|
+
*/
|
|
8
|
+
export function elementHitTest(point) {
|
|
9
|
+
if (typeof document === "undefined") {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const stack = typeof document.elementsFromPoint === "function"
|
|
13
|
+
? document.elementsFromPoint(point.x, point.y)
|
|
14
|
+
: [document.elementFromPoint(point.x, point.y)];
|
|
15
|
+
for (const element of stack) {
|
|
16
|
+
const cell = element?.closest?.("[data-chrono-key]");
|
|
17
|
+
const key = cell?.getAttribute("data-chrono-key");
|
|
18
|
+
if (key) {
|
|
19
|
+
return {
|
|
20
|
+
cellKey: key,
|
|
21
|
+
...(cell?.hasAttribute("data-all-day-cell") ? { allDay: true } : {}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CalendarEventInput, NormalizedEvent } from "../events/types.js";
|
|
2
|
+
import { type EditValue } from "./drag-geometry.js";
|
|
3
|
+
/** A change the app has accepted but `events` does not show yet (plan 09 M3). */
|
|
4
|
+
export type PendingChange = {
|
|
5
|
+
/** The normalized event key. */
|
|
6
|
+
eventKey: string;
|
|
7
|
+
eventId: string | number;
|
|
8
|
+
to: EditValue;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A pending change is resolved when the incoming events show the event at the new
|
|
12
|
+
* position (zoned values compare by instant: they are already display wall time), or
|
|
13
|
+
* when the event is gone.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isResolved<T extends CalendarEventInput>(change: PendingChange, incoming: readonly NormalizedEvent<T>[]): boolean;
|
|
16
|
+
/** The pending changes that remain after `incoming` arrived. */
|
|
17
|
+
export declare function unresolved<T extends CalendarEventInput>(pending: readonly PendingChange[], incoming: readonly NormalizedEvent<T>[]): PendingChange[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toSeconds } from "./drag-geometry.js";
|
|
2
|
+
const same = (a, b) => a.allDay === b.allDay &&
|
|
3
|
+
toSeconds(a.start) === toSeconds(b.start) &&
|
|
4
|
+
toSeconds(a.end) === toSeconds(b.end);
|
|
5
|
+
/**
|
|
6
|
+
* A pending change is resolved when the incoming events show the event at the new
|
|
7
|
+
* position (zoned values compare by instant: they are already display wall time), or
|
|
8
|
+
* when the event is gone.
|
|
9
|
+
*/
|
|
10
|
+
export function isResolved(change, incoming) {
|
|
11
|
+
const found = incoming.find((event) => event.id === change.eventId);
|
|
12
|
+
return !found || same(change.to, found);
|
|
13
|
+
}
|
|
14
|
+
/** The pending changes that remain after `incoming` arrived. */
|
|
15
|
+
export function unresolved(pending, incoming) {
|
|
16
|
+
return pending.filter((change) => !isResolved(change, incoming));
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HitPoint, type HitTarget } from "./hit-test.js";
|
|
2
|
+
export type SelectionPointerHandlers = {
|
|
3
|
+
start(target: HitTarget): void;
|
|
4
|
+
extend(target: HitTarget): void;
|
|
5
|
+
confirm(): void;
|
|
6
|
+
cancel(): void;
|
|
7
|
+
/** Skip a press (for example on an event that is being dragged instead). */
|
|
8
|
+
ignore?: (event: PointerEvent) => boolean;
|
|
9
|
+
/** Tests pass their own; the default uses `elementHitTest`. */
|
|
10
|
+
hitTest?: ((point: HitPoint) => HitTarget | null) | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type SelectionPointer = {
|
|
13
|
+
destroy(): void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Pointer selection pipeline (plan 05 §13.2): drag-select on `[data-chrono-key]`
|
|
17
|
+
* cells. Touch arms a 400 ms long press (canceled by a move past 8 px); a
|
|
18
|
+
* short touch scrolls as usual (E18). Pointer moves are throttled to one per
|
|
19
|
+
* animation frame.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSelectionPointer(root: HTMLElement, handlers: SelectionPointerHandlers): SelectionPointer;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { claimGesture } from "@zealakit/ui-engine/internal";
|
|
2
|
+
import { cancelFrame, scheduleFrame } from "../../dom/auto-scroll.js";
|
|
3
|
+
import { hasForeignGestureHandle } from "./gesture-handle.js";
|
|
4
|
+
import { elementHitTest } from "./hit-test.js";
|
|
5
|
+
const LONG_PRESS_MS = 400;
|
|
6
|
+
const TOUCH_SLOP = 8;
|
|
7
|
+
/**
|
|
8
|
+
* Pointer selection pipeline (plan 05 §13.2): drag-select on `[data-chrono-key]`
|
|
9
|
+
* cells. Touch arms a 400 ms long press (canceled by a move past 8 px); a
|
|
10
|
+
* short touch scrolls as usual (E18). Pointer moves are throttled to one per
|
|
11
|
+
* animation frame.
|
|
12
|
+
*/
|
|
13
|
+
export function createSelectionPointer(root, handlers) {
|
|
14
|
+
const hitTest = handlers.hitTest ?? elementHitTest;
|
|
15
|
+
let selecting = false;
|
|
16
|
+
let claim = null;
|
|
17
|
+
let longPressTimer;
|
|
18
|
+
let frame = 0;
|
|
19
|
+
let startX = 0;
|
|
20
|
+
let startY = 0;
|
|
21
|
+
let lastMove;
|
|
22
|
+
const clearLongPress = () => {
|
|
23
|
+
if (longPressTimer !== undefined) {
|
|
24
|
+
clearTimeout(longPressTimer);
|
|
25
|
+
longPressTimer = undefined;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Start a selection through the engine gesture claim (08-2 Step 2). The
|
|
30
|
+
* selection has no movement threshold today, so it claims on the press
|
|
31
|
+
* itself.
|
|
32
|
+
*
|
|
33
|
+
* E25 as decided (Q10): only marks between the pressed element and `root`
|
|
34
|
+
* are read, so a marked element inside the calendar with another owner
|
|
35
|
+
* blocks the press, while a marked wrapper *around* the calendar is never
|
|
36
|
+
* consulted. Capture only happens after the claim is ours (E23).
|
|
37
|
+
*/
|
|
38
|
+
const beginSelection = (target, pointerId, element) => {
|
|
39
|
+
if (selecting || claim) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const held = claimGesture({
|
|
43
|
+
element: root,
|
|
44
|
+
kind: "chrono-calendar-selection",
|
|
45
|
+
pointerId,
|
|
46
|
+
cancel: () => {
|
|
47
|
+
claim = null; // the engine already dropped it
|
|
48
|
+
onPointerCancel();
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
if (!held) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
claim = held;
|
|
55
|
+
try {
|
|
56
|
+
element?.setPointerCapture?.(pointerId);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// setPointerCapture throws for inactive pointers.
|
|
60
|
+
}
|
|
61
|
+
selecting = true;
|
|
62
|
+
handlers.start(target);
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
const endSelection = () => {
|
|
66
|
+
claim?.release();
|
|
67
|
+
claim = null;
|
|
68
|
+
};
|
|
69
|
+
const onPointerDown = (event) => {
|
|
70
|
+
if (event.button !== 0 || handlers.ignore?.(event)) {
|
|
71
|
+
return; // primary button only: a context-menu click never selects
|
|
72
|
+
}
|
|
73
|
+
// E25: another owner's marked handle on the way to our root wins.
|
|
74
|
+
if (hasForeignGestureHandle(event, root, "chrono")) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const target = hitTest({ x: event.clientX, y: event.clientY });
|
|
78
|
+
if (!target) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (event.pointerType === "touch") {
|
|
82
|
+
startX = event.clientX;
|
|
83
|
+
startY = event.clientY;
|
|
84
|
+
clearLongPress();
|
|
85
|
+
longPressTimer = setTimeout(() => {
|
|
86
|
+
longPressTimer = undefined;
|
|
87
|
+
beginSelection(target, event.pointerId, event.target);
|
|
88
|
+
}, LONG_PRESS_MS);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
beginSelection(target, event.pointerId, event.target);
|
|
92
|
+
};
|
|
93
|
+
const onPointerMove = (event) => {
|
|
94
|
+
if (longPressTimer !== undefined) {
|
|
95
|
+
if (Math.abs(event.clientX - startX) > TOUCH_SLOP ||
|
|
96
|
+
Math.abs(event.clientY - startY) > TOUCH_SLOP) {
|
|
97
|
+
clearLongPress();
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!selecting) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
lastMove = event;
|
|
105
|
+
if (frame !== 0) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
frame = scheduleFrame(() => {
|
|
109
|
+
frame = 0;
|
|
110
|
+
const move = lastMove;
|
|
111
|
+
lastMove = undefined;
|
|
112
|
+
if (!move) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const target = hitTest({ x: move.clientX, y: move.clientY });
|
|
116
|
+
if (target) {
|
|
117
|
+
handlers.extend(target);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const onPointerUp = () => {
|
|
122
|
+
if (longPressTimer !== undefined) {
|
|
123
|
+
clearLongPress();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!selecting) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
selecting = false;
|
|
130
|
+
endSelection();
|
|
131
|
+
handlers.confirm();
|
|
132
|
+
};
|
|
133
|
+
const onPointerCancel = () => {
|
|
134
|
+
clearLongPress();
|
|
135
|
+
if (!selecting) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
selecting = false;
|
|
139
|
+
endSelection();
|
|
140
|
+
handlers.cancel();
|
|
141
|
+
};
|
|
142
|
+
/** E26: a native drag cannot run inside a pointer session. */
|
|
143
|
+
const onDragStart = (event) => {
|
|
144
|
+
if (selecting) {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
onPointerCancel();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
root.addEventListener("dragstart", onDragStart);
|
|
150
|
+
root.addEventListener("pointerdown", onPointerDown);
|
|
151
|
+
root.addEventListener("pointermove", onPointerMove);
|
|
152
|
+
root.addEventListener("pointerup", onPointerUp);
|
|
153
|
+
root.addEventListener("pointercancel", onPointerCancel);
|
|
154
|
+
return {
|
|
155
|
+
destroy() {
|
|
156
|
+
root.removeEventListener("dragstart", onDragStart);
|
|
157
|
+
root.removeEventListener("pointerdown", onPointerDown);
|
|
158
|
+
root.removeEventListener("pointermove", onPointerMove);
|
|
159
|
+
root.removeEventListener("pointerup", onPointerUp);
|
|
160
|
+
root.removeEventListener("pointercancel", onPointerCancel);
|
|
161
|
+
clearLongPress();
|
|
162
|
+
endSelection();
|
|
163
|
+
if (frame !== 0) {
|
|
164
|
+
cancelFrame(frame);
|
|
165
|
+
frame = 0;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PlainDate, type PlainDateTime, type PlainTime, type IntervalPiece } from "../../foundation/index.js";
|
|
2
|
+
export type SelectionCell = {
|
|
3
|
+
date: PlainDate;
|
|
4
|
+
/** Present for a timed slot; absent for a day cell / all-day row. */
|
|
5
|
+
time?: PlainTime;
|
|
6
|
+
};
|
|
7
|
+
export type SelectionOptions = {
|
|
8
|
+
/** Select whole days (month grid / all-day row) instead of a timed range. */
|
|
9
|
+
allDay?: boolean;
|
|
10
|
+
/** Snap granularity for timed selection (plan 05 E14), default 30 minutes. */
|
|
11
|
+
slotDurationMinutes?: number;
|
|
12
|
+
/** Clamp the selection length (E14); clamping is not invalidation. */
|
|
13
|
+
maxDurationMinutes?: number | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** The half-open `[start, end)` selection. All-day ends are exclusive midnights. */
|
|
16
|
+
export type SelectionRange = {
|
|
17
|
+
start: PlainDateTime;
|
|
18
|
+
end: PlainDateTime;
|
|
19
|
+
allDay: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Compute a selection from an anchor cell to a current cell (plan 05 E14):
|
|
23
|
+
* one continuous range, snapped to `slotDurationMinutes`, `end` exclusive and
|
|
24
|
+
* `start + slot` when anchor and current are the same. Dragging backwards
|
|
25
|
+
* swaps. All-day selection spans whole days with an exclusive end.
|
|
26
|
+
*/
|
|
27
|
+
export declare function computeSelection(anchor: SelectionCell, current: SelectionCell, options?: SelectionOptions): SelectionRange;
|
|
28
|
+
/** The per-day pieces of a selection, for the preview elements (plan 05 §2.6). */
|
|
29
|
+
export declare function selectionPieces(range: SelectionRange): IntervalPiece<PlainDateTime>[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { addDays, compare, fromEpochDay, fromSecondOfDay, plainDateTime, plainTime, splitIntervalByDay, } from "../../foundation/index.js";
|
|
2
|
+
import { wallSecondsOf } from "../events/normalize.js";
|
|
3
|
+
const SECONDS_PER_DAY = 86400;
|
|
4
|
+
function fromWallSeconds(seconds) {
|
|
5
|
+
const day = Math.floor(seconds / SECONDS_PER_DAY);
|
|
6
|
+
const secondOfDay = seconds - day * SECONDS_PER_DAY;
|
|
7
|
+
return plainDateTime(fromEpochDay(day), fromSecondOfDay(secondOfDay));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Compute a selection from an anchor cell to a current cell (plan 05 E14):
|
|
11
|
+
* one continuous range, snapped to `slotDurationMinutes`, `end` exclusive and
|
|
12
|
+
* `start + slot` when anchor and current are the same. Dragging backwards
|
|
13
|
+
* swaps. All-day selection spans whole days with an exclusive end.
|
|
14
|
+
*/
|
|
15
|
+
export function computeSelection(anchor, current, options = {}) {
|
|
16
|
+
if (options.allDay) {
|
|
17
|
+
const start = compare(anchor.date, current.date) <= 0 ? anchor.date : current.date;
|
|
18
|
+
const end = compare(anchor.date, current.date) <= 0 ? current.date : anchor.date;
|
|
19
|
+
return {
|
|
20
|
+
start: plainDateTime(start, plainTime(0, 0, 0)),
|
|
21
|
+
end: plainDateTime(addDays(end, 1), plainTime(0, 0, 0)),
|
|
22
|
+
allDay: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const slot = (options.slotDurationMinutes ?? 30) * 60;
|
|
26
|
+
const anchorSeconds = wallSecondsOf(plainDateTime(anchor.date, anchor.time ?? plainTime(0, 0, 0)));
|
|
27
|
+
const currentSeconds = wallSecondsOf(plainDateTime(current.date, current.time ?? plainTime(0, 0, 0)));
|
|
28
|
+
const a = Math.floor(anchorSeconds / slot) * slot;
|
|
29
|
+
const c = Math.floor(currentSeconds / slot) * slot;
|
|
30
|
+
const startSeconds = Math.min(a, c);
|
|
31
|
+
let endSeconds = Math.max(a, c) + slot;
|
|
32
|
+
if (options.maxDurationMinutes !== undefined) {
|
|
33
|
+
const max = options.maxDurationMinutes * 60;
|
|
34
|
+
if (endSeconds - startSeconds > max) {
|
|
35
|
+
endSeconds = startSeconds + max;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
start: fromWallSeconds(startSeconds),
|
|
40
|
+
end: fromWallSeconds(endSeconds),
|
|
41
|
+
allDay: false,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** The per-day pieces of a selection, for the preview elements (plan 05 §2.6). */
|
|
45
|
+
export function selectionPieces(range) {
|
|
46
|
+
return splitIntervalByDay({ start: range.start, end: range.end });
|
|
47
|
+
}
|