threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
69 lines • 2.21 kB
TypeScript
/**
* Fork of: https://github.com/donmccurdy/simple-dropzone updated: Mar 2021
* The MIT License (MIT)
* Copyright (c) 2018 Don McCurdy
*
* Changes:
* Convert to typescript.
* webkitRelativePath for file input select.
* Removed unzip and dependency(done in importer).
*
* Watches an element for file drops, parses to create a filemap hierarchy,
* and emits the result.
*/
export declare class Dropzone {
get inputEl(): HTMLInputElement | undefined;
get el(): HTMLElement | undefined;
private _el?;
private _inputEl?;
private _listeners;
constructor(el?: HTMLElement, inputEl?: HTMLInputElement, listeners?: Partial<Record<DropEventType, ListenerCallback>>);
on(type: DropEventType, callback: ListenerCallback): Dropzone;
private _emit;
/**
* Destroys the instance.
*/
destroy(): void;
/**
* Use dataTransfer.items when available instead of dataTransfer.files (when files are dropped)
*
* Set to false to use dataTransfer.files only.
* This is useful for environments where files cannot be read from FileSystemEntry like in figma plugins/widgets.
*/
static USE_DATA_TRANSFER_ITEMS: boolean;
/**
* References (and horror):
* - https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items
* - https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files
* - https://code.flickr.net/2012/12/10/drag-n-drop/
* - https://stackoverflow.com/q/44842247/1314762
*
*/
private _onDrop;
/**
* @param {Event} e
*/
private _onDragover;
private _onSelect;
/**
* Iterates through a list of FileSystemEntry objects, creates the fileMap
* tree, and emits the result.
* @param fileMap
* @param {Array<FileSystemEntry>} entries
* @param e
*/
private _loadNextEntry;
/**
* @throws
*/
private _fail;
}
export type DropEventType = 'drop' | 'dropstart' | 'droperror';
export type ListenerCallback = ((data?: {
files?: Map<string, DropFile>;
message?: string;
}) => void);
export interface DropFile extends File {
filePath: string;
}
//# sourceMappingURL=Dropzone.d.ts.map