Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
drag-drop-stage-component
Advanced tools
A component to "drag'n drop"-enable your projects, maintained and simple, light on dependencies
This "stage" component enables the user select elements, drag and drop them, resize them.
A component like this will be useful to the developer building any tool which includes a WYSIWYG.
This project is maintained, has very few dependencies and is used in Silex website builder
Here is a very simple example.
Here is a list of features which is the current road map (please vote with :+1:s).
See the online demo and its sources: html here and js here.
The component can be initialized like this, which will make it possible to select, move and resize all the elements marked with the .selectable
css class.
// All the div in the iframe
const iframe = document.querySelector('#iframe')
const stage = new Stage(iframe, iframe.contentDocument.querySelectorAll('div'))
The iframe is where you add elements with the .selectable
, .draggable
, .resizeable
, .droppable
css classes, which can then be moved and resized.
Your application can catch events and store the new style of the elements after a drop.
stage.on('drop', e => {
console.log('elements have been moved or resized, store their new styles if you wish', e.elements);
});
By default the elements which can be dragged or moved are those with the CSS classes .selectable
,.draggable
, .resizeable
but you can override this as follow. The .droppable
CSS class can be overrided too:
const stage = new Stage(iframe, {
isSelectable: (el) => el.classList.contains('selectable'),
isDroppable: (el, selection) => el.classList.contains('droppable'),
})
The build requires nodejs and npm, and it produces these files:
pub/stage.js
, which you need to include in your projectpub/stage.css
, which will be included in the iframe to draw the UIpub/demo.html
, which is a demo page for you to test the componentRun npm install
and npm run build
to build these files.
This component only depenency is the redux library.
It uses Typescript to compile to Javscript and less to compile to CSS. Also the unit tests are written with Jest.
Please vote for the features which matter to you here.
If you want to contribute code, read this readme for an introduction to the source code. And then you can help fixing the issues found in the code by Code Climat or find things to do in these issues which need to be done.
The source code is written in ES2015 with less and jade.
FAQs
A component to "drag'n drop"-enable your projects, maintained and simple, light on dependencies
The npm package drag-drop-stage-component receives a total of 14 weekly downloads. As such, drag-drop-stage-component popularity was classified as not popular.
We found that drag-drop-stage-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.