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
<script>
import {derived, writable} from "svelte/store";
import {Button, TabItem} from "flowbite-svelte";

const teamDict = writable({})
const userDict = writable({})

teamDict.subscribe(($$teamDict) => {
const userDictCopy = $userDict
for (const key in userDictCopy) {
delete userDictCopy[key]
}
Object.assign(userDictCopy, Object.values($$teamDict).reduce((acc, team) => ({...acc, ...team[`users`]}), {}))
})
userDict.subscribe(($$userDict) => {
const teamDictCopy = $teamDict
for (const team of Object.values(teamDictCopy)) {
team[`users`] = {}
}
for (const [userId, user] of Object.entries($$userDict)) {
teamDictCopy[user[`team_id`]][`users`][userId] = user
}
})

const storeView = derived(
[teamDict, userDict],
([$teamDict, $userDict], set) => {
set({teamDict: $teamDict, userDict: $userDict})
}
)

function initTeamDict() {
teamDict.set({
1: {
name: "good team",
users: {
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */