<script lang="ts">import { globalProjects } from '../consts';
import { getProject } from '../theatre';
import { setContext } from 'svelte';
let { name = 'default', config, project = $bindable(), isReady = $bindable(), children } = $props();
project = globalProjects.get(name) ?? getProject(name, config);
globalProjects.set(name, project);
const syncReady = async () => {
    await project.ready;
    isReady = true;
};
syncReady();
// CHILD CONTEXT
setContext(`theatre-project`, project);
</script>

{#await project.ready then}
  {@render children?.({ project })}
{/await}
