### Install Fluid DnD using package managers Source: https://fluid-dnd.netlify.app/vue/introduction/introduction Instructions for installing the Fluid DnD library into your project using npm, yarn, or pnpm, the most common JavaScript package managers. ```bash # with npm: npm i fluid-dnd # with yarn: yarn add fluid-dnd # with pnpm: pnpm i fluid-dnd ``` -------------------------------- ### Global setup of Fluid DnD composable in Vue.js Source: https://fluid-dnd.netlify.app/vue/introduction/introduction Demonstrates how to make the `useDragAndDrop` composable available throughout your entire Vue.js application by using Vue's provide/inject mechanism in your main application entry file. ```javascript import { createApp } from "vue"; import App from './App.vue'; import { useDragAndDrop } from "fluid-dnd/vue"; const app = createApp(App); app.provide('useDragAndDrop', useDragAndDrop); app.mount('#app'); ``` -------------------------------- ### Vue Script Setup for Editable Drag-and-Drop List Source: https://fluid-dnd.netlify.app/vue/guides/listinputs This Vue ``` -------------------------------- ### Local import of Fluid DnD composable in Vue.js component Source: https://fluid-dnd.netlify.app/vue/introduction/introduction Illustrates how to import the `useDragAndDrop` composable directly into a specific Vue.js component's script section for localized usage, providing flexibility for component-specific drag-and-drop functionalities. ```vue ``` -------------------------------- ### Configure Vue Drag and Drop with Handler Selector Source: https://fluid-dnd.netlify.app/vue/guides/styles/listhandler This snippet demonstrates how to initialize the `useDragAndDrop` composable in a Vue 3 setup script, passing a `handlerSelector` option to specify a draggable handle. It imports necessary components and sets up a reactive list. ```Vue ``` -------------------------------- ### Initialize Fluid DnD for List Insertion in Vue Source: https://fluid-dnd.netlify.app/vue/guides/actions/listinsert This snippet demonstrates the initial setup for using Fluid DnD to manage a list. It imports necessary functions from Vue and Fluid DnD, initializes a reactive list, and extracts the `parent` ref and `insertAt` function from `useDragAndDrop` for list manipulation. ```Vue ``` -------------------------------- ### Define CSS Styles for Elements Being Removed Source: https://fluid-dnd.netlify.app/vue/guides/actions/listremove Provides example CSS to style elements that have the `removed` class applied. It includes a transition for opacity, creating a smooth visual effect as items fade out before being fully removed. ```CSS ``` -------------------------------- ### Initialize Horizontal List with Fluid DnD in Vue Source: https://fluid-dnd.netlify.app/vue/guides/horizontallist This Vue 3 setup script demonstrates how to create a reactive list of numbers and enable horizontal drag-and-drop functionality using the `useDragAndDrop` composable from Fluid DnD, specifying `direction: "horizontal"`. ```Vue ``` -------------------------------- ### Initialize Fluid DnD for a Sortable List in Vue Source: https://fluid-dnd.netlify.app/vue/guides/verticallist This snippet demonstrates how to set up a reactive list and initialize the useDragAndDrop composable from fluid-dnd/vue in a Vue 3 ``` -------------------------------- ### Configure Droppable Class for Vue Lists Source: https://fluid-dnd.netlify.app/vue/guides/styles/droppableclass This Vue `script setup` block initializes two reactive lists (`list1`, `list2`) using the `useDragAndDrop` composable. Both lists are assigned to `droppableGroup: "group1"` and configured with `droppableClass: 'droppable-hover'`, which specifies the CSS class to be applied to a droppable element when a draggable item is dragged over it, providing visual feedback. ```TypeScript ``` -------------------------------- ### Chaining Multiple Coordinate Mappers in Vue Source: https://fluid-dnd.netlify.app/vue/guides/events/mapcoordinates This example illustrates how to apply multiple coordinate transformation functions sequentially using `coordinateTransform`. It combines the `lockAxis` function with a `gridTranslate` function to snap the dragged item to a defined grid size after locking the axis, showcasing how outputs of one mapper become inputs for the next. ```Vue ``` -------------------------------- ### Vue: Handling Drag Start and End Events to Toggle Classes Source: https://fluid-dnd.netlify.app/vue/guides/events/ondrag This snippet demonstrates how to use `onDragStart` and `onDragEnd` events with Fluid DnD to dynamically toggle a CSS class (`marked-droppable`) on droppable elements. It utilizes `useTemplateRef` to get a reference to a group of droppables and iterates through them to apply or remove the class based on the drag state. The `useDragAndDrop` composable is configured with these event handlers for two lists. ```Vue ``` -------------------------------- ### Initialize Vue list for scrollable drag-and-drop Source: https://fluid-dnd.netlify.app/vue/guides/verticallistautoscroll This Vue 3 setup script initializes a large array of numbers and binds it to a draggable parent element using `useDragAndDrop`. This prepares the data and the DOM reference for a list that will support drag-and-drop interactions within a scrollable container. ```Vue ``` -------------------------------- ### Vue Script Setup for Draggable Table Data Source: https://fluid-dnd.netlify.app/vue/guides/sortingtable This Vue script block initializes a reactive `table` array of `Person` objects and integrates the `useDragAndDrop` composable from `fluid-dnd/vue`. It sets up the data structure for the table rows and configures the drag-and-drop behavior, including a `draggingClass` for visual feedback during dragging. The `parent` ref returned by `useDragAndDrop` will be bound to the draggable container in the template. ```TypeScript ``` -------------------------------- ### Define Grouped Lists for Drag and Drop in Vue Source: https://fluid-dnd.netlify.app/vue/guides/events/mapvalues This snippet demonstrates how to initialize two separate lists (`list` and `list2`) using `useDragAndDrop` from Fluid DnD, assigning them to the same `droppableGroup` ('group1'). This setup allows elements to be dragged and dropped between these lists, forming a logical group. ```Vue ``` -------------------------------- ### Configure Vue lists for multiple drag and drop groups Source: https://fluid-dnd.netlify.app/vue/guides/listgroup This example modifies the `droppableGroup` parameter for `list2` to include 'group2' in addition to 'group1'. This demonstrates how a list can belong to multiple groups, allowing for more complex conditional drag-and-drop interactions where elements can only be moved if groups overlap. ```Vue ``` -------------------------------- ### Define lists with shared droppable group in Vue Source: https://fluid-dnd.netlify.app/vue/guides/listgroup This snippet shows how to initialize two reactive lists (`list1`, `list2`) and associate them with a common `droppableGroup` named 'group1' using the `useDragAndDrop` composable. This setup enables elements to be dragged and dropped between these two lists. ```Vue ``` -------------------------------- ### Vue: Accessing Drag Event Data (Value and Index) Source: https://fluid-dnd.netlify.app/vue/guides/events/ondrag This example illustrates how to access detailed information from `onDragStart` and `onDragEnd` events using `DragStartEventData` and `DragEndEventData` types from `fluid-dnd`. It demonstrates how to capture the `value` of the dragged element and the last dropped element, storing them in reactive references for display or further processing. ```Vue ``` -------------------------------- ### Vue Drag and Drop with Conditional Draggability Source: https://fluid-dnd.netlify.app/vue/example/vertical-list/single-vertical-list-component-with-is-draggable This Vue component uses `fluid-dnd/vue` to create a vertical list of draggable Pokemon. It demonstrates the `isDraggable` option, which is a function that determines if an element can be dragged. In this example, Pokemon classified as 'L' (Large) based on their weight are made non-draggable by adding the `is-not-draggable` class. ```Vue ``` -------------------------------- ### Define CSS Styles for Inserting Elements Source: https://fluid-dnd.netlify.app/vue/guides/actions/listinsert This CSS snippet provides styles for elements during the insertion process. The `.number` class defines a default opacity and transition, while the `.number.inserting` class sets the opacity to 0, creating a fade-in effect when an element is inserted and the 'inserting' class is applied. ```CSS ``` -------------------------------- ### Create Vue Template for List and Insertion Button Source: https://fluid-dnd.netlify.app/vue/guides/actions/listinsert This template defines the user interface for the draggable list. It uses a `ul` element bound to the `parent` ref for Fluid DnD functionality and iterates through the `list` to display elements. An 'Add' button is included, which calls `insertAt` to append new elements to the list. ```Vue ``` -------------------------------- ### Initialize a Vue reactive list with mixed styles Source: https://fluid-dnd.netlify.app/vue/guides/verticalliststyles This JavaScript snippet defines a reactive `ref` named `list` in Vue, containing an array of objects. Each object represents a list item with a unique `id`, `content`, and an inline `style` string. This structure is crucial for maintaining distinct visual appearances for each element when using Fluid DnD, as it ensures styles are directly associated with the element rather than relying on positional CSS selectors. ```JavaScript const list = ref([ { id: "1", style: "margin: 30px 0px; border-style: solid; border-width: 0.8rem; padding: 5px;", content: "1", }, { id: "2", style: "margin: 20px 0px; border-style: solid; border-width: 0.6rem; padding: 10px;", content: "2", }, { id: "3", style: "margin: 10px 0px; border-style: solid; border-width: 0.4rem; padding: 15px;", content: "3", } ]) ``` -------------------------------- ### Vue.js Single Vertical Drag-and-Drop List Implementation Source: https://fluid-dnd.netlify.app/vue/example/vertical-list/single-vertical-list This Vue component demonstrates creating a draggable vertical list of Pokemon items. It uses `fluid-dnd/vue`'s `useDragAndDrop` composable to enable reordering, applies a `dragging-pokemon` class during drag, and allows configuring a `delayBeforeTouchMoveEvent` for touch devices. Data is fetched asynchronously, and individual items are rendered using `PokemonComponent.vue`. ```vue ``` -------------------------------- ### Initialize Fluid DnD for List Element Removal (Vue) Source: https://fluid-dnd.netlify.app/vue/guides/actions/listremove Demonstrates how to set up a reactive list in Vue and extract the `removeAt` function from `fluid-dnd/vue`'s `useDragAndDrop` composable, which is essential for programmatically removing elements from the list. ```Vue ``` -------------------------------- ### Implement Drag and Drop for Multiple Pokemon Lists in Vue Source: https://fluid-dnd.netlify.app/vue/example/vertical-list/group-vertical-lists This Vue.js component demonstrates how to create and manage multiple vertical lists of Pokemon using the `fluid-dnd` library for drag-and-drop functionality. It fetches Pokemon data for three different generations, initializes separate reactive arrays for each, and applies `useDragAndDrop` to enable seamless reordering and transfer of Pokemon between these lists. ```Vue ``` -------------------------------- ### Render a Sortable Vertical List with Basic Styles in Vue Source: https://fluid-dnd.netlify.app/vue/guides/verticallist This snippet shows the Vue template structure for rendering a sortable list of numbers, iterating over the list array. It also includes basic CSS styles to visually represent the list items and the container, making them suitable for drag-and-drop operations. This is the next step after initializing the list in the script. ```Vue ``` ```CSS ``` -------------------------------- ### Render draggable and droppable lists in Vue template Source: https://fluid-dnd.netlify.app/vue/guides/listgroup This code defines the HTML template for displaying the two lists (`list1`, `list2`) configured for drag and drop. It uses `ref` to bind the parent elements to the `useDragAndDrop` composable and `v-for` to render individual list items, making them interactive. ```Vue ``` -------------------------------- ### Render Draggable List and Define Dragging Styles in Vue Template Source: https://fluid-dnd.netlify.app/vue/guides/styles/draggingclass This snippet provides the Vue template structure for rendering the draggable list, binding the `ul` element to the `parent` ref for Fluid DnD functionality. It also includes the associated CSS, defining the `.dragging` class with transition, background-color, and color properties to visually highlight dragged items. ```Vue ``` -------------------------------- ### Vue Template and Styles for Editable Drag-and-Drop List Rendering Source: https://fluid-dnd.netlify.app/vue/guides/listinputs This snippet defines the Vue template and associated CSS for rendering the editable list. The