fluid-dnd 1.1.2-beta.0 → 1.2.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/{HandlerPublisher-CAhfY7Ch.js → HandlerPublisher-CIc7wXW-.js} +1 -1
- package/dist/{HandlerPublisher-BttKXTeA.cjs → HandlerPublisher-DiGO5iOY.cjs} +1 -1
- package/dist/core/configHandler.d.ts +3 -2
- package/dist/core/dragAndDrop.d.ts +4 -4
- package/dist/core/index.d.ts +6 -6
- package/dist/core/useDraggable.d.ts +3 -2
- package/dist/core/useDroppable.d.ts +3 -2
- package/dist/core/utils/GetStyles.d.ts +3 -2
- package/dist/core/utils/ParseStyles.d.ts +3 -2
- package/dist/core/utils/SetStyles.d.ts +2 -1
- package/dist/core/utils/SetTransform.d.ts +3 -2
- package/dist/core/utils/config.d.ts +3 -3
- package/dist/core/utils/droppableConfigurator.d.ts +4 -3
- package/dist/core/utils/events/emitEvents.d.ts +7 -6
- package/dist/core/utils/scroll.d.ts +3 -2
- package/dist/core/utils/tempChildren.d.ts +2 -1
- package/dist/core/utils/translate/GetTranslateBeforeDropping.d.ts +3 -2
- package/dist/core/utils/translate/GetTranslationByDraggingAndEvent.d.ts +3 -2
- package/dist/index/index.cjs +1 -1
- package/dist/index/index.mjs +1 -1
- package/dist/index-BDu6-Hq8.js +1283 -0
- package/dist/index-Tde6DOzb.cjs +1 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.mjs +55 -0
- package/dist/react/useDragAndDrop.d.ts +3 -0
- package/dist/react/utils/ReactLilstConfig.d.ts +4 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.d.ts +2 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/svelte/useDragAndDrop.d.ts +2 -1
- package/dist/svelte/utils/SvelteListCondig.d.ts +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.ts +2 -1
- package/dist/vue/index.mjs +2 -2
- package/dist/vue/useDragAndDrop.d.ts +3 -2
- package/dist/vue/utils/DropMethods.d.ts +2 -1
- package/dist/vue/utils/VueListCondig.d.ts +3 -3
- package/package.json +12 -8
- package/dist/index-BnYdI35p.js +0 -1281
- package/dist/index-LwQqhkeh.cjs +0 -1
- package/dist/index.d.ts +0 -4
package/README.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
</div>
|
17
17
|
|
18
18
|
Fluid DnD is a [**fluid**, **agnostic** and **versatil** drag and drop
|
19
|
-
library for lists with support for Vue
|
19
|
+
library for lists with support for Vue, react and Svelte](https://fluid-dnd.netlify.app/). It's a **lightweight** tool ~7 Kb (gzip) with no depenencies.
|
20
20
|
|
21
21
|
<img src="https://github.com/user-attachments/assets/b350f9a4-7dd7-40ca-ae3f-ecca166a9081" width="100%"/>
|
22
22
|
|
@@ -56,6 +56,11 @@ library for lists with support for Vue 3 and Svelte](https://fluid-dnd.netlify.a
|
|
56
56
|
- 🛠️ Edit the previous [here](https://codesandbox.io/s/nifty-hooks-5plkpl).
|
57
57
|
- 📘 See others examples [here](https://fluid-dnd.netlify.app/example/vertical-list/single-vertical-list/).
|
58
58
|
|
59
|
+
## 📚 Libraries Support
|
60
|
+
- Vue >=3.0.0
|
61
|
+
- React >= 18.0.0
|
62
|
+
- Svelte >= 5.0.0
|
63
|
+
|
59
64
|
## 🤝 Contributing
|
60
65
|
|
61
66
|
If you're interested in contributing to [fluid-dnd](https://github.com/carlosjorger/fluid-dnd), please read our contributing docs before submitting a pull request [CONTRIBUTING](./CONTRIBUTING.md).
|
@@ -1,7 +1,7 @@
|
|
1
1
|
var d = Object.defineProperty;
|
2
2
|
var e = (a, s, l) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
|
3
3
|
var r = (a, s, l) => e(a, typeof s != "symbol" ? s + "" : s, l);
|
4
|
-
import { a as h, t as n, G as t } from "./index-
|
4
|
+
import { a as h, t as n, G as t } from "./index-BDu6-Hq8.js";
|
5
5
|
class c {
|
6
6
|
constructor() {
|
7
7
|
r(this, "handlers");
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-
|
1
|
+
"use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-Tde6DOzb.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ListCondig } from
|
2
|
-
import {
|
3
|
-
|
4
|
-
export default function dragAndDrop<T>(listCondig: ListCondig<T>, handlerPublisher: HandlerPublisher, config?: Config<T>, indexAttr?: string): readonly [(index: number) => void, (index: number, value: T) => void, (parent: HTMLElement | undefined) => void];
|
1
|
+
import { ListCondig, Config } from '.';
|
2
|
+
import { default as HandlerPublisher } from './HandlerPublisher';
|
3
|
+
|
4
|
+
export default function dragAndDrop<T>(listCondig: ListCondig<T>, handlerPublisher: HandlerPublisher, config?: Config<T>, indexAttr?: string, reactChildrenChanges?: Boolean): readonly [(index: number) => void, (index: number, value: T) => void, (parent: HTMLElement | null | undefined) => void];
|
package/dist/core/index.d.ts
CHANGED
@@ -4,13 +4,13 @@ export type DraggableElement = {
|
|
4
4
|
} | {
|
5
5
|
index: number;
|
6
6
|
};
|
7
|
-
export
|
8
|
-
removeAtEvent: (index: number) => T | undefined;
|
9
|
-
insertEvent: (index: number, value: T) => void;
|
7
|
+
export type ListCondig<T> = {
|
8
|
+
removeAtEvent: (index: number, sync?: boolean) => T | undefined;
|
9
|
+
insertEvent: (index: number, value: T, sync?: boolean) => void;
|
10
10
|
getLength: () => number;
|
11
11
|
getValue: (index: number) => T;
|
12
12
|
insertToListEmpty: (config: CoreConfig<T>, index: number, value: T) => void;
|
13
|
-
}
|
13
|
+
};
|
14
14
|
export type MapFrom<T> = (object: T, droppable: Element) => unknown;
|
15
15
|
export interface DragStartEventData<T> {
|
16
16
|
index: number;
|
@@ -95,8 +95,8 @@ export interface Config<T> {
|
|
95
95
|
* @public
|
96
96
|
*/
|
97
97
|
export type OnDropEvent = (source: DraggableElement, destination: DraggableElement) => void;
|
98
|
-
export type OnRemoveAtEvent<T> = (index: number) => T | undefined;
|
99
|
-
export type OnInsertEvent<T> = (index: number, value: T) => void;
|
98
|
+
export type OnRemoveAtEvent<T> = (index: number, sync?: boolean) => T | undefined;
|
99
|
+
export type OnInsertEvent<T> = (index: number, value: T, sync?: boolean) => void;
|
100
100
|
export type OnGetLength = () => number;
|
101
101
|
export type OnGetValue<T> = (index: number) => T;
|
102
102
|
export type CoreConfig<T> = {
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import { CoreConfig } from
|
2
|
-
import HandlerPublisher from
|
1
|
+
import { CoreConfig } from '.';
|
2
|
+
import { default as HandlerPublisher } from './HandlerPublisher';
|
3
|
+
|
3
4
|
export default function useDraggable<T>(draggableElement: HTMLElement, index: number, config: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher): readonly [(targetIndex: number) => void, (targetIndex: number, value: T) => void];
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import { CoreConfig } from
|
2
|
-
import HandlerPublisher from
|
1
|
+
import { CoreConfig } from '.';
|
2
|
+
import { default as HandlerPublisher } from './HandlerPublisher';
|
3
|
+
|
3
4
|
export default function useDroppable<T>(coreConfig: CoreConfig<T>, handlerPublisher: HandlerPublisher, droppable?: HTMLElement, indexAttr?: string): readonly [((targetIndex: number) => void)[], ((targetIndex: number, value: T) => void)[]];
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { Direction } from
|
2
|
-
import { BeforeMargin, AfterMargin, BorderWidth, PaddingBefore, Before } from
|
1
|
+
import { Direction } from '..';
|
2
|
+
import { BeforeMargin, AfterMargin, BorderWidth, PaddingBefore, Before } from '../../../index';
|
3
|
+
|
3
4
|
export declare const getWindowScroll: () => {
|
4
5
|
scrollX: number;
|
5
6
|
scrollY: number;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { GapStyle } from
|
2
|
-
import { Direction } from
|
1
|
+
import { GapStyle } from '../../../index';
|
2
|
+
import { Direction } from '..';
|
3
|
+
|
3
4
|
export declare const getNumberFromPixels: (pixels: string | undefined) => number;
|
4
5
|
export declare const computeGapPixels: (element: Element, gapType: GapStyle) => number;
|
5
6
|
export declare const gapAndDisplayInformation: (element: Element | null, gapStyle: GapStyle) => [number, boolean];
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { DragMouseTouchEvent, fixedSize } from
|
1
|
+
import { DragMouseTouchEvent, fixedSize } from '../../../index';
|
2
|
+
|
2
3
|
type onTouchEvent = "ontouchstart" | "ontouchmove" | "ontouchend";
|
3
4
|
declare const onMouseEvents: readonly ["onmouseup", "onmousedown", "onmousemove"];
|
4
5
|
type onMouseEvent = (typeof onMouseEvents)[number];
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { DragMouseTouchEvent, TransformEvent } from
|
2
|
-
import { Direction } from
|
1
|
+
import { DragMouseTouchEvent, TransformEvent } from '../../../index';
|
2
|
+
import { Direction } from '..';
|
3
|
+
|
3
4
|
export declare const useTransform: (draggedElement: HTMLElement) => readonly [(element: HTMLElement, parent: HTMLElement, pagePosition: {
|
4
5
|
pageX: number;
|
5
6
|
pageY: number;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ListCondig, MapFrom } from
|
2
|
-
import {
|
3
|
-
|
1
|
+
import { ListCondig, MapFrom, Config, CoreConfig } from '..';
|
2
|
+
import { DroppableConfig } from '../configHandler';
|
3
|
+
|
4
4
|
export declare const getConfig: <T>(listCondig: ListCondig<T>, config?: Config<T>) => CoreConfig<T>;
|
5
5
|
export declare const MapConfig: <T>(coreConfig: DroppableConfig<any>, mapFrom: MapFrom<T>) => CoreConfig<any>;
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { DroppableConfig } from
|
2
|
-
import { DragMouseTouchEvent } from
|
3
|
-
import { MapFrom } from
|
1
|
+
import { DroppableConfig } from '../configHandler';
|
2
|
+
import { DragMouseTouchEvent } from '../../../index';
|
3
|
+
import { MapFrom } from '..';
|
4
|
+
|
4
5
|
export declare class DroppableConfigurator<T> {
|
5
6
|
initial: DroppableConfig<any> | undefined;
|
6
7
|
current: DroppableConfig<T> | undefined;
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import { WindowScroll } from
|
2
|
-
import { CoreConfig } from
|
3
|
-
import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from
|
4
|
-
import { DroppableConfig } from
|
5
|
-
import HandlerPublisher from '../../HandlerPublisher';
|
1
|
+
import { WindowScroll } from '../../../../index';
|
2
|
+
import { CoreConfig } from '../..';
|
3
|
+
import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from '..';
|
4
|
+
import { DroppableConfig } from '../../configHandler';
|
5
|
+
import { default as HandlerPublisher } from '../../HandlerPublisher';
|
6
|
+
|
6
7
|
type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
|
7
8
|
type DragAndDropEvent = DraggingEvent | DropEvent;
|
8
9
|
type DropEvent = "drop" | typeof START_DROP_EVENT;
|
9
10
|
export default function useEmitEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DragAndDropEvent, initialWindowScroll: WindowScroll, droppableConfig: DroppableConfig<T> | undefined, positionOnSourceDroppable?: number) => void, (targetIndex: number, draggedElement: HTMLElement, droppableConfig: DroppableConfig<T>, onFinishRemoveEvent: (element: HTMLElement) => void) => void, (targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, startInserting: () => void) => void, (draggedElement: HTMLElement) => void, (element: Element, force: boolean) => void];
|
10
|
-
export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined, targetIndex: number, value: T) => void;
|
11
|
+
export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined | null, targetIndex: number, value: T) => void;
|
11
12
|
export {};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { ElementScroll } from
|
2
|
-
import { Direction } from
|
1
|
+
import { ElementScroll } from 'index';
|
2
|
+
import { Direction } from '..';
|
3
|
+
|
3
4
|
export declare const scrollByDirection: (element: HTMLElement, direction: Direction, scrollAmount: number) => void;
|
4
5
|
export declare const scrollPercent: (direction: Direction, droppable: HTMLElement, droppableScroll: ElementScroll) => number;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { DroppableConfig } from
|
1
|
+
import { DroppableConfig } from '../configHandler';
|
2
|
+
|
2
3
|
export declare const isTempElement: (element: Node) => boolean;
|
3
4
|
export declare const addTempChild: <T>(draggedElement: HTMLElement | undefined, parent: Element, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>, addingAnimationDuration?: number) => void;
|
4
5
|
export declare const addTempChildOnInsert: <T>(draggedElement: HTMLElement | undefined, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>) => void;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { Direction } from
|
2
|
-
import { Translate, WindowScroll } from
|
1
|
+
import { Direction } from '../..';
|
2
|
+
import { Translate, WindowScroll } from '../../../../index';
|
3
|
+
|
3
4
|
export default function getTranslateBeforeDropping(direction: Direction, siblings: Element[], sourceIndex: number, targetIndex: number, scroll: WindowScroll, previousScroll: {
|
4
5
|
scrollLeft: number;
|
5
6
|
scrollTop: number;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { Direction } from
|
2
|
-
import { DragAndDropEvent } from
|
1
|
+
import { Direction } from '../..';
|
2
|
+
import { DragAndDropEvent } from '..';
|
3
|
+
|
3
4
|
export default function getTranslationByDraggingAndEvent(current: HTMLElement, event: DragAndDropEvent, direction: Direction, droppable: HTMLElement, previousElement?: Element | null, nextElement?: Element | null): {
|
4
5
|
height: number;
|
5
6
|
width: number;
|
package/dist/index/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-Tde6DOzb.cjs");exports.dragAndDrop=e.dragAndDrop;
|
package/dist/index/index.mjs
CHANGED