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
mock.js
TestItem.svelte
<script>
import {tick} from "svelte"
import {flip} from "svelte/animate"
import VirtualScroll from "svelte-virtual-scroll-list"
import {createSequenceGenerator, randomInteger, randomString} from "./mock"
import TestItem from "./TestItem.svelte"

const getItemId = createSequenceGenerator()
const getNotificationId = createSequenceGenerator()

let items = []
addItems(true, 1000)

let list
let notifications = {}

function addItems(top = true, count = 10) {
let new_items = []
for (let i = 0; i < count; i++)
new_items.push({uniqueKey: getItemId(), text: randomString(3, 200), height: randomInteger(20, 60)})
if (top)
items = [...new_items, ...items]
else
items = [...items, ...new_items]
}

function addNotification(e) {
const id = getNotificationId()
notifications[id] = e
setTimeout(() => {
delete notifications[id]
notifications = notifications
}, 5000)
}
</script>
<div class="vs">
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */