Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dflex/draggable

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dflex/draggable - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

15

package.json
{
"name": "@dflex/draggable",
"version": "2.7.0",
"version": "2.7.1",
"main": "dist/index.js",

@@ -20,12 +20,5 @@ "types": "dist/index.d.ts",

"dependencies": {
"@dflex/core-instance": "^2.7.0",
"@dflex/store": "^2.7.0"
"@dflex/core-instance": "^2.7.1",
"@dflex/store": "^2.7.1"
},
"devDependencies": {
"@cypress/code-coverage": "^3.8.1",
"cross-env": "^7.0.2",
"cypress": "^6.3.0",
"eslint-plugin-cypress": "^2.11.1",
"start-server-and-test": "^1.11.2"
},
"keywords": [

@@ -51,3 +44,3 @@ "drag-drop",

},
"gitHead": "410a53603f6a8a991bc8fe6bb86226ef832d784d"
"gitHead": "e6d80ef4bba64147eb0e64de2cf1d1c009470fe3"
}
<h1 align="center">
<img
src="https://raw.githubusercontent.com/dflex-js/dflex/master/dflex-full-size.png"
src="https://raw.githubusercontent.com/jalal246/dflex/master/DFlex-readme.png"
alt="Dflex logo" />

@@ -39,7 +39,2 @@ </h1>

## Documentation
Visit DFlex site for more <https://dflex-js.github.io/dflex/> and to see live
examples with the full code.
## Installation

@@ -51,158 +46,5 @@

<p align="center">
<img
src="https://raw.githubusercontent.com/dflex-js/dflex/master/packages/draggable/img/draggable.gif"
alt="show how draggable works" />
</p>
## Features
- You can add strictly draggable, moving only horizontal or vertical by yourself
because you control dragging coordinations.
- You can control the clickable area, simply because it's a mouse event. Could
be on the entire element or a small button of the element. It's up to you.
- You know when the dragging is going to start and end without adding additional API functions.
- It can be nested dragging. Related to a list of elements or just one element It doesn't matter. It is always the same.
## API
```js
import { store, Draggable } from "@dflex/draggable";
```
### Registry
Register draggable element in draggable store:
```ts
store.register({ id: string, ref: HTMLElement });
```
### Draggable Instance
Create draggable instance with `onmousedown`handler
```ts
const draggable = new Draggable(id: string, {x: event.clientX, y: event.clientY});
```
### Movement
Move the element with `onmousemove` handler
```ts
draggable.dragAt(event.clientX, event.clientY);
```
### End Dragging
You can end dragging with`onmouseup` handler
```ts
draggable.endDragging();
```
### Add Custom Style
While you can add style, classes related to drag since you trigger `dragAt` and `endDragging`.
You can also control the few style properties that Draggable use when dragging.
When create draggable Instance you can use `draggedStyle: Array<draggedStyleObj>`
```ts
draggedStyleObj: {
prop: string;
dragValue: string;
afterDragValue:? string;
}
```
Default value for `draggedStyle`:
```js
const draggedStyle = [
{
prop: "zIndex",
dragValue: "99",
afterDragValue: null,
},
];
```
You can change it after creating dragged instance. The following example
will change background color `red` during the drag and `purple` after finish dragging.
```js
draggable.draggedStyle = [
{
prop: "zIndex",
dragValue: "99",
afterDragValue: null,
},
{
prop: "pointerEvents",
dragValue: "pointer",
afterDragValue: null,
},
{
prop: "background",
dragValue: "red",
afterDragValue: "purple",
},
];
```
### Implementations
- [Full React example](https://github.com/dflex-js/dflex/tree/master/packages/draggable/playgrounds/dflex-react-draggable)
- [Full Vue example](https://github.com/dflex-js/dflex/tree/master/packages/draggable/playgrounds/dflex-vue-draggable)
## Project Content
DFlex Draggable is part of project contains:
- [DOM Generator](https://github.com/dflex-js/dflex/tree/master/packages/dom-gen) DOM
relations generator algorithm. Generate relations between DOM elements based
on element depth without a browser.
- [DOM Store](https://github.com/dflex-js/dflex/tree/master/packages/store) The
only Store that allows you to traverse through the DOM tree using element id
without reading from the browser.
- [Drag & Drop](https://github.com/dflex-js/dflex/tree/master/packages/dnd) A
Simple, lightweight Solution for a Drag & Drop App based on enhanced DOM store
algorithm. You can achieve a drag and drop with three steps only with mouse
event.
## Test
```sh
yarn test draggable
```
## License
DFlex is open source and dual-licensed as
[AGPL](https://github.com/dflex-js/dflex/tree/master/packages/draggable/LICENSE)/Commercial
software.
DFlex is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
Buying a license is mandatory if you develop commercial activities using
DFlex inside your product or deploying it on a network without disclosing the
source code of your own applications under the AGPL license.
## Contribution
If you like this project, you can support it by contributing. If you find a bug,
please let me know, applying a pull request is welcome. This project needs your
support. You can fix typos, add new examples, or build with me new features.
> Support this project by giving it a Star ⭐
Visit DFlex site for more <https://www.dflex.dev/> and to see live
examples with the full code.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc