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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ember-ui-sortable

v0.3.3

Published

Ember component for interacting with jQuery UI's Sortable module.

Readme

ember-ui-sortable

Build Status

An Ember 1.13+ component for jQuery UI's Sortable Widget. This addon is a fork of ivy-sortable.

Installation

As an ember-cli addon:

ember install ember-ui-sortable

Usage

This addon provides two components for your sorting pleasure.

  1. {{#ui-sortable}}...{{/ui-sortable}} takes an array of thingies (technical term) and spits out a sortable list.
  2. {{#ui-draggable}}...{{/ui-draggable}} can wrap around anything you want to drag around your UI like a dirty blanket. Using the connectToSortable option, you can plop this draggable in a sortable and win all the prizes.

Sortable Component

Use the ui-sortable component block to iterate over the wrapped content:

{{#ui-sortable content=people as |person|}}
  <li>Hi there, {{person.name}}</li>
{{/ui-sortable}}

This will output a sortable list, and dragging and dropping items will reorder them in the passed in content array. To handle an action on the parent controller or component, you can bind an action to the moved property. The moved action will return three arguments, the object being moved, the previous index, and the new index.

Following the principle of Data Down Actions Up (DDAU), the sortable component doesn't modify the content array. You'll need to do it yourself with the action bound to moved.

{{#ui-sortable content=people moved=(action "movedPerson") as |person|}}
  <li>Hi there, {{person.name}}</li>
{{/ui-sortable}}

Handle this action like so...

// controller|component.js
export default {
  actions: {
    movedPerson: function(person, oldIndex, newIndex) {
      // do rad stuff...ajax or something
      // Here's an example, where model is an array of something
      const content = this.get('model'); 
      content.removeAt(oldIndex);
      content.insertAt(newIndex, person);
      return content.save();
    }
  }
}

Add a connectWith option to allow dragging items between lists! Make a Trello clone, or something. Be awesome.

{{#ui-sortable class="connected" connectWith=".connected"}}...{{/ui-sortable}}
{{#ui-sortable class="connected" connectWith=".connected"}}...{{/ui-sortable}}

Sortable Options

The following jQuery UI Sortable options are supported:

  • axis
  • appendTo
  • connectWith
  • containment
  • cursorAt
  • cursor
  • delay
  • disabled
  • distance
  • forceHelperSize
  • forcePlaceholderSize
  • grid
  • handle
  • helper
  • opacity
  • placeholder
  • revert
  • scrollSensitivity
  • scrollSpeed
  • scroll
  • tolerance
  • zIndex

Draggable Component

Use the ui-draggable component block to wrap something else and make it draggable:

{{#ui-draggable}}
  <li>Hi there, {{person.name}}</li>
{{/ui-draggable}}

Add an optional connectToSortable property to allow dragging this element to a ui-sortable list. #winning.

{{#ui-draggable connectToSortable=".draggable-target"}}
  <li>Hi there, {{person.name}}</li>
{{/ui-draggable}}

{{#ui-sortable class="draggable-target"}}...{{/ui-sortable}}

Draggable Options

The following jQuery UI Draggable options are supported:

  • addClasses
  • axis
  • appendTo
  • connectToSortable
  • containment
  • cursorAt
  • cursor
  • delay
  • disabled
  • distance
  • grid
  • handle
  • helper
  • opacity
  • refreshPositions
  • revert
  • revertDuration
  • scrollSensitivity
  • scrollSpeed
  • scroll
  • snap
  • snapMode
  • snapTolerance
  • stack
  • zIndex

TODO:

  • [x] Demo app
  • [ ] Droppable component. Why not? ¯\_(ツ)_/¯

Contributors

Contributing

Fork this repo, make a new branch, and send a pull request. Make sure your change is tested or it won't be merged.

To run tests:

git clone # <this repo>
npm install
npm test

Or, to start a test server that continually runs (for development):

ember test --server