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

dnd-core

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnd-core - npm Package Compare versions

Comparing version 6.0.0 to 7.0.0

lib/actions/dragDrop/local/setClientOffset.d.ts

2

lib/actions/dragDrop/beginDrag.d.ts
import { Action, DragDropManager, BeginDragPayload, BeginDragOptions } from '../../interfaces';
export default function createBeginDrag<Context>(manager: DragDropManager<Context>): (sourceIds?: string[], { publishSource, clientOffset, getSourceClientOffset, }?: BeginDragOptions) => Action<BeginDragPayload> | undefined;
export default function createBeginDrag<Context>(manager: DragDropManager<Context>): (sourceIds?: string[], options?: BeginDragOptions) => Action<BeginDragPayload> | undefined;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var setClientOffset_1 = require("./local/setClientOffset");
var invariant = require('invariant');
var isObject = require('lodash/isObject');
var types_1 = require("./types");
var ResetCoordinatesAction = {
type: types_1.INIT_COORDS,
payload: {
clientOffset: null,
sourceClientOffset: null,
},
};
function createBeginDrag(manager) {
return function beginDrag(sourceIds, _a) {
return function beginDrag(sourceIds, options) {
if (sourceIds === void 0) { sourceIds = []; }
var _b = _a === void 0 ? {
if (options === void 0) { options = {
publishSource: true,
} : _a, _c = _b.publishSource, publishSource = _c === void 0 ? true : _c, clientOffset = _b.clientOffset, getSourceClientOffset = _b.getSourceClientOffset;
}; }
var _a = options.publishSource, publishSource = _a === void 0 ? true : _a, clientOffset = options.clientOffset, getSourceClientOffset = options.getSourceClientOffset;
var monitor = manager.getMonitor();
var registry = manager.getRegistry();
// Initialize the coordinates using the client offset
manager.dispatch(setClientOffset_1.setClientOffset(clientOffset));
verifyInvariants(sourceIds, monitor, registry);
// Get the draggable source
var sourceId = getDraggableSource(sourceIds, monitor);
if (sourceId === null) {
manager.dispatch(ResetCoordinatesAction);
return;
}
// Get the source client offset
var sourceClientOffset = null;

@@ -24,2 +38,4 @@ if (clientOffset) {

}
// Initialize the full coordinates
manager.dispatch(setClientOffset_1.setClientOffset(clientOffset, sourceClientOffset));
var source = registry.getSource(sourceId);

@@ -26,0 +42,0 @@ var item = source.beginDrag(monitor, sourceId);

import { DragDropManager } from '../../interfaces';
export * from './types';
export default function createDragDropActions<Context>(manager: DragDropManager<Context>): {
initCoords: (sourceIds: string[] | undefined, { clientOffset, getSourceClientOffset }: import("../../interfaces").InitCoordsOptions) => import("../../interfaces").Action<import("../../interfaces").InitCoordsPayload> | undefined;
beginDrag: (sourceIds?: string[], { publishSource, clientOffset, getSourceClientOffset, }?: import("../../interfaces").BeginDragOptions) => import("../../interfaces").Action<import("../../interfaces").BeginDragPayload> | undefined;
beginDrag: (sourceIds?: string[], options?: import("../../interfaces").BeginDragOptions) => import("../../interfaces").Action<import("../../interfaces").BeginDragPayload> | undefined;
publishDragSource: () => import("../../interfaces").SentinelAction | undefined;

@@ -7,0 +6,0 @@ hover: (targetIdsArg: string[], { clientOffset }?: import("../../interfaces").HoverOptions) => import("../../interfaces").Action<import("../../interfaces").HoverPayload>;

@@ -6,3 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var initCoords_1 = require("./initCoords");
var beginDrag_1 = require("./beginDrag");

@@ -16,3 +15,2 @@ var publishDragSource_1 = require("./publishDragSource");

return {
initCoords: initCoords_1.default(manager),
beginDrag: beginDrag_1.default(manager),

@@ -19,0 +17,0 @@ publishDragSource: publishDragSource_1.default(manager),

@@ -8,3 +8,3 @@ import { Backend, BackendFactory, DragDropActions, DragDropMonitor, DragDropManager, HandlerRegistry } from './interfaces';

private isSetUp;
constructor(createBackend: BackendFactory, context?: Context);
constructor(createBackend: BackendFactory, context?: Context, debugMode?: boolean);
getContext(): Context;

@@ -11,0 +11,0 @@ getMonitor(): DragDropMonitor;

@@ -8,5 +8,17 @@ "use strict";

var HandlerRegistryImpl_1 = require("./HandlerRegistryImpl");
function makeStoreInstance(debugMode) {
// TODO: if we ever make a react-native version of this,
// we'll need to consider how to pull off dev-tooling
var reduxDevTools = window && window.__REDUX_DEVTOOLS_EXTENSION__;
return redux_1.createStore(reducers_1.default, debugMode &&
reduxDevTools &&
reduxDevTools({
name: 'dnd-core',
instanceId: 'dnd-core',
}));
}
var DragDropManagerImpl = /** @class */ (function () {
function DragDropManagerImpl(createBackend, context) {
function DragDropManagerImpl(createBackend, context, debugMode) {
if (context === void 0) { context = {}; }
if (debugMode === void 0) { debugMode = false; }
var _this = this;

@@ -26,3 +38,3 @@ this.context = context;

};
var store = redux_1.createStore(reducers_1.default);
var store = makeStoreInstance(debugMode);
this.store = store;

@@ -29,0 +41,0 @@ this.monitor = new DragDropMonitorImpl_1.default(store, new HandlerRegistryImpl_1.default(store));

import { Store } from 'redux';
import { State } from './reducers';
import { DragDropMonitor, Listener, Unsubscribe, XYCoord, HandlerRegistry } from './interfaces';
import { DragDropMonitor, Listener, Unsubscribe, XYCoord, HandlerRegistry, Identifier } from './interfaces';
export default class DragDropMonitorImpl implements DragDropMonitor {

@@ -19,3 +19,3 @@ private store;

}): boolean;
getItemType(): string | symbol;
getItemType(): Identifier;
getItem(): any;

@@ -22,0 +22,0 @@ getSourceId(): string | null;

import { DragDropManager, BackendFactory } from './interfaces';
export declare function createDragDropManager<C>(backend: BackendFactory, context: C): DragDropManager<C>;
export declare function createDragDropManager<C>(backend: BackendFactory, context: C, debugMode?: boolean): DragDropManager<C>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DragDropManagerImpl_1 = require("./DragDropManagerImpl");
function createDragDropManager(backend, context) {
return new DragDropManagerImpl_1.default(backend, context);
function createDragDropManager(backend, context, debugMode) {
return new DragDropManagerImpl_1.default(backend, context, debugMode);
}
exports.createDragDropManager = createDragDropManager;

@@ -17,3 +17,3 @@ import { Store } from 'redux';

getTarget(targetId: string): DropTarget;
getSourceType(sourceId: string): string | symbol;
getSourceType(sourceId: string): Identifier;
getTargetType(targetId: string): Identifier | Identifier[];

@@ -20,0 +20,0 @@ isSourceId(handlerId: string): boolean;

@@ -112,6 +112,2 @@ import { Unsubscribe } from 'redux';

export declare type ActionCreator<Payload> = (args: any[]) => Action<Payload>;
export interface InitCoordsOptions {
clientOffset?: XYCoord;
getSourceClientOffset?: (sourceId: Identifier) => XYCoord;
}
export interface BeginDragOptions {

@@ -151,3 +147,2 @@ publishSource?: boolean;

export interface DragDropActions {
initCoords(sourceIds: string[], options?: any): Action<InitCoordsPayload>;
beginDrag(sourceIds: string[], options?: any): Action<BeginDragPayload>;

@@ -154,0 +149,0 @@ publishDragSource(): SentinelAction;

@@ -21,3 +21,3 @@ import { Identifier, Action } from '../interfaces';

targetIds: any;
itemType: string | symbol | (string | symbol)[] | null;
itemType: string | symbol | Identifier[] | null;
item: any;

@@ -24,0 +24,0 @@ sourceId: string | null;

@@ -19,3 +19,3 @@ import { State as DragOffsetState } from './dragOffset';

targetIds: any;
itemType: string | symbol | (string | symbol)[] | null;
itemType: string | symbol | import("../interfaces").Identifier[] | null;
item: any;

@@ -22,0 +22,0 @@ sourceId: string | null;

{
"name": "dnd-core",
"version": "6.0.0",
"version": "7.0.0",
"description": "Drag and drop sans the GUI",

@@ -26,7 +26,7 @@ "license": "BSD-3-Clause",

"devDependencies": {
"npm-run-all": "^4.1.3",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.2",
"typescript": "^3.1.6"
},
"gitHead": "21b878d2c66f020aa5248b085f4438b59e9c935b"
"gitHead": "f294f68dc82fe516adc1bb9f7452a67870943d84"
}
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