Skip to content

Commit

Permalink
Bump version to 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Oct 31, 2023
1 parent 63b5af8 commit be976eb
Show file tree
Hide file tree
Showing 152 changed files with 1,597 additions and 1,347 deletions.
58 changes: 43 additions & 15 deletions dist/wunderbaum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare module "util" {
};
}
/**Throw an `Error` if `cond` is falsey. */
export function assert(cond: any, msg?: string): void;
export function assert(cond: any, msg: string): void;
/** Run `callback` when document was loaded. */
export function documentReady(callback: () => void): void;
/** Resolve when document was loaded. */
Expand Down Expand Up @@ -1790,6 +1790,8 @@ declare module "types" {
};
export type GridOptionsType = object;
export type InsertNodeType = "before" | "after" | "prependChild" | "appendChild";
export type DropEffectType = "none" | "copy" | "link" | "move";
export type DropEffectAllowedType = "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all";
export type DropRegionType = "over" | "before" | "after";
export type DropRegionTypeSet = Set<DropRegionType>;
export type DndOptionsType = {
Expand All @@ -1804,15 +1806,26 @@ declare module "types" {
*/
multiSource?: false;
/**
* Restrict the possible cursor shapes and modifier operations (can also be set in the dragStart event)
* Restrict the possible cursor shapes and modifier operations
* (can also be set in the dragStart event)
* @default "all"
*/
effectAllowed?: "all";
effectAllowed?: DropEffectAllowedType;
/**
* Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (overide in drag, dragOver).
* Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed.
* Overidable in the dragEnter or dragOver event.
* @default "move"
*/
dropEffectDefault?: string;
dropEffectDefault?: DropEffectType;
/**
* Use opinionated heuristics to determine the dropEffect ('copy', 'link', or 'move')
* based on `effectAllowed`, `dropEffectDefault`, and modifier keys.
* This is recalculated before each dragEnter and dragOver event and can be
* overridden there.
*
* @default true
*/
guessDropEffect: boolean;
/**
* Prevent dropping nodes from different Wunderbaum trees
* @default false
Expand Down Expand Up @@ -1847,7 +1860,7 @@ declare module "types" {
* Serialize Node Data to datatransfer object
* @default true
*/
serializeClipboardData?: boolean | ((nodeData: WbNodeData) => string);
serializeClipboardData?: boolean | ((nodeData: WbNodeData, node: WunderbaumNode) => string);
/**
* Enable auto-scrolling while dragging
* @default true
Expand Down Expand Up @@ -1895,7 +1908,7 @@ declare module "types" {
*/
dragEnter?: null | ((e: WbNodeEventType & {
event: DragEvent;
}) => boolean);
}) => DropRegionTypeSet | boolean);
/**
* Callback(targetNode, data)
* @default null
Expand All @@ -1917,8 +1930,10 @@ declare module "types" {
drop?: null | ((e: WbNodeEventType & {
event: DragEvent;
region: DropRegionType;
defaultDropMode: string;
suggestedDropMode: InsertNodeType;
suggestedDropEffect: DropEffectType;
sourceNode: WunderbaumNode;
sourceNodeData: WbNodeData | null;
}) => void);
/**
* Callback(targetNode, data)
Expand Down Expand Up @@ -2137,14 +2152,14 @@ declare module "wb_ext_dnd" {
import { Wunderbaum } from "wunderbaum";
import { WunderbaumExtension } from "wb_extension_base";
import { WunderbaumNode } from "wb_node";
import { DndOptionsType, DropRegionType, DropRegionTypeSet } from "types";
import { DndOptionsType, DropEffectType, DropRegionType, DropRegionTypeSet } from "types";
import { DebouncedFunction } from "debounce";
export class DndExtension extends WunderbaumExtension<DndOptionsType> {
protected srcNode: WunderbaumNode | null;
protected lastTargetNode: WunderbaumNode | null;
protected lastEnterStamp: number;
protected lastAllowedDropRegions: DropRegionTypeSet | null;
protected lastDropEffect: string | null;
protected lastDropEffect: DropEffectType | null;
protected lastDropRegion: DropRegionType | false;
protected currentScrollDir: number;
protected applyScrollDirThrottled: DebouncedFunction<() => void>;
Expand All @@ -2158,12 +2173,25 @@ declare module "wb_ext_dnd" {
* Calculates the drop region based on the drag event and the allowed drop regions.
*/
protected _calcDropRegion(e: DragEvent, allowed: DropRegionTypeSet | null): DropRegionType | false;
protected applyScrollDir(): void;
protected autoScroll(viewportY: number): number;
/**
* Guess drop effect (copy/link/move) using opinionated conventions.
*
* Default: dnd.dropEffectDefault
*/
protected _guessDropEffect(e: DragEvent): DropEffectType;
/** Don't allow void operation ('drop on self').*/
protected _isVoidDrop(targetNode: WunderbaumNode, srcNode: WunderbaumNode | null, dropRegion: DropRegionType | false): boolean;
protected _applyScrollDir(): void;
protected _autoScroll(viewportY: number): number;
/** Return true if a drag operation currently in progress. */
isDragging(): boolean;
/**
* Handle dragstart, drag and dragend events for the source node.
*/
protected onDragEvent(e: DragEvent): boolean;
private _isVoidDrop;
/**
* Handle dragenter, dragover, dragleave, drop events.
*/
protected onDropEvent(e: DragEvent): boolean;
}
}
Expand Down Expand Up @@ -2670,9 +2698,9 @@ declare module "wunderbaum" {
isEnabled(): boolean;
/** Return true if tree has more than one column, i.e. has additional data columns. */
isGrid(): boolean;
/** Return true if cell-navigation mode is acive. */
/** Return true if cell-navigation mode is active. */
isCellNav(): boolean;
/** Return true if row-navigation mode is acive. */
/** Return true if row-navigation mode is active. */
isRowNav(): boolean;
/** Set the tree's navigation mode. */
setCellNav(flag?: boolean): void;
Expand Down

0 comments on commit be976eb

Please sign in to comment.