New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

phosphor-domutil

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phosphor-domutil - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

49

lib/index.d.ts
import { IDisposable } from 'phosphor-disposable';
/**
* `p-mod-override-cursor`: the class name added to the document body
* during cursor override.
*/
export declare const OVERRIDE_CURSOR_CLASS: string;
/**
* Override the cursor for the entire document.

@@ -168,1 +163,45 @@ *

export declare function sizeLimits(node: HTMLElement): ISizeLimits;
/**
* Get the custom data associated with a drag and drop operation.
*
* @param event - The DragEvent generated by a user interaction.
*
* @param mime - The MIME type whose data is being retrieved.
*
* @returns The value associated with a DragEvent and a MIME type,
* or `undefined` if not data has been set for the combination.
*
* #### Notes
* The native drag and drop life cycle ends for the drop target with
* a `drop` event where the value associated with a particular MIME
* should be retrieved. One example is a Widget being dropped on a
* target that will clone it using a retrieved factory function.
*/
export declare function getDragData(event: DragEvent, mime: string): any;
/**
* Set custom drag data for a specific drag event.
*
* @param event - The DragEvent generated by a user interaction.
*
* @param mime - The MIME type whose data is being retrieved.
*
* @param data - The value to stored for the DragEvent and MIME
* combination. This can be any object, not just string data.
*
* #### Notes
* The native drag and drop life cycle begins with a `dragstart` event
* on the draggable node. The value associated with a particular MIME
* should be set in this event handler.
*/
export declare function setDragData(event: DragEvent, mime: string, data: any): void;
/**
* Clear the data being held for a specific drag event.
*
* @param event - The DragEvent generated by a user interaction.
*
* #### Notes
* The native drag and drop life cycle ends with a `dragend` event on
* the draggable node. The values associated with a particular event
* should be cleared in this event handler.
*/
export declare function clearDragData(event: DragEvent): void;

@@ -12,6 +12,5 @@ /*-----------------------------------------------------------------------------

/**
* `p-mod-override-cursor`: the class name added to the document body
* during cursor override.
* The class name added to the document body during cursor override.
*/
exports.OVERRIDE_CURSOR_CLASS = 'p-mod-override-cursor';
var OVERRIDE_CURSOR_CLASS = 'p-mod-override-cursor';
/**

@@ -47,7 +46,7 @@ * The id for the active cursor override.

body.style.cursor = cursor;
body.classList.add(exports.OVERRIDE_CURSOR_CLASS);
body.classList.add(OVERRIDE_CURSOR_CLASS);
return new phosphor_disposable_1.DisposableDelegate(function () {
if (id === overrideID) {
body.style.cursor = '';
body.classList.remove(exports.OVERRIDE_CURSOR_CLASS);
body.classList.remove(OVERRIDE_CURSOR_CLASS);
}

@@ -170,2 +169,77 @@ });

exports.sizeLimits = sizeLimits;
/**
* The internal MIME type used to store the custom drag data.
*/
var DRAG_MIME_TYPE = 'application/x-phosphor-internal-drag-data';
/**
* The internal cache that holds the custom drag data.
*/
var dragCache = {
data: Object.create(null),
id: 0
};
/**
* Get the custom data associated with a drag and drop operation.
*
* @param event - The DragEvent generated by a user interaction.
*
* @param mime - The MIME type whose data is being retrieved.
*
* @returns The value associated with a DragEvent and a MIME type,
* or `undefined` if not data has been set for the combination.
*
* #### Notes
* The native drag and drop life cycle ends for the drop target with
* a `drop` event where the value associated with a particular MIME
* should be retrieved. One example is a Widget being dropped on a
* target that will clone it using a retrieved factory function.
*/
function getDragData(event, mime) {
var id = event.dataTransfer.getData(DRAG_MIME_TYPE);
return id && dragCache.data[id] && dragCache.data[id][mime];
}
exports.getDragData = getDragData;
/**
* Set custom drag data for a specific drag event.
*
* @param event - The DragEvent generated by a user interaction.
*
* @param mime - The MIME type whose data is being retrieved.
*
* @param data - The value to stored for the DragEvent and MIME
* combination. This can be any object, not just string data.
*
* #### Notes
* The native drag and drop life cycle begins with a `dragstart` event
* on the draggable node. The value associated with a particular MIME
* should be set in this event handler.
*/
function setDragData(event, mime, data) {
var id = event.dataTransfer.getData(DRAG_MIME_TYPE);
if (!id) {
id = "drag-" + ++dragCache.id;
event.dataTransfer.setData(DRAG_MIME_TYPE, id);
}
if (!dragCache.data[id]) {
dragCache.data[id] = Object.create(null);
}
dragCache.data[id][mime] = data;
}
exports.setDragData = setDragData;
/**
* Clear the data being held for a specific drag event.
*
* @param event - The DragEvent generated by a user interaction.
*
* #### Notes
* The native drag and drop life cycle ends with a `dragend` event on
* the draggable node. The values associated with a particular event
* should be cleared in this event handler.
*/
function clearDragData(event) {
var id = event.dataTransfer.getData(DRAG_MIME_TYPE);
if (id)
delete dragCache.data[id];
}
exports.clearDragData = clearDragData;
//# sourceMappingURL=index.js.map

6

package.json
{
"name": "phosphor-domutil",
"version": "0.9.5",
"version": "0.9.6",
"description": "Utilities for working with the DOM.",

@@ -53,3 +53,5 @@ "main": "lib/index.js",

"browserify": {
"transform": ["browserify-css"]
"transform": [
"browserify-css"
]
},

@@ -56,0 +58,0 @@ "keywords": [

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