Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<style>
:global([draggable]) {
-webkit-touch-callout:none;
-ms-touch-action:none; touch-action:none;
-moz-user-select:none; -webkit-user-select:none; -ms-user-select:none; user-select:none;
}
</style>

<script context="module">
import DragDropTouch from 'svelte-drag-drop-touch'
import ListView from 'svelte-sortable-flat-list-view'
</script>

<script>
let List = []
for (let i = 1; i < 10; i++) { List.push(new String('Item ' + i)) }

function onSortRequest ( // optional callback before sorting
x,y, DroppableExtras, DropZoneExtras
) {
console.log('onSortRequest', x,y, DroppableExtras,DropZoneExtras)
return true // allow sorting
}

function onSort ( // optional callback performing actual sorting
beforeItem, ItemList
) {
console.log('onSort', beforeItem, ItemList)

List = List.filter((Item) => (ItemList.indexOf(Item) < 0))

let InsertionIndex = List.indexOf(beforeItem)
if (InsertionIndex < 0) { InsertionIndex = List.length }

List.splice.apply(List, [InsertionIndex,0].concat(ItemList))

loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */