
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@foblex/drag-toolkit
Advanced tools
A TypeScript library providing foundational classes and utilities for implementing drag-and-drop functionality in Angular applications, with support for both mouse and touch events, and designed to work with or without Angular’s NgZone (zoneless applicati
A TypeScript library providing foundational classes and utilities for implementing drag-and-drop functionality in Angular applications, with support for both mouse and touch events, and designed to work with or without Angular’s NgZone (zoneless applications). Used in Foblex Flow for drag-and-drop operations.
Foblex Drag Toolkit simplifies the implementation of drag-and-drop interactions in Angular applications by providing:
By extending the DragAndDropBase class and implementing its abstract methods, developers can create custom drag-and-drop components with consistent behavior across different input types.
Install the library via npm:
npm install @foblex/drag-toolkit
Extend the DragAndDropBase class and implement the abstract methods:
import { Component, ElementRef } from '@angular/core';
import {
DragAndDropBase,
IPointerEvent,
ICanRunOutsideAngular,
} from '@foblex/drag-toolkit';
@Component({
selector: 'app-draggable',
template: `<div #draggableElement>Drag Me!</div>`,
})
export class DraggableComponent extends DragAndDropBase {
public hostElement: HTMLElement;
public disabled = false;
constructor(
private elementRef: ElementRef,
ngZone: ICanRunOutsideAngular
) {
super(ngZone);
this.hostElement = this.elementRef.nativeElement;
}
protected prepareDragSequence(event: IPointerEvent): void {
// Initialize drag operation
}
protected finalizeDragSequence(): void {
// Clean up after drag operation
}
protected onSelect(event: Event): void {
// Handle text selection during drag
event.preventDefault();
}
public onPointerDown(event: IPointerEvent): boolean {
// Determine if drag should start
return true;
}
public onPointerMove(event: IPointerEvent): void {
// Handle dragging movement
}
public onPointerUp(event: IPointerEvent): void {
// Handle drag completion
}
}
Ensure that you call subscribe and unsubscribe methods appropriately, typically in ngOnInit and ngOnDestroy:
import { AfterViewInit, OnDestroy } from '@angular/core';
export class DraggableComponent
extends DragAndDropBase
implements AfterViewInit, OnDestroy
{
// ... (other code)
ngAfterViewInit(): void {
this.subscribe(document);
}
ngOnDestroy(): void {
this.unsubscribe();
}
}
This project is licensed under the MIT License.
By using the Foblex Drag Toolkit, you can simplify the implementation of complex drag-and-drop interactions in your Angular applications, ensuring consistent behavior across different devices and input types.
FAQs
A TypeScript library providing foundational classes and utilities for implementing drag-and-drop functionality in Angular applications, with support for both mouse and touch events, and designed to work with or without Angular’s NgZone (zoneless applicati
The npm package @foblex/drag-toolkit receives a total of 3,816 weekly downloads. As such, @foblex/drag-toolkit popularity was classified as popular.
We found that @foblex/drag-toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.