1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Drag and drop so simple it hurts
//!
//! Wrapper for the [Dragula](https://bevacqua.github.io/dragula/) Javascript library.
//!
//! ## Usage
//! Dragula provides the easiest possible API to make drag and drop a breeze in your
//! applications.
//! ```no_run
//! use dragula::*;
//!
//! let doc = web_sys::window().unwrap().document().unwrap();
//! let element = doc.get_element_by_id("drag-container").unwrap();
//!
//! let drake = dragula(&[element]);
//!
//! ```
//!
//! You can also provide an [`Options`](crate::Options) instance to specify
//! behaviour of certain drag-and-drop features.
//! ```no_run
//! use dragula::*;
//! use dragula::options::Direction;
//! use web_sys::Element;
//! # use wasm_bindgen::JsValue;
//!
//! # let element = JsValue::TRUE;
//! //--snip--
//!
//! let options = Options {
//!     is_container: Box::new(|el| {
//!         Element::from(el).class_list().contains("drag-container")
//!     }),
//!     direction: Direction::Horizontal,
//!     revert_on_spill: true,
//!     ..Options::default()
//! };
//!
//! let drake = dragula_options(&[element], options);
//!
//! //--snip--
//!
//! ```
//!
//! ## `cargo` Features
//! - **js-sys**: On by default. Can be used to toggle dependencies on the `js-sys`
//!   crate. Most of this crate relies solely on `wasm-bindgen`, so disabling this
//!   feature currently just prevents you from getting containers on an existing
//!   Drake. The main reason you might want to disable this would be to improve compile
//!   times.
#![doc(
    html_favicon_url = "https://bevacqua.github.io/dragula/resources/icon.svg"
)]
#![doc(html_logo_url = "https://bevacqua.github.io/dragula/resources/icon.svg")]

mod dragula;
mod drake;
pub mod options;

// Helpers
mod closure;

#[doc(inline)]
pub use crate::dragula::*;

#[doc(inline)]
pub use drake::Drake;

#[doc(inline)]
pub use options::Options;

#[cfg(test)]
mod test_utils;