npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@angular-dnd/core

v0.0.25

Published

The **`@angular-dnd/core`** is a fork of [`@angular-skyhook/core`](https://github.com/cormacrelf/angular-skyhook) and is a toolkit for building complex drag and drop interfaces in Angular.

Downloads

27

Readme

@angular-dnd/core

The @angular-dnd/core is a fork of @angular-skyhook/core and is a toolkit for building complex drag and drop interfaces in Angular.

It is based on, and very similar to react-dnd by Dan Abramov and others, and is also powered by dnd-core. It is compatible with all backends.

npm GitHub

Check out the examples here.

Installation

yarn add @angular-dnd/core react-dnd-html5-backend

Next, follow the Quickstart and check out the Tutorial.

Peer dependant packages

Dependencies

Features

  • Make any component draggable, or into a drop target.

  • Doesn't mutate the DOM, and doesn't use classes and CSS to do 'callbacks'. Every visible change is made through Angular templates.

  • The truth lives in JavaScript, with unidirectional data flow (like @ngrx/store)

  • Observable APIs, designed to fit in Angular.

  • TypeScript friendly, with strong typing for in-flight objects, and inline documentation.

  • Works with HTML5 drag and drop, and all other react-dnd backends.

Goals

  • High performance. All code runs outside the Angular zone, and re-enters in batches only where strictly necessary, such that change detection runs precisely as many times as you need it to, with no extra configuration. You should also be able to take full advantage of OnPush change detection.

  • Largely possible to translate react-dnd code and examples into Angular (see Translating React Code).

  • Comprehensive documentation and tons of example code, written in Angular style.

What can you do with it?

Instead of building maximally-ergonomic solutions to simple use cases, react-dnd and @angular-dnd provide an abstraction over most things you could want to do with drag and drop. They are lower-level building blocks that make it easy to implement some very complex interactions. They assign no specific meaning to a drag/drop operation. You get to define what happens when a drag starts or ends or hovers. Here are some ambitious examples:

  • The traditional react-dnd tutorial, a chess board with movable pieces and rules
  • Deleting items by dragging them to a 'trash can', like in the macOS dock.
  • Stamping out a template by dragging the template into a work area
  • Merging two items by dragging one on top of the other
  • Hover over a 'folder' for a few seconds to 'drill down' into it
  • The famous lists and cards on trello.com, which actually uses react-dnd
  • A diagramming tool where you can draw links between nodes
  • A 2D CAD program
  • A graphical query builder, or visual data pipeline like Luna
  • Many other demonstrations of react-dnd (most with GIFs) in use

Alternatives

It is important to note that for bare-bones sortable lists, where you have a mutable array of simple values, you don't necessarily need the superpowers in this library. There are plenty of cookie-cutter solutions out there, like the quite powerful ng2-dnd or ng2-dragula, which may get you to your deadline faster than learning and using @angular-dnd.

But be warned; you may find yourself wanting more dragging power once you get a taste. In fact, this package was born when @cormacrelf got sick of maintaining ng2-dragula and watching users struggle to implement what react-dnd was born for.

If Angular and React aren't your thing, there's also vue-react-dnd.

Issues

Not all issues are @angular-dnd-related. If you think you found a bug in dnd-core or with the HTML5 backend, those issues belong on that codebase with their many contributors and wealth of experience. If there is a problem with another backend you are using, file an issue with that backend so you can get more specific help and so that the community can benefit.

Issues and potential improvements to @angular-dnd are discussed on GitHub.

License

This library is released under the MIT license.

It depends on dnd-core which is (now) also under the MIT license.