MCPcopy
hub / github.com/Shopify/draggable

github.com/Shopify/draggable @v1.2.1 sqlite

repository ↗ · DeepWiki ↗ · release v1.2.1 ↗
708 symbols 1,364 edges 145 files 264 documented · 37%
README

npm version CI PRs Welcome Bundle size

Development

Draggable is no longer maintained by its original authors. Maintenance of this repo has been passed on to new collaborators and is no longer worked on by anyone at Shopify.

We are still looking for more maintainers! If anyone is interested in answering / triaging issues, reviewing / rejecting / approving PRs, and authoring code for bug fixes / new features — please send an email to max.hoffmann (at) shopify (dot) com. You may be asked a few questions before obtaining collaboration permission, but if everything checks out, we will happily add you as a collaborator.


Get complete control over drag and drop behaviour with Draggable! Draggable abstracts native browser events into a comprehensive API to create a custom drag and drop experience. Draggable comes with additional modules: Sortable, Droppable, Swappable. Draggable itself does not perform any sorting behaviour while dragging, but does the heavy lifting, e.g. creates mirror, emits events, manages sensor events, makes elements draggable.

The additional modules are built on top of Draggable and therefore provide a similar API interface, for more information read the documentation below.

Features

  • Works with native drag, mouse, touch and force touch events
  • Can extend dragging behaviour by hooking into draggables event life cycle
  • Can extend drag detection by adding sensors to draggable
  • The library is targeted ES6 first

Table of Contents

Install

You can install the library via npm.

npm install @shopify/draggable --save

or via yarn:

yarn add @shopify/draggable

or via CDN


<script type="module">
  import {
    Draggable,
    Sortable,
    Droppable,
    Swappable,
  } from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/index.mjs';
</script>

<script type="module">
  import Draggable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Draggable/Draggable.mjs';
</script>

<script type="module">
  import Sortable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Sortable/Sortable.mjs';
</script>

<script type="module">
  import Droppable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Droppable/Droppable.mjs';
</script>

<script type="module">
  import Swappable from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Swappable/Swappable.mjs';
</script>

<script type="module">
  import * as Plugins from 'https://cdn.jsdelivr.net/npm/@shopify/draggable/build/esm/Plugins/index.mjs';
</script>

<script src="https://cdn.jsdelivr.net/npm/@shopify/draggable/build/umd/index.min.js"></script>
<script>
  console.log(window.Draggable);
</script>

Browser Compatibility

Check the "browserlist" property in package.json for more info

Chrome Firefox Opera Safari Edge
Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔ Last 3 versions ✔

Documentation

You can find the documentation for each module within their respective directories.

TypeScript

Draggable includes TypeScript definitions.

Documentation

Running examples

To run the examples project locally, simply run the following from the draggable root:

yarn && yarn start

This will start a server that hosts the contents of examples/. It also watches for file changes from both src/ and examples/src and reloads the browser.

Contributing

Contributions are more than welcome, the code base is still new and needs more love.

For more information, please checkout the contributing document.

Related resources

Copyright

Copyright (c) 2018-present Shopify. See LICENSE.md for further details.

Extension points exported contracts — how you extend this code

DraggableEventData (Interface)
* DraggableEventData * @interface DraggableEventData
src/Draggable/DraggableEvent/DraggableEvent.ts
DelayOptions (Interface)
(no doc)
index.d.ts
Event (Interface)
(no doc)
test/environment.ts
Options (Interface)
(no doc)
test/helpers/module.ts
DroppableEventData (Interface)
(no doc)
src/Droppable/DroppableEvent/DroppableEvent.ts
Node (Interface)
(no doc)
src/shared/utils/closest/closest.ts
SnapEventData (Interface)
(no doc)
src/Plugins/Snappable/SnappableEvent/SnappableEvent.ts
SortableEventData (Interface)
(no doc)
src/Sortable/SortableEvent/SortableEvent.ts

Core symbols most depended-on inside this repo

waitForDragDelay
called by 129
test/helpers/sensor.ts
clickMouse
called by 94
test/helpers/sensor.ts
releaseMouse
called by 91
test/helpers/sensor.ts
on
called by 72
src/Draggable/Draggable.js
triggerEvent
called by 71
test/helpers/event.ts
moveMouse
called by 63
test/helpers/sensor.ts
on
called by 61
src/Draggable/Emitter/Emitter.ts
getDraggableElementsForContainer
called by 42
src/Draggable/Draggable.js

Shape

Class 272
Method 260
Function 129
Interface 47

Languages

TypeScript100%

Modules by API surface

index.d.ts139 symbols
src/Draggable/DragEvent/DragEvent.ts41 symbols
src/Draggable/Plugins/Mirror/MirrorEvent/MirrorEvent.ts36 symbols
src/Sortable/SortableEvent/SortableEvent.ts30 symbols
src/Draggable/Draggable.js26 symbols
src/Draggable/Plugins/Mirror/Mirror.js23 symbols
src/Droppable/DroppableEvent/DroppableEvent.ts21 symbols
src/Swappable/SwappableEvent/SwappableEvent.ts18 symbols
src/Draggable/Sensors/SensorEvent/SensorEvent.ts18 symbols
src/Sortable/Sortable.js16 symbols
src/Draggable/Plugins/Scrollable/Scrollable.js16 symbols
src/Plugins/Collidable/CollidableEvent/CollidableEvent.ts13 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/core7.22.20 · 1×
@babel/plugin-proposal-decorators7.23.0 · 1×
@babel/preset-env7.22.20 · 1×
@babel/preset-typescript7.23.0 · 1×
@babel/register7.8.3 · 1×
@changesets/changelog-github0.4.8 · 1×
@changesets/cli2.26.2 · 1×
@rollup/plugin-babel6.0.3 · 1×
@rollup/plugin-commonjs25.0.4 · 1×
@rollup/plugin-node-resolve15.2.1 · 1×
@rollup/plugin-typescript11.1.4 · 1×
@shopify/eslint-plugin43.0.0 · 1×

For agents

$ claude mcp add draggable \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact