@helpdice/draggable 0.0.0-stage → 0.0.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 +13 -0
- package/README.md +164 -2
- package/dist/draggable.cjs.js +9925 -0
- package/dist/draggable.cjs.js.map +1 -0
- package/dist/draggable.esm.js +9899 -0
- package/dist/draggable.esm.js.map +1 -0
- package/dist/types/animation.d.ts +31 -0
- package/dist/types/debug/middleware/action-timing-average.d.ts +3 -0
- package/dist/types/debug/middleware/action-timing.d.ts +3 -0
- package/dist/types/debug/middleware/log.d.ts +4 -0
- package/dist/types/debug/middleware/user-timing.d.ts +3 -0
- package/dist/types/debug/timings.d.ts +3 -0
- package/dist/types/dev-warning.d.ts +4 -0
- package/dist/types/empty.d.ts +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/invariant.d.ts +4 -0
- package/dist/types/native-with-fallback.d.ts +10 -0
- package/dist/types/screen-reader-message-preset.d.ts +9 -0
- package/dist/types/state/action-creators.d.ts +158 -0
- package/dist/types/state/auto-scroller/auto-scroller-types.d.ts +6 -0
- package/dist/types/state/auto-scroller/can-scroll.d.ts +19 -0
- package/dist/types/state/auto-scroller/fluid-scroller/config.d.ts +11 -0
- package/dist/types/state/auto-scroller/fluid-scroller/did-start-in-scrollable-area.d.ts +0 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-best-scrollable-droppable.d.ts +9 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-droppable-scroll-change.d.ts +11 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-percentage.d.ts +7 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/adjust-for-size-limits.d.ts +8 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/dampen-value-by-time.d.ts +2 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-distance-thresholds.d.ts +8 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-value-from-distance.d.ts +3 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-value.d.ts +9 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/index.d.ts +11 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/min-scroll.d.ts +2 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-scroll/index.d.ts +10 -0
- package/dist/types/state/auto-scroller/fluid-scroller/get-window-scroll-change.d.ts +11 -0
- package/dist/types/state/auto-scroller/fluid-scroller/index.d.ts +13 -0
- package/dist/types/state/auto-scroller/fluid-scroller/scroll.d.ts +11 -0
- package/dist/types/state/auto-scroller/index.d.ts +11 -0
- package/dist/types/state/auto-scroller/jump-scroller.d.ts +11 -0
- package/dist/types/state/axis.d.ts +3 -0
- package/dist/types/state/calculate-drag-impact/calculate-reorder-impact.d.ts +13 -0
- package/dist/types/state/can-start-drag.d.ts +3 -0
- package/dist/types/state/create-store.d.ts +16 -0
- package/dist/types/state/did-start-after-critical.d.ts +2 -0
- package/dist/types/state/dimension-marshal/dimension-marshal-types.d.ts +23 -0
- package/dist/types/state/dimension-marshal/dimension-marshal.d.ts +4 -0
- package/dist/types/state/dimension-marshal/get-initial-publish.d.ts +10 -0
- package/dist/types/state/dimension-marshal/while-dragging-publisher.d.ts +17 -0
- package/dist/types/state/dimension-structures.d.ts +5 -0
- package/dist/types/state/droppable/get-droppable.d.ts +21 -0
- package/dist/types/state/droppable/is-home-of.d.ts +3 -0
- package/dist/types/state/droppable/scroll-droppable.d.ts +4 -0
- package/dist/types/state/droppable/should-use-placeholder.d.ts +3 -0
- package/dist/types/state/droppable/util/clip.d.ts +3 -0
- package/dist/types/state/droppable/util/get-subject.d.ts +10 -0
- package/dist/types/state/droppable/what-is-dragged-over-from-result.d.ts +3 -0
- package/dist/types/state/droppable/what-is-dragged-over.d.ts +3 -0
- package/dist/types/state/droppable/with-placeholder.d.ts +3 -0
- package/dist/types/state/get-center-from-impact/get-client-border-box-center/get-client-from-page-border-box-center.d.ts +9 -0
- package/dist/types/state/get-center-from-impact/get-client-border-box-center/index.d.ts +12 -0
- package/dist/types/state/get-center-from-impact/get-page-border-box-center/index.d.ts +11 -0
- package/dist/types/state/get-center-from-impact/get-page-border-box-center/when-combining.d.ts +9 -0
- package/dist/types/state/get-center-from-impact/get-page-border-box-center/when-reordering.d.ts +11 -0
- package/dist/types/state/get-center-from-impact/move-relative-to.d.ts +16 -0
- package/dist/types/state/get-combined-item-displacement.d.ts +10 -0
- package/dist/types/state/get-displaced-by.d.ts +4 -0
- package/dist/types/state/get-displacement-groups.d.ts +12 -0
- package/dist/types/state/get-drag-impact/get-combine-impact.d.ts +13 -0
- package/dist/types/state/get-drag-impact/get-reorder-impact.d.ts +13 -0
- package/dist/types/state/get-drag-impact/index.d.ts +13 -0
- package/dist/types/state/get-draggables-inside-droppable.d.ts +3 -0
- package/dist/types/state/get-droppable-over.d.ts +9 -0
- package/dist/types/state/get-frame.d.ts +3 -0
- package/dist/types/state/get-home-location.d.ts +3 -0
- package/dist/types/state/get-impact-location.d.ts +3 -0
- package/dist/types/state/get-is-displaced.d.ts +7 -0
- package/dist/types/state/get-lift-effect.d.ts +13 -0
- package/dist/types/state/get-max-scroll.d.ts +9 -0
- package/dist/types/state/is-movement-allowed.d.ts +2 -0
- package/dist/types/state/is-within.d.ts +2 -0
- package/dist/types/state/middleware/auto-scroll.d.ts +4 -0
- package/dist/types/state/middleware/dimension-marshal-stopper.d.ts +4 -0
- package/dist/types/state/middleware/drop/drop-animation-finish-middleware.d.ts +3 -0
- package/dist/types/state/middleware/drop/drop-animation-flush-on-scroll-middleware.d.ts +3 -0
- package/dist/types/state/middleware/drop/drop-middleware.d.ts +3 -0
- package/dist/types/state/middleware/drop/get-drop-duration.d.ts +9 -0
- package/dist/types/state/middleware/drop/get-drop-impact.d.ts +16 -0
- package/dist/types/state/middleware/drop/get-new-home-client-offset.d.ts +11 -0
- package/dist/types/state/middleware/drop/index.d.ts +1 -0
- package/dist/types/state/middleware/focus.d.ts +4 -0
- package/dist/types/state/middleware/lift.d.ts +4 -0
- package/dist/types/state/middleware/pending-drop.d.ts +3 -0
- package/dist/types/state/middleware/responders/async-marshal.d.ts +9 -0
- package/dist/types/state/middleware/responders/expiring-announce.d.ts +6 -0
- package/dist/types/state/middleware/responders/index.d.ts +1 -0
- package/dist/types/state/middleware/responders/is-equal.d.ts +4 -0
- package/dist/types/state/middleware/responders/publisher.d.ts +17 -0
- package/dist/types/state/middleware/responders/responders-middleware.d.ts +4 -0
- package/dist/types/state/middleware/scroll-listener.d.ts +3 -0
- package/dist/types/state/middleware/style.d.ts +4 -0
- package/dist/types/state/middleware/util/validate-dimensions.d.ts +2 -0
- package/dist/types/state/move-in-direction/index.d.ts +8 -0
- package/dist/types/state/move-in-direction/move-cross-axis/get-best-cross-axis-droppable.d.ts +11 -0
- package/dist/types/state/move-in-direction/move-cross-axis/get-closest-draggable.d.ts +11 -0
- package/dist/types/state/move-in-direction/move-cross-axis/index.d.ts +15 -0
- package/dist/types/state/move-in-direction/move-cross-axis/move-to-new-droppable.d.ts +14 -0
- package/dist/types/state/move-in-direction/move-cross-axis/without-starting-displacement.d.ts +4 -0
- package/dist/types/state/move-in-direction/move-in-direction-types.d.ts +7 -0
- package/dist/types/state/move-in-direction/move-to-next-place/index.d.ts +16 -0
- package/dist/types/state/move-in-direction/move-to-next-place/is-totally-visible-in-new-location.d.ts +12 -0
- package/dist/types/state/move-in-direction/move-to-next-place/move-to-next-combine/index.d.ts +10 -0
- package/dist/types/state/move-in-direction/move-to-next-place/move-to-next-index/from-combine.d.ts +11 -0
- package/dist/types/state/move-in-direction/move-to-next-place/move-to-next-index/from-reorder.d.ts +9 -0
- package/dist/types/state/move-in-direction/move-to-next-place/move-to-next-index/index.d.ts +14 -0
- package/dist/types/state/no-impact.d.ts +6 -0
- package/dist/types/state/patch-dimension-map.d.ts +3 -0
- package/dist/types/state/patch-droppable-map.d.ts +3 -0
- package/dist/types/state/position.d.ts +10 -0
- package/dist/types/state/post-reducer/when-moving/refresh-snap.d.ts +8 -0
- package/dist/types/state/post-reducer/when-moving/update.d.ts +12 -0
- package/dist/types/state/publish-while-dragging-in-virtual/adjust-additions-for-scroll-changes.d.ts +8 -0
- package/dist/types/state/publish-while-dragging-in-virtual/index.d.ts +7 -0
- package/dist/types/state/publish-while-dragging-in-virtual/offset-draggable.d.ts +9 -0
- package/dist/types/state/recompute-placeholders.d.ts +10 -0
- package/dist/types/state/rect.d.ts +2 -0
- package/dist/types/state/reducer.d.ts +5 -0
- package/dist/types/state/registry/create-registry.d.ts +2 -0
- package/dist/types/state/registry/registry-types.d.ts +62 -0
- package/dist/types/state/registry/use-registry.d.ts +2 -0
- package/dist/types/state/remove-draggable-from-list.d.ts +3 -0
- package/dist/types/state/scroll-viewport.d.ts +4 -0
- package/dist/types/state/spacing.d.ts +6 -0
- package/dist/types/state/store-types.d.ts +10 -0
- package/dist/types/state/update-displacement-visibility/recompute.d.ts +10 -0
- package/dist/types/state/update-displacement-visibility/speculatively-increase.d.ts +11 -0
- package/dist/types/state/visibility/is-partially-visible-through-frame.d.ts +3 -0
- package/dist/types/state/visibility/is-position-in-frame.d.ts +2 -0
- package/dist/types/state/visibility/is-totally-visible-through-frame-on-axis.d.ts +4 -0
- package/dist/types/state/visibility/is-totally-visible-through-frame.d.ts +3 -0
- package/dist/types/state/visibility/is-visible.d.ts +13 -0
- package/dist/types/state/with-scroll-change/with-all-displacement.d.ts +4 -0
- package/dist/types/state/with-scroll-change/with-droppable-displacement.d.ts +4 -0
- package/dist/types/state/with-scroll-change/with-droppable-scroll.d.ts +4 -0
- package/dist/types/state/with-scroll-change/with-viewport-displacement.d.ts +4 -0
- package/dist/types/types.d.ts +323 -0
- package/dist/types/view/animate-in-out/animate-in-out.d.ts +24 -0
- package/dist/types/view/animate-in-out/index.d.ts +1 -0
- package/dist/types/view/check-is-valid-inner-ref.d.ts +1 -0
- package/dist/types/view/context/app-context.d.ts +16 -0
- package/dist/types/view/context/droppable-context.d.ts +9 -0
- package/dist/types/view/context/hooks.d.ts +3 -0
- package/dist/types/view/context/store-context.d.ts +4 -0
- package/dist/types/view/data-attributes.d.ts +22 -0
- package/dist/types/view/drag-drop-context/app.d.ts +13 -0
- package/dist/types/view/drag-drop-context/check-doctype.d.ts +2 -0
- package/dist/types/view/drag-drop-context/check-react-version.d.ts +2 -0
- package/dist/types/view/drag-drop-context/drag-drop-context-types.d.ts +5 -0
- package/dist/types/view/drag-drop-context/drag-drop-context.d.ts +12 -0
- package/dist/types/view/drag-drop-context/error-boundary.d.ts +20 -0
- package/dist/types/view/drag-drop-context/index.d.ts +1 -0
- package/dist/types/view/drag-drop-context/use-startup-validation.d.ts +1 -0
- package/dist/types/view/drag-drop-context/use-unique-context-id.d.ts +3 -0
- package/dist/types/view/draggable/connected-draggable.d.ts +5 -0
- package/dist/types/view/draggable/draggable-api.d.ts +3 -0
- package/dist/types/view/draggable/draggable-types.d.ts +106 -0
- package/dist/types/view/draggable/draggable.d.ts +2 -0
- package/dist/types/view/draggable/get-style.d.ts +3 -0
- package/dist/types/view/draggable/index.d.ts +1 -0
- package/dist/types/view/draggable/use-validation.d.ts +4 -0
- package/dist/types/view/droppable/connected-droppable.d.ts +7 -0
- package/dist/types/view/droppable/droppable-types.d.ts +50 -0
- package/dist/types/view/droppable/droppable.d.ts +2 -0
- package/dist/types/view/droppable/index.d.ts +1 -0
- package/dist/types/view/droppable/use-validation.d.ts +8 -0
- package/dist/types/view/event-bindings/bind-events.d.ts +2 -0
- package/dist/types/view/event-bindings/event-types.d.ts +10 -0
- package/dist/types/view/get-body-element.d.ts +2 -0
- package/dist/types/view/get-border-box-center-position.d.ts +3 -0
- package/dist/types/view/get-document-element.d.ts +2 -0
- package/dist/types/view/get-elements/find-drag-handle.d.ts +2 -0
- package/dist/types/view/get-elements/find-draggable.d.ts +2 -0
- package/dist/types/view/is-strict-equal.d.ts +2 -0
- package/dist/types/view/is-type-of-element/is-element.d.ts +1 -0
- package/dist/types/view/is-type-of-element/is-html-element.d.ts +1 -0
- package/dist/types/view/is-type-of-element/is-svg-element.d.ts +1 -0
- package/dist/types/view/key-codes.d.ts +12 -0
- package/dist/types/view/placeholder/index.d.ts +1 -0
- package/dist/types/view/placeholder/placeholder-types.d.ts +14 -0
- package/dist/types/view/placeholder/placeholder.d.ts +28 -0
- package/dist/types/view/scroll-listener.d.ts +12 -0
- package/dist/types/view/throw-if-invalid-inner-ref.d.ts +2 -0
- package/dist/types/view/use-announcer/index.d.ts +1 -0
- package/dist/types/view/use-announcer/use-announcer.d.ts +3 -0
- package/dist/types/view/use-dev-setup-warning.d.ts +1 -0
- package/dist/types/view/use-dev.d.ts +1 -0
- package/dist/types/view/use-draggable-publisher/get-dimension.d.ts +3 -0
- package/dist/types/view/use-draggable-publisher/index.d.ts +1 -0
- package/dist/types/view/use-draggable-publisher/use-draggable-publisher.d.ts +8 -0
- package/dist/types/view/use-droppable-publisher/check-for-nested-scroll-container.d.ts +2 -0
- package/dist/types/view/use-droppable-publisher/get-closest-scrollable.d.ts +2 -0
- package/dist/types/view/use-droppable-publisher/get-dimension.d.ts +15 -0
- package/dist/types/view/use-droppable-publisher/get-env.d.ts +6 -0
- package/dist/types/view/use-droppable-publisher/get-listener-options.d.ts +5 -0
- package/dist/types/view/use-droppable-publisher/get-scroll.d.ts +3 -0
- package/dist/types/view/use-droppable-publisher/index.d.ts +1 -0
- package/dist/types/view/use-droppable-publisher/is-in-fixed-container.d.ts +2 -0
- package/dist/types/view/use-droppable-publisher/use-droppable-publisher.d.ts +13 -0
- package/dist/types/view/use-focus-marshal/focus-marshal-types.d.ts +9 -0
- package/dist/types/view/use-focus-marshal/index.d.ts +1 -0
- package/dist/types/view/use-focus-marshal/use-focus-marshal.d.ts +3 -0
- package/dist/types/view/use-hidden-text-element/index.d.ts +1 -0
- package/dist/types/view/use-hidden-text-element/use-hidden-text-element.d.ts +12 -0
- package/dist/types/view/use-isomorphic-layout-effect.d.ts +3 -0
- package/dist/types/view/use-previous-ref.d.ts +1 -0
- package/dist/types/view/use-required-context.d.ts +2 -0
- package/dist/types/view/use-sensor-marshal/closest.d.ts +1 -0
- package/dist/types/view/use-sensor-marshal/find-closest-draggable-id-from-event.d.ts +2 -0
- package/dist/types/view/use-sensor-marshal/index.d.ts +4 -0
- package/dist/types/view/use-sensor-marshal/is-event-in-interactive-element.d.ts +5 -0
- package/dist/types/view/use-sensor-marshal/lock.d.ts +11 -0
- package/dist/types/view/use-sensor-marshal/sensors/use-keyboard-sensor.d.ts +2 -0
- package/dist/types/view/use-sensor-marshal/sensors/use-mouse-sensor.d.ts +4 -0
- package/dist/types/view/use-sensor-marshal/sensors/use-touch-sensor.d.ts +4 -0
- package/dist/types/view/use-sensor-marshal/sensors/util/prevent-standard-key-events.d.ts +2 -0
- package/dist/types/view/use-sensor-marshal/sensors/util/supported-page-visibility-event-name.d.ts +2 -0
- package/dist/types/view/use-sensor-marshal/use-sensor-marshal.d.ts +12 -0
- package/dist/types/view/use-sensor-marshal/use-validate-sensor-hooks.d.ts +2 -0
- package/dist/types/view/use-style-marshal/get-styles.d.ts +10 -0
- package/dist/types/view/use-style-marshal/index.d.ts +1 -0
- package/dist/types/view/use-style-marshal/style-marshal-types.d.ts +6 -0
- package/dist/types/view/use-style-marshal/use-style-marshal.d.ts +3 -0
- package/dist/types/view/use-unique-id.d.ts +7 -0
- package/dist/types/view/visually-hidden-style.d.ts +2 -0
- package/dist/types/view/window/get-max-window-scroll.d.ts +3 -0
- package/dist/types/view/window/get-viewport.d.ts +3 -0
- package/dist/types/view/window/get-window-from-el.d.ts +2 -0
- package/dist/types/view/window/get-window-scroll.d.ts +3 -0
- package/dist/types/view/window/scroll-window.d.ts +3 -0
- package/package.json +157 -4
- package/src/animation.ts +75 -0
- package/src/debug/middleware/action-timing-average.ts +52 -0
- package/src/debug/middleware/action-timing.ts +16 -0
- package/src/debug/middleware/log.ts +26 -0
- package/src/debug/middleware/user-timing.ts +16 -0
- package/src/debug/timings.ts +87 -0
- package/src/dev-warning.ts +50 -0
- package/src/empty.ts +6 -0
- package/src/index.ts +67 -0
- package/src/invariant.ts +64 -0
- package/src/native-with-fallback.ts +69 -0
- package/src/screen-reader-message-preset.ts +135 -0
- package/src/state/action-creators.ts +358 -0
- package/src/state/auto-scroller/auto-scroller-types.ts +8 -0
- package/src/state/auto-scroller/can-scroll.ts +320 -0
- package/src/state/auto-scroller/fluid-scroller/config.ts +25 -0
- package/src/state/auto-scroller/fluid-scroller/did-start-in-scrollable-area.ts +1 -0
- package/src/state/auto-scroller/fluid-scroller/get-best-scrollable-droppable.ts +77 -0
- package/src/state/auto-scroller/fluid-scroller/get-droppable-scroll-change.ts +39 -0
- package/src/state/auto-scroller/fluid-scroller/get-percentage.ts +25 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/adjust-for-size-limits.ts +30 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/dampen-value-by-time.ts +37 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-distance-thresholds.ts +25 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-value-from-distance.ts +61 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/get-value.ts +39 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/index.ts +46 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/get-scroll-on-axis/min-scroll.ts +4 -0
- package/src/state/auto-scroller/fluid-scroller/get-scroll/index.ts +76 -0
- package/src/state/auto-scroller/fluid-scroller/get-window-scroll-change.ts +31 -0
- package/src/state/auto-scroller/fluid-scroller/index.ts +91 -0
- package/src/state/auto-scroller/fluid-scroller/scroll.ts +72 -0
- package/src/state/auto-scroller/index.ts +56 -0
- package/src/state/auto-scroller/jump-scroller.ts +140 -0
- package/src/state/axis.ts +26 -0
- package/src/state/calculate-drag-impact/calculate-reorder-impact.ts +138 -0
- package/src/state/can-start-drag.ts +29 -0
- package/src/state/create-store.ts +98 -0
- package/src/state/did-start-after-critical.ts +9 -0
- package/src/state/dimension-marshal/dimension-marshal-types.ts +49 -0
- package/src/state/dimension-marshal/dimension-marshal.ts +219 -0
- package/src/state/dimension-marshal/get-initial-publish.ts +66 -0
- package/src/state/dimension-marshal/while-dragging-publisher.ts +146 -0
- package/src/state/dimension-structures.ts +35 -0
- package/src/state/droppable/get-droppable.ts +103 -0
- package/src/state/droppable/is-home-of.ts +7 -0
- package/src/state/droppable/scroll-droppable.ts +53 -0
- package/src/state/droppable/should-use-placeholder.ts +7 -0
- package/src/state/droppable/util/clip.ts +17 -0
- package/src/state/droppable/util/get-subject.ts +63 -0
- package/src/state/droppable/what-is-dragged-over-from-result.ts +16 -0
- package/src/state/droppable/what-is-dragged-over.ts +16 -0
- package/src/state/droppable/with-placeholder.ts +174 -0
- package/src/state/get-center-from-impact/get-client-border-box-center/get-client-from-page-border-box-center.ts +30 -0
- package/src/state/get-center-from-impact/get-client-border-box-center/index.ts +45 -0
- package/src/state/get-center-from-impact/get-page-border-box-center/index.ts +71 -0
- package/src/state/get-center-from-impact/get-page-border-box-center/when-combining.ts +40 -0
- package/src/state/get-center-from-impact/get-page-border-box-center/when-reordering.ts +113 -0
- package/src/state/get-center-from-impact/move-relative-to.ts +68 -0
- package/src/state/get-combined-item-displacement.ts +35 -0
- package/src/state/get-displaced-by.ts +17 -0
- package/src/state/get-displacement-groups.ts +131 -0
- package/src/state/get-drag-impact/get-combine-impact.ts +131 -0
- package/src/state/get-drag-impact/get-reorder-impact.ts +145 -0
- package/src/state/get-drag-impact/index.ts +94 -0
- package/src/state/get-draggables-inside-droppable.ts +31 -0
- package/src/state/get-droppable-over.ts +161 -0
- package/src/state/get-frame.ts +10 -0
- package/src/state/get-home-location.ts +7 -0
- package/src/state/get-impact-location.ts +16 -0
- package/src/state/get-is-displaced.ts +12 -0
- package/src/state/get-lift-effect.ts +84 -0
- package/src/state/get-max-scroll.ts +32 -0
- package/src/state/is-movement-allowed.ts +13 -0
- package/src/state/is-within.ts +9 -0
- package/src/state/middleware/auto-scroll.ts +38 -0
- package/src/state/middleware/dimension-marshal-stopper.ts +20 -0
- package/src/state/middleware/drop/drop-animation-finish-middleware.ts +21 -0
- package/src/state/middleware/drop/drop-animation-flush-on-scroll-middleware.ts +63 -0
- package/src/state/middleware/drop/drop-middleware.ts +146 -0
- package/src/state/middleware/drop/get-drop-duration.ts +48 -0
- package/src/state/middleware/drop/get-drop-impact.ts +79 -0
- package/src/state/middleware/drop/get-new-home-client-offset.ts +55 -0
- package/src/state/middleware/drop/index.ts +2 -0
- package/src/state/middleware/focus.ts +42 -0
- package/src/state/middleware/lift.ts +66 -0
- package/src/state/middleware/pending-drop.ts +37 -0
- package/src/state/middleware/responders/async-marshal.ts +58 -0
- package/src/state/middleware/responders/expiring-announce.ts +44 -0
- package/src/state/middleware/responders/index.ts +2 -0
- package/src/state/middleware/responders/is-equal.ts +57 -0
- package/src/state/middleware/responders/publisher.ts +255 -0
- package/src/state/middleware/responders/responders-middleware.ts +81 -0
- package/src/state/middleware/scroll-listener.ts +31 -0
- package/src/state/middleware/style.ts +22 -0
- package/src/state/middleware/util/validate-dimensions.ts +71 -0
- package/src/state/move-in-direction/index.ts +85 -0
- package/src/state/move-in-direction/move-cross-axis/get-best-cross-axis-droppable.ts +169 -0
- package/src/state/move-in-direction/move-cross-axis/get-closest-draggable.ts +80 -0
- package/src/state/move-in-direction/move-cross-axis/index.ts +110 -0
- package/src/state/move-in-direction/move-cross-axis/move-to-new-droppable.ts +122 -0
- package/src/state/move-in-direction/move-cross-axis/without-starting-displacement.ts +31 -0
- package/src/state/move-in-direction/move-in-direction-types.ts +10 -0
- package/src/state/move-in-direction/move-to-next-place/index.ts +133 -0
- package/src/state/move-in-direction/move-to-next-place/is-totally-visible-in-new-location.ts +53 -0
- package/src/state/move-in-direction/move-to-next-place/move-to-next-combine/index.ts +98 -0
- package/src/state/move-in-direction/move-to-next-place/move-to-next-index/from-combine.ts +53 -0
- package/src/state/move-in-direction/move-to-next-place/move-to-next-index/from-reorder.ts +44 -0
- package/src/state/move-in-direction/move-to-next-place/move-to-next-index/index.ts +87 -0
- package/src/state/no-impact.ts +33 -0
- package/src/state/patch-dimension-map.ts +11 -0
- package/src/state/patch-droppable-map.ts +10 -0
- package/src/state/position.ts +65 -0
- package/src/state/post-reducer/when-moving/refresh-snap.ts +68 -0
- package/src/state/post-reducer/when-moving/update.ts +121 -0
- package/src/state/publish-while-dragging-in-virtual/adjust-additions-for-scroll-changes.ts +59 -0
- package/src/state/publish-while-dragging-in-virtual/index.ts +159 -0
- package/src/state/publish-while-dragging-in-virtual/offset-draggable.ts +36 -0
- package/src/state/recompute-placeholders.ts +101 -0
- package/src/state/rect.ts +7 -0
- package/src/state/reducer.ts +467 -0
- package/src/state/registry/create-registry.ts +162 -0
- package/src/state/registry/registry-types.ts +106 -0
- package/src/state/registry/use-registry.ts +20 -0
- package/src/state/remove-draggable-from-list.ts +13 -0
- package/src/state/scroll-viewport.ts +34 -0
- package/src/state/spacing.ts +45 -0
- package/src/state/store-types.ts +19 -0
- package/src/state/update-displacement-visibility/recompute.ts +55 -0
- package/src/state/update-displacement-visibility/speculatively-increase.ts +112 -0
- package/src/state/visibility/is-partially-visible-through-frame.ts +60 -0
- package/src/state/visibility/is-position-in-frame.ts +12 -0
- package/src/state/visibility/is-totally-visible-through-frame-on-axis.ts +19 -0
- package/src/state/visibility/is-totally-visible-through-frame.ts +18 -0
- package/src/state/visibility/is-visible.ts +102 -0
- package/src/state/with-scroll-change/with-all-displacement.ts +15 -0
- package/src/state/with-scroll-change/with-droppable-displacement.ts +13 -0
- package/src/state/with-scroll-change/with-droppable-scroll.ts +13 -0
- package/src/state/with-scroll-change/with-viewport-displacement.ts +7 -0
- package/src/types/redux-devtools.d.ts +17 -0
- package/src/types.ts +495 -0
- package/src/view/animate-in-out/animate-in-out.tsx +98 -0
- package/src/view/animate-in-out/index.ts +2 -0
- package/src/view/check-is-valid-inner-ref.ts +15 -0
- package/src/view/context/app-context.ts +19 -0
- package/src/view/context/droppable-context.ts +12 -0
- package/src/view/context/hooks.ts +21 -0
- package/src/view/context/store-context.ts +8 -0
- package/src/view/data-attributes.ts +37 -0
- package/src/view/drag-drop-context/app.tsx +300 -0
- package/src/view/drag-drop-context/check-doctype.ts +39 -0
- package/src/view/drag-drop-context/check-react-version.ts +72 -0
- package/src/view/drag-drop-context/drag-drop-context-types.ts +8 -0
- package/src/view/drag-drop-context/drag-drop-context.tsx +60 -0
- package/src/view/drag-drop-context/error-boundary.tsx +89 -0
- package/src/view/drag-drop-context/index.ts +2 -0
- package/src/view/drag-drop-context/use-startup-validation.ts +13 -0
- package/src/view/drag-drop-context/use-unique-context-id.ts +13 -0
- package/src/view/draggable/connected-draggable.tsx +420 -0
- package/src/view/draggable/draggable-api.tsx +48 -0
- package/src/view/draggable/draggable-types.ts +204 -0
- package/src/view/draggable/draggable.tsx +167 -0
- package/src/view/draggable/get-style.ts +109 -0
- package/src/view/draggable/index.ts +2 -0
- package/src/view/draggable/use-validation.ts +70 -0
- package/src/view/droppable/connected-droppable.tsx +597 -0
- package/src/view/droppable/droppable-types.ts +96 -0
- package/src/view/droppable/droppable.tsx +167 -0
- package/src/view/droppable/index.ts +2 -0
- package/src/view/droppable/use-validation.ts +102 -0
- package/src/view/event-bindings/bind-events.ts +39 -0
- package/src/view/event-bindings/event-types.ts +15 -0
- package/src/view/get-body-element.ts +8 -0
- package/src/view/get-border-box-center-position.ts +5 -0
- package/src/view/get-document-element.ts +8 -0
- package/src/view/get-elements/find-drag-handle.ts +38 -0
- package/src/view/get-elements/find-draggable.ts +30 -0
- package/src/view/is-strict-equal.ts +2 -0
- package/src/view/is-type-of-element/is-element.ts +10 -0
- package/src/view/is-type-of-element/is-html-element.ts +10 -0
- package/src/view/is-type-of-element/is-svg-element.ts +22 -0
- package/src/view/key-codes.ts +13 -0
- package/src/view/placeholder/index.ts +2 -0
- package/src/view/placeholder/placeholder-types.ts +16 -0
- package/src/view/placeholder/placeholder.tsx +204 -0
- package/src/view/scroll-listener.ts +74 -0
- package/src/view/throw-if-invalid-inner-ref.ts +15 -0
- package/src/view/use-announcer/index.ts +2 -0
- package/src/view/use-announcer/use-announcer.ts +80 -0
- package/src/view/use-dev-setup-warning.ts +22 -0
- package/src/view/use-dev.ts +9 -0
- package/src/view/use-draggable-publisher/get-dimension.ts +44 -0
- package/src/view/use-draggable-publisher/index.ts +2 -0
- package/src/view/use-draggable-publisher/use-draggable-publisher.ts +87 -0
- package/src/view/use-droppable-publisher/check-for-nested-scroll-container.ts +27 -0
- package/src/view/use-droppable-publisher/get-closest-scrollable.ts +96 -0
- package/src/view/use-droppable-publisher/get-dimension.ts +140 -0
- package/src/view/use-droppable-publisher/get-env.ts +32 -0
- package/src/view/use-droppable-publisher/get-listener-options.ts +12 -0
- package/src/view/use-droppable-publisher/get-scroll.ts +7 -0
- package/src/view/use-droppable-publisher/index.ts +2 -0
- package/src/view/use-droppable-publisher/is-in-fixed-container.ts +21 -0
- package/src/view/use-droppable-publisher/use-droppable-publisher.ts +288 -0
- package/src/view/use-focus-marshal/focus-marshal-types.ts +14 -0
- package/src/view/use-focus-marshal/index.ts +2 -0
- package/src/view/use-focus-marshal/use-focus-marshal.ts +128 -0
- package/src/view/use-hidden-text-element/index.ts +2 -0
- package/src/view/use-hidden-text-element/use-hidden-text-element.ts +62 -0
- package/src/view/use-isomorphic-layout-effect.ts +18 -0
- package/src/view/use-previous-ref.ts +26 -0
- package/src/view/use-required-context.ts +22 -0
- package/src/view/use-sensor-marshal/closest.ts +89 -0
- package/src/view/use-sensor-marshal/find-closest-draggable-id-from-event.ts +50 -0
- package/src/view/use-sensor-marshal/index.ts +5 -0
- package/src/view/use-sensor-marshal/is-event-in-interactive-element.ts +67 -0
- package/src/view/use-sensor-marshal/lock.ts +50 -0
- package/src/view/use-sensor-marshal/sensors/use-keyboard-sensor.ts +243 -0
- package/src/view/use-sensor-marshal/sensors/use-mouse-sensor.ts +391 -0
- package/src/view/use-sensor-marshal/sensors/use-touch-sensor.ts +481 -0
- package/src/view/use-sensor-marshal/sensors/util/prevent-standard-key-events.ts +19 -0
- package/src/view/use-sensor-marshal/sensors/util/supported-page-visibility-event-name.ts +29 -0
- package/src/view/use-sensor-marshal/use-sensor-marshal.ts +504 -0
- package/src/view/use-sensor-marshal/use-validate-sensor-hooks.ts +20 -0
- package/src/view/use-style-marshal/get-styles.ts +173 -0
- package/src/view/use-style-marshal/index.ts +2 -0
- package/src/view/use-style-marshal/style-marshal-types.ts +9 -0
- package/src/view/use-style-marshal/use-style-marshal.ts +126 -0
- package/src/view/use-unique-id.ts +25 -0
- package/src/view/visually-hidden-style.ts +16 -0
- package/src/view/window/get-max-window-scroll.ts +19 -0
- package/src/view/window/get-viewport.ts +49 -0
- package/src/view/window/get-window-from-el.ts +12 -0
- package/src/view/window/get-window-scroll.ts +30 -0
- package/src/view/window/scroll-window.ts +7 -0
package/src/invariant.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
/* eslint-disable no-restricted-syntax */
|
|
3
|
+
const isProduction: boolean = process.env.NODE_ENV === 'production';
|
|
4
|
+
const prefix: string = 'Invariant failed';
|
|
5
|
+
|
|
6
|
+
// Want to use this:
|
|
7
|
+
// export class RbdInvariant extends Error { }
|
|
8
|
+
// But it causes babel to bring in a lot of code
|
|
9
|
+
|
|
10
|
+
// export function RbdInvariant(message: string) {
|
|
11
|
+
// this.message = message;
|
|
12
|
+
// }
|
|
13
|
+
// // $FlowFixMe
|
|
14
|
+
// RbdInvariant.prototype.toString = function toString() {
|
|
15
|
+
// return this.message;
|
|
16
|
+
// };
|
|
17
|
+
|
|
18
|
+
// // A copy-paste of tiny-invariant but with a custom error type
|
|
19
|
+
// // Throw an error if the condition fails
|
|
20
|
+
// export function invariant(condition: unknown, message?: string) {
|
|
21
|
+
// if (condition) {
|
|
22
|
+
// return;
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
// if (isProduction) {
|
|
26
|
+
// // In production we strip the message but still throw
|
|
27
|
+
// throw new RbdInvariant(prefix);
|
|
28
|
+
// } else {
|
|
29
|
+
// // When not in production we allow the message to pass through
|
|
30
|
+
// // *This block will be removed in production builds*
|
|
31
|
+
// throw new RbdInvariant(`${prefix}: ${message || ''}`);
|
|
32
|
+
// }
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export class RbdInvariant extends Error {
|
|
37
|
+
constructor(message: string) {
|
|
38
|
+
super(message);
|
|
39
|
+
|
|
40
|
+
this.name = 'RbdInvariant';
|
|
41
|
+
|
|
42
|
+
// Required for correct prototype chain in some JS targets
|
|
43
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// A copy-paste of tiny-invariant but with a custom error type
|
|
48
|
+
// Throw an error if the condition fails
|
|
49
|
+
export function invariant(
|
|
50
|
+
condition: unknown,
|
|
51
|
+
message?: string,
|
|
52
|
+
): asserts condition {
|
|
53
|
+
if (condition) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (isProduction) {
|
|
58
|
+
// In production we strip the message but still throw
|
|
59
|
+
throw new RbdInvariant(prefix);
|
|
60
|
+
} else {
|
|
61
|
+
// In development we allow the message to pass through
|
|
62
|
+
throw new RbdInvariant(`${prefix}: ${message || ''}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
/* eslint-disable es5/no-es6-methods */
|
|
3
|
+
/* eslint-disable es5/no-es6-static-methods */
|
|
4
|
+
/* eslint-disable no-restricted-globals */
|
|
5
|
+
|
|
6
|
+
type Map<T> = {
|
|
7
|
+
[key: string]: T,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function isInteger(value: unknown): boolean {
|
|
11
|
+
if (Number.isInteger) {
|
|
12
|
+
return Number.isInteger(value);
|
|
13
|
+
}
|
|
14
|
+
return (
|
|
15
|
+
typeof value === 'number' && isFinite(value) && Math.floor(value) === value
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Using this helper to ensure there are correct flow types
|
|
20
|
+
// https://github.com/facebook/flow/issues/2221
|
|
21
|
+
export function values<T>(map: Map<T>): T[] {
|
|
22
|
+
if (Object.values) {
|
|
23
|
+
// $FlowFixMe - Object.values currently does not have good flow support
|
|
24
|
+
return Object.values(map);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return Object.keys(map).map((key) => map[key]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Could also extend to pass index and list
|
|
31
|
+
type PredicateFn<T> = (value: T) => boolean;
|
|
32
|
+
|
|
33
|
+
// TODO: swap order
|
|
34
|
+
export function findIndex<T>(
|
|
35
|
+
list: Array<T>,
|
|
36
|
+
predicate: PredicateFn<T>,
|
|
37
|
+
): number {
|
|
38
|
+
if (list.findIndex) {
|
|
39
|
+
return list.findIndex(predicate);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Using a for loop so that we can exit early
|
|
43
|
+
for (let i = 0; i < list.length; i++) {
|
|
44
|
+
if (predicate(list[i])) {
|
|
45
|
+
return i;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Array.prototype.find returns -1 when nothing is found
|
|
49
|
+
return -1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function find<T>(list: Array<T>, predicate: PredicateFn<T>): T | undefined {
|
|
53
|
+
if (list.find) {
|
|
54
|
+
return list.find(predicate);
|
|
55
|
+
}
|
|
56
|
+
const index: number = findIndex(list, predicate);
|
|
57
|
+
if (index !== -1) {
|
|
58
|
+
return list[index];
|
|
59
|
+
}
|
|
60
|
+
// Array.prototype.find returns undefined when nothing is found
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Using this rather than Array.from as Array.from adds 2kb to the gzip
|
|
65
|
+
// document.querySelector actually returns Element[], but flow thinks it is HTMLElement[]
|
|
66
|
+
// So we downcast the result to Element[]
|
|
67
|
+
export function toArray(list: NodeListOf<HTMLElement>): Element[] {
|
|
68
|
+
return Array.prototype.slice.call(list);
|
|
69
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import type {
|
|
3
|
+
DraggableId,
|
|
4
|
+
DragStart,
|
|
5
|
+
DragUpdate,
|
|
6
|
+
DropResult,
|
|
7
|
+
DraggableLocation,
|
|
8
|
+
Combine,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
// Exact
|
|
12
|
+
export type MessagePreset = {
|
|
13
|
+
dragHandleUsageInstructions: string,
|
|
14
|
+
onDragStart: (start: DragStart) => string,
|
|
15
|
+
onDragUpdate: (update: DragUpdate) => string,
|
|
16
|
+
onDragEnd: (result: DropResult) => string,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const dragHandleUsageInstructions: string = `
|
|
20
|
+
Press space bar to start a drag.
|
|
21
|
+
When dragging you can use the arrow keys to move the item around and escape to cancel.
|
|
22
|
+
Some screen readers may require you to be in focus mode or to use your pass through key
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const position = (index: number): number => index + 1;
|
|
26
|
+
|
|
27
|
+
// We cannot list what index the Droppable is in automatically as we are not sure how
|
|
28
|
+
// the Droppable's have been configured
|
|
29
|
+
const onDragStart = (start: DragStart): string => `
|
|
30
|
+
You have lifted an item in position ${position(start.source.index)}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const withLocation = (
|
|
34
|
+
source: DraggableLocation,
|
|
35
|
+
destination: DraggableLocation,
|
|
36
|
+
) => {
|
|
37
|
+
const isInHomeList: boolean = source.droppableId === destination.droppableId;
|
|
38
|
+
|
|
39
|
+
const startPosition: number = position(source.index);
|
|
40
|
+
const endPosition: number = position(destination.index);
|
|
41
|
+
|
|
42
|
+
if (isInHomeList) {
|
|
43
|
+
return `
|
|
44
|
+
You have moved the item from position ${startPosition}
|
|
45
|
+
to position ${endPosition}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return `
|
|
50
|
+
You have moved the item from position ${startPosition}
|
|
51
|
+
in list ${source.droppableId}
|
|
52
|
+
to list ${destination.droppableId}
|
|
53
|
+
in position ${endPosition}
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const withCombine = (
|
|
58
|
+
id: DraggableId,
|
|
59
|
+
source: DraggableLocation,
|
|
60
|
+
combine: Combine,
|
|
61
|
+
): string => {
|
|
62
|
+
const inHomeList: boolean = source.droppableId === combine.droppableId;
|
|
63
|
+
|
|
64
|
+
if (inHomeList) {
|
|
65
|
+
return `
|
|
66
|
+
The item ${id}
|
|
67
|
+
has been combined with ${combine.draggableId}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return `
|
|
71
|
+
The item ${id}
|
|
72
|
+
in list ${source.droppableId}
|
|
73
|
+
has been combined with ${combine.draggableId}
|
|
74
|
+
in list ${combine.droppableId}
|
|
75
|
+
`;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const onDragUpdate = (update: DragUpdate): string => {
|
|
79
|
+
const location: DraggableLocation | null = update.destination;
|
|
80
|
+
if (location) {
|
|
81
|
+
return withLocation(update.source, location);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const combine: Combine | null = update.combine;
|
|
85
|
+
if (combine) {
|
|
86
|
+
return withCombine(update.draggableId, update.source, combine);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return 'You are over an area that cannot be dropped on';
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const returnedToStart = (source: DraggableLocation): string => `
|
|
93
|
+
The item has returned to its starting position
|
|
94
|
+
of ${position(source.index)}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const onDragEnd = (result: DropResult): string => {
|
|
98
|
+
if (result.reason === 'CANCEL') {
|
|
99
|
+
return `
|
|
100
|
+
Movement cancelled.
|
|
101
|
+
${returnedToStart(result.source)}
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const location: DraggableLocation | null = result.destination;
|
|
106
|
+
const combine: Combine | null = result.combine;
|
|
107
|
+
|
|
108
|
+
if (location) {
|
|
109
|
+
return `
|
|
110
|
+
You have dropped the item.
|
|
111
|
+
${withLocation(result.source, location)}
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (combine) {
|
|
116
|
+
return `
|
|
117
|
+
You have dropped the item.
|
|
118
|
+
${withCombine(result.draggableId, result.source, combine)}
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return `
|
|
123
|
+
The item has been dropped while not over a drop area.
|
|
124
|
+
${returnedToStart(result.source)}
|
|
125
|
+
`;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const preset: MessagePreset = {
|
|
129
|
+
dragHandleUsageInstructions,
|
|
130
|
+
onDragStart,
|
|
131
|
+
onDragUpdate,
|
|
132
|
+
onDragEnd,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default preset;
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import type { Position } from 'css-box-model';
|
|
3
|
+
import type {
|
|
4
|
+
Critical,
|
|
5
|
+
DraggableId,
|
|
6
|
+
DroppableId,
|
|
7
|
+
CompletedDrag,
|
|
8
|
+
MovementMode,
|
|
9
|
+
Viewport,
|
|
10
|
+
DimensionMap,
|
|
11
|
+
DropReason,
|
|
12
|
+
Published,
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
// Exact
|
|
16
|
+
export type BeforeInitialCaptureArgs = {
|
|
17
|
+
draggableId: DraggableId,
|
|
18
|
+
movementMode: MovementMode,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Exact
|
|
22
|
+
export type BeforeInitialCaptureAction = {
|
|
23
|
+
type: 'BEFORE_INITIAL_CAPTURE',
|
|
24
|
+
payload: BeforeInitialCaptureArgs,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const beforeInitialCapture = (
|
|
28
|
+
args: BeforeInitialCaptureArgs,
|
|
29
|
+
): BeforeInitialCaptureAction => ({
|
|
30
|
+
type: 'BEFORE_INITIAL_CAPTURE',
|
|
31
|
+
payload: args,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Exact
|
|
35
|
+
export type LiftArgs = {
|
|
36
|
+
// lifting with DraggableId rather than descriptor
|
|
37
|
+
// as the descriptor might change after a drop is flushed
|
|
38
|
+
id: DraggableId,
|
|
39
|
+
clientSelection: Position,
|
|
40
|
+
movementMode: MovementMode,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Exact
|
|
44
|
+
export type LiftAction = {
|
|
45
|
+
type: 'LIFT',
|
|
46
|
+
payload: LiftArgs,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const lift = (args: LiftArgs): LiftAction => ({
|
|
50
|
+
type: 'LIFT',
|
|
51
|
+
payload: args,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Exact
|
|
55
|
+
export type InitialPublishArgs = {
|
|
56
|
+
critical: Critical,
|
|
57
|
+
dimensions: DimensionMap,
|
|
58
|
+
clientSelection: Position,
|
|
59
|
+
viewport: Viewport,
|
|
60
|
+
movementMode: MovementMode,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Exact
|
|
64
|
+
export type InitialPublishAction = {
|
|
65
|
+
type: 'INITIAL_PUBLISH',
|
|
66
|
+
payload: InitialPublishArgs,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const initialPublish = (
|
|
70
|
+
args: InitialPublishArgs,
|
|
71
|
+
): InitialPublishAction => ({
|
|
72
|
+
type: 'INITIAL_PUBLISH',
|
|
73
|
+
payload: args,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Exact
|
|
77
|
+
export type WhileDraggingPublishAction = {
|
|
78
|
+
type: 'PUBLISH_WHILE_DRAGGING',
|
|
79
|
+
payload: Published,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const publishWhileDragging = (
|
|
83
|
+
args: Published,
|
|
84
|
+
): WhileDraggingPublishAction => ({
|
|
85
|
+
type: 'PUBLISH_WHILE_DRAGGING',
|
|
86
|
+
payload: args,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Exact
|
|
90
|
+
export type CollectionStartingAction = {
|
|
91
|
+
type: 'COLLECTION_STARTING',
|
|
92
|
+
payload: null,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const collectionStarting = (): CollectionStartingAction => ({
|
|
96
|
+
type: 'COLLECTION_STARTING',
|
|
97
|
+
payload: null,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export type UpdateDroppableScrollArgs = {
|
|
101
|
+
id: DroppableId,
|
|
102
|
+
newScroll: Position,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Exact
|
|
106
|
+
export type UpdateDroppableScrollAction = {
|
|
107
|
+
type: 'UPDATE_DROPPABLE_SCROLL',
|
|
108
|
+
payload: UpdateDroppableScrollArgs,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const updateDroppableScroll = (
|
|
112
|
+
args: UpdateDroppableScrollArgs,
|
|
113
|
+
): UpdateDroppableScrollAction => ({
|
|
114
|
+
type: 'UPDATE_DROPPABLE_SCROLL',
|
|
115
|
+
payload: args,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Exact
|
|
119
|
+
export type UpdateDroppableIsEnabledArgs = {
|
|
120
|
+
id: DroppableId,
|
|
121
|
+
isEnabled: boolean,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Exact
|
|
125
|
+
export type UpdateDroppableIsEnabledAction = {
|
|
126
|
+
type: 'UPDATE_DROPPABLE_IS_ENABLED',
|
|
127
|
+
payload: UpdateDroppableIsEnabledArgs,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const updateDroppableIsEnabled = (
|
|
131
|
+
args: UpdateDroppableIsEnabledArgs,
|
|
132
|
+
): UpdateDroppableIsEnabledAction => ({
|
|
133
|
+
type: 'UPDATE_DROPPABLE_IS_ENABLED',
|
|
134
|
+
payload: args,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Exact
|
|
138
|
+
export type UpdateDroppableIsCombineEnabledArgs = {
|
|
139
|
+
id: DroppableId,
|
|
140
|
+
isCombineEnabled: boolean,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// Exact
|
|
144
|
+
export type UpdateDroppableIsCombineEnabledAction = {
|
|
145
|
+
type: 'UPDATE_DROPPABLE_IS_COMBINE_ENABLED',
|
|
146
|
+
payload: UpdateDroppableIsCombineEnabledArgs,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const updateDroppableIsCombineEnabled = (
|
|
150
|
+
args: UpdateDroppableIsCombineEnabledArgs,
|
|
151
|
+
): UpdateDroppableIsCombineEnabledAction => ({
|
|
152
|
+
type: 'UPDATE_DROPPABLE_IS_COMBINE_ENABLED',
|
|
153
|
+
payload: args,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Exact
|
|
157
|
+
export type MoveArgs = {
|
|
158
|
+
client: Position,
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Exact
|
|
162
|
+
export type MoveAction = {
|
|
163
|
+
type: 'MOVE',
|
|
164
|
+
payload: MoveArgs,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const move = (args: MoveArgs): MoveAction => ({
|
|
168
|
+
type: 'MOVE',
|
|
169
|
+
payload: args,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Exact
|
|
173
|
+
type MoveByWindowScrollArgs = {
|
|
174
|
+
newScroll: Position,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Exact
|
|
178
|
+
export type MoveByWindowScrollAction = {
|
|
179
|
+
type: 'MOVE_BY_WINDOW_SCROLL',
|
|
180
|
+
payload: MoveByWindowScrollArgs,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const moveByWindowScroll = (
|
|
184
|
+
args: MoveByWindowScrollArgs,
|
|
185
|
+
): MoveByWindowScrollAction => ({
|
|
186
|
+
type: 'MOVE_BY_WINDOW_SCROLL',
|
|
187
|
+
payload: args,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Exact
|
|
191
|
+
export type UpdateViewportMaxScrollArgs = {
|
|
192
|
+
maxScroll: Position,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Exact
|
|
196
|
+
type UpdateViewportMaxScrollAction = {
|
|
197
|
+
type: 'UPDATE_VIEWPORT_MAX_SCROLL',
|
|
198
|
+
payload: UpdateViewportMaxScrollArgs,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const updateViewportMaxScroll = (
|
|
202
|
+
args: UpdateViewportMaxScrollArgs,
|
|
203
|
+
): UpdateViewportMaxScrollAction => ({
|
|
204
|
+
type: 'UPDATE_VIEWPORT_MAX_SCROLL',
|
|
205
|
+
payload: args,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Exact
|
|
209
|
+
export type MoveUpAction = {
|
|
210
|
+
type: 'MOVE_UP',
|
|
211
|
+
payload: null,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const moveUp = (): MoveUpAction => ({
|
|
215
|
+
type: 'MOVE_UP',
|
|
216
|
+
payload: null,
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Exact
|
|
220
|
+
export type MoveDownAction = {
|
|
221
|
+
type: 'MOVE_DOWN',
|
|
222
|
+
payload: null,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export const moveDown = (): MoveDownAction => ({
|
|
226
|
+
type: 'MOVE_DOWN',
|
|
227
|
+
payload: null,
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Exact
|
|
231
|
+
export type MoveRightAction = {
|
|
232
|
+
type: 'MOVE_RIGHT',
|
|
233
|
+
payload: null,
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const moveRight = (): MoveRightAction => ({
|
|
237
|
+
type: 'MOVE_RIGHT',
|
|
238
|
+
payload: null,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// Exact
|
|
242
|
+
export type MoveLeftAction = {
|
|
243
|
+
type: 'MOVE_LEFT',
|
|
244
|
+
payload: null,
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export const moveLeft = (): MoveLeftAction => ({
|
|
248
|
+
type: 'MOVE_LEFT',
|
|
249
|
+
payload: null,
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// Exact
|
|
253
|
+
type FlushAction = {
|
|
254
|
+
type: 'FLUSH',
|
|
255
|
+
payload: null,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export const flush = (): FlushAction => ({
|
|
259
|
+
type: 'FLUSH',
|
|
260
|
+
payload: null,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Exact
|
|
264
|
+
export type AnimateDropArgs = {
|
|
265
|
+
completed: CompletedDrag,
|
|
266
|
+
newHomeClientOffset: Position,
|
|
267
|
+
dropDuration: number,
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export type DropAnimateAction = {
|
|
271
|
+
type: 'DROP_ANIMATE',
|
|
272
|
+
payload: AnimateDropArgs,
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const animateDrop = (args: AnimateDropArgs): DropAnimateAction => ({
|
|
276
|
+
type: 'DROP_ANIMATE',
|
|
277
|
+
payload: args,
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Exact
|
|
281
|
+
export type DropCompleteArgs = {
|
|
282
|
+
completed: CompletedDrag,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export type DropCompleteAction = {
|
|
286
|
+
type: 'DROP_COMPLETE',
|
|
287
|
+
payload: DropCompleteArgs,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export const completeDrop = (args: DropCompleteArgs): DropCompleteAction => ({
|
|
291
|
+
type: 'DROP_COMPLETE',
|
|
292
|
+
payload: args,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Exact
|
|
296
|
+
type DropArgs = {
|
|
297
|
+
reason: DropReason,
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Exact
|
|
301
|
+
export type DropAction = {
|
|
302
|
+
type: 'DROP',
|
|
303
|
+
payload: DropArgs,
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export const drop = (args: DropArgs): DropAction => ({
|
|
307
|
+
type: 'DROP',
|
|
308
|
+
payload: args,
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
export const cancel = () => drop({ reason: 'CANCEL' });
|
|
312
|
+
|
|
313
|
+
// Exact
|
|
314
|
+
export type DropPendingAction = {
|
|
315
|
+
type: 'DROP_PENDING',
|
|
316
|
+
payload: DropArgs,
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export const dropPending = (args: DropArgs): DropPendingAction => ({
|
|
320
|
+
type: 'DROP_PENDING',
|
|
321
|
+
payload: args,
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// Exact
|
|
325
|
+
export type DropAnimationFinishedAction = {
|
|
326
|
+
type: 'DROP_ANIMATION_FINISHED',
|
|
327
|
+
payload: null,
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export const dropAnimationFinished = (): DropAnimationFinishedAction => ({
|
|
331
|
+
type: 'DROP_ANIMATION_FINISHED',
|
|
332
|
+
payload: null,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
export type Action =
|
|
336
|
+
| BeforeInitialCaptureAction
|
|
337
|
+
| LiftAction
|
|
338
|
+
| InitialPublishAction
|
|
339
|
+
| WhileDraggingPublishAction
|
|
340
|
+
| CollectionStartingAction
|
|
341
|
+
| UpdateDroppableScrollAction
|
|
342
|
+
| UpdateDroppableIsEnabledAction
|
|
343
|
+
| UpdateDroppableIsCombineEnabledAction
|
|
344
|
+
| MoveByWindowScrollAction
|
|
345
|
+
| UpdateViewportMaxScrollAction
|
|
346
|
+
// | PostJumpScrollAction
|
|
347
|
+
// | PostSnapDestinationChangeAction
|
|
348
|
+
| MoveAction
|
|
349
|
+
| MoveUpAction
|
|
350
|
+
| MoveDownAction
|
|
351
|
+
| MoveRightAction
|
|
352
|
+
| MoveLeftAction
|
|
353
|
+
| DropPendingAction
|
|
354
|
+
| DropAction
|
|
355
|
+
| DropAnimateAction
|
|
356
|
+
| DropAnimationFinishedAction
|
|
357
|
+
| DropCompleteAction
|
|
358
|
+
| FlushAction;
|