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.
Files changed (43) hide show
  1. package/README.md +6 -1
  2. package/dist/{HandlerPublisher-CAhfY7Ch.js → HandlerPublisher-CIc7wXW-.js} +1 -1
  3. package/dist/{HandlerPublisher-BttKXTeA.cjs → HandlerPublisher-DiGO5iOY.cjs} +1 -1
  4. package/dist/core/configHandler.d.ts +3 -2
  5. package/dist/core/dragAndDrop.d.ts +4 -4
  6. package/dist/core/index.d.ts +6 -6
  7. package/dist/core/useDraggable.d.ts +3 -2
  8. package/dist/core/useDroppable.d.ts +3 -2
  9. package/dist/core/utils/GetStyles.d.ts +3 -2
  10. package/dist/core/utils/ParseStyles.d.ts +3 -2
  11. package/dist/core/utils/SetStyles.d.ts +2 -1
  12. package/dist/core/utils/SetTransform.d.ts +3 -2
  13. package/dist/core/utils/config.d.ts +3 -3
  14. package/dist/core/utils/droppableConfigurator.d.ts +4 -3
  15. package/dist/core/utils/events/emitEvents.d.ts +7 -6
  16. package/dist/core/utils/scroll.d.ts +3 -2
  17. package/dist/core/utils/tempChildren.d.ts +2 -1
  18. package/dist/core/utils/translate/GetTranslateBeforeDropping.d.ts +3 -2
  19. package/dist/core/utils/translate/GetTranslationByDraggingAndEvent.d.ts +3 -2
  20. package/dist/index/index.cjs +1 -1
  21. package/dist/index/index.mjs +1 -1
  22. package/dist/index-BDu6-Hq8.js +1283 -0
  23. package/dist/index-Tde6DOzb.cjs +1 -0
  24. package/dist/react/index.cjs +1 -0
  25. package/dist/react/index.d.ts +3 -0
  26. package/dist/react/index.mjs +55 -0
  27. package/dist/react/useDragAndDrop.d.ts +3 -0
  28. package/dist/react/utils/ReactLilstConfig.d.ts +4 -0
  29. package/dist/svelte/index.cjs +1 -1
  30. package/dist/svelte/index.d.ts +2 -1
  31. package/dist/svelte/index.mjs +2 -2
  32. package/dist/svelte/useDragAndDrop.d.ts +2 -1
  33. package/dist/svelte/utils/SvelteListCondig.d.ts +2 -2
  34. package/dist/vue/index.cjs +1 -1
  35. package/dist/vue/index.d.ts +2 -1
  36. package/dist/vue/index.mjs +2 -2
  37. package/dist/vue/useDragAndDrop.d.ts +3 -2
  38. package/dist/vue/utils/DropMethods.d.ts +2 -1
  39. package/dist/vue/utils/VueListCondig.d.ts +3 -3
  40. package/package.json +12 -8
  41. package/dist/index-BnYdI35p.js +0 -1281
  42. package/dist/index-LwQqhkeh.cjs +0 -1
  43. 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 3 and Svelte](https://fluid-dnd.netlify.app/). It's a**lightweight** tool ~7 Kb (gzip) with no depenencies.
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-BnYdI35p.js";
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-LwQqhkeh.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
+ "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,5 +1,6 @@
1
- import { ElementScroll } from "../../index";
2
- import { CoreConfig } from ".";
1
+ import { ElementScroll } from '../../index';
2
+ import { CoreConfig } from '.';
3
+
3
4
  export type DroppableConfig<T> = {
4
5
  droppable: HTMLElement;
5
6
  config: CoreConfig<T>;
@@ -1,4 +1,4 @@
1
- import { ListCondig } from ".";
2
- import { Config } from ".";
3
- import HandlerPublisher from "@/core/HandlerPublisher";
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];
@@ -4,13 +4,13 @@ export type DraggableElement = {
4
4
  } | {
5
5
  index: number;
6
6
  };
7
- export interface ListCondig<T> {
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 "./HandlerPublisher";
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 "./HandlerPublisher";
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 "../../../index";
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 "../../../index";
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 "../../../index";
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 "../../../index";
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 { Config, CoreConfig } from "..";
3
- import { DroppableConfig } from "../configHandler";
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 "../configHandler";
2
- import { DragMouseTouchEvent } from "../../../index";
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 "../../../../index";
2
- import { CoreConfig } from "../..";
3
- import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from "..";
4
- import { DroppableConfig } from "../../configHandler";
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 "index";
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 "../configHandler";
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 "../../../../index";
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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-LwQqhkeh.cjs");exports.dragAndDrop=e.dragAndDrop;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-Tde6DOzb.cjs");exports.dragAndDrop=e.dragAndDrop;
@@ -1,4 +1,4 @@
1
- import { d as o } from "../index-BnYdI35p.js";
1
+ import { d as o } from "../index-BDu6-Hq8.js";
2
2
  export {
3
3
  o as dragAndDrop
4
4
  };